Skip to content

Commit

Permalink
update kanvas snapshot version
Browse files Browse the repository at this point in the history
Signed-off-by: Eti Ijeoma <[email protected]>
  • Loading branch information
Aijeyomah committed Jan 16, 2025
1 parent 15c68d1 commit 8368c7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 35 deletions.
53 changes: 20 additions & 33 deletions .github/workflows/kanvas.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
name: Kanvas Screenshot Service
'on':
pull_request:
types:
- opened
- synchronize
- reopened
workflow_call:
workflow_dispatch:
inputs:
application_type:
description: Type of the application (e.g., Helm Chart, Kubernetes Manifest, Docker Compose)
type: string
default: "Helm Chart"
application_url:
description: Design's source URI; location of the original manifests
type: string
designID:
description: "The design uuid, example: 3c116d0a-49ea-4294-addc-d9ab34210662"
contentID:
description: ID of the design to render.
required: true
type: string
assetLocation:
description: The location of the snapshot url
required: true
type: string
skipComment:
description: Skip comment
type: boolean
prNumber:
description: PR number
description: Remote location where the generated asset (screenshot) for the design will be stored.
workflow_call:
inputs:
fileName:
description: Relative file path from the root directory
required: true
type: string
default: "0"
outputs:
resource_url:
description: The URL of the generated resource.
value: ${{ jobs.KanvasScreenshot.outputs.resource_url }}
permissions:
actions: read
contents: write
Expand All @@ -45,23 +37,18 @@ jobs:
run: |
export pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo "PULL_NO=$pull_number" >> $GITHUB_ENV
if [ "$pull_number" = "null" ]; then
echo "PULL_NO=${{ inputs.prNumber }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
path: action
repository: layer5labs/kanvas-snapshot
- id: test_result
uses: layer5labs/[email protected].25
uses: layer5labs/[email protected].20
with:
githubToken: ${{ secrets.GITHUB_TOKEN }} # github's personal access token example: "ghp_...."
mesheryToken: ${{ secrets.GH_ACCESS_TOKEN }} # Meshery Cloud Authentication token, signin to meshery-cloud to get one, example: ey.....
mesheryToken: ${{ secrets.MESHERY_TOKEN }} # Meshery Cloud Authentication token, signin to meshery-cloud to get one, example: ey.....
prNumber: ${{ env.PULL_NO }} # auto-filled from the above step
application_type: ${{ inputs.application_type || 'Helm Chart' }} # your application type, could be any of three: "Kubernetes Manifest", "Docker Compose", "Helm Chart"
assetLocation: ${{ inputs.assetLocation }}
designID: ${{ inputs.designID }}
application_url: 'https://meshery.github.io/meshery.io/charts/meshery-v0.7.109.tgz' # relative file-path from the root directory in the github-runner env, you might require to checkout the repository as described in step 2


application_type: "Design" # your application type, could be any of three: "Kubernetes Manifest", "Docker Compose", "Helm Chart"
skipComment: true
designID: ${{ inputs.contentID }} # relative file-path from the root directory in the github-runner env, you might require to checkout the repository as described in step 2
assetLocation: ${{ inputs.assetLocation }}
4 changes: 2 additions & 2 deletions cmd/kanvas-snapshot/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {
return "", errors.ErrCreatingMesheryDesign(fmt.Errorf("failed to extract design ID from response"))
}

func GenerateSnapshot(designID, assetLocation string, ghAccessToken string) error {
func GenerateSnapshot(contentID, assetLocation string, ghAccessToken string) error {
fmt.Println(len(ghAccessToken))
applicationType := url.PathEscape("Helm Chart")

payload := fmt.Sprintf(`{"ref":"master","inputs":{"designID":"%s","assetLocation":"%s", "skipComment": true, "application_type": "%s" }}`, designID, assetLocation, applicationType)
payload := fmt.Sprintf(`{"ref":"master","inputs":{"contentID":"%s","assetLocation":"%s", "application_type": "%s" }}`, contentID, assetLocation, applicationType)
req, err := http.NewRequest("POST", "https://api.github.com/repos/meshery/helm-kanvas-snapshot/actions/workflows/kanvas.yaml/dispatches", bytes.NewBuffer([]byte(payload)))
if err != nil {
return err
Expand Down

0 comments on commit 8368c7b

Please sign in to comment.