Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update kanvas.yml to generate snapshot #88

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b67e964
update kanvas.yml to generate snapshot
Aijeyomah Jan 15, 2025
f7d3902
add comment for each inputs
Aijeyomah Jan 15, 2025
01ccaa8
add new line
Aijeyomah Jan 16, 2025
c654563
Map GITHUB_TOKEN to the environment
Aijeyomah Jan 16, 2025
df032ad
verify env variable
Aijeyomah Jan 16, 2025
a14010d
verify env variable
Aijeyomah Jan 16, 2025
a4935fd
verify env variable
Aijeyomah Jan 16, 2025
5a56b81
verify env variable
Aijeyomah Jan 16, 2025
c9e0680
update workflowAccessToken to use github token
Aijeyomah Jan 16, 2025
6ba772d
update kanvas filepath
Aijeyomah Jan 16, 2025
d0d7c1d
update kanvas filepath
Aijeyomah Jan 16, 2025
7c389fa
update kanvas filepath
Aijeyomah Jan 16, 2025
ed341c2
update kanvas filepath
Aijeyomah Jan 16, 2025
f4f042a
update kanvas filepath
Aijeyomah Jan 16, 2025
9aaba8b
update kanvas filepath
Aijeyomah Jan 16, 2025
1a617f7
update kanvas filepath
Aijeyomah Jan 16, 2025
c8ac3da
update kanvas filepath
Aijeyomah Jan 16, 2025
6fc2d4f
update kanvas filepath
Aijeyomah Jan 16, 2025
86f0eac
update kanvas filepath
Aijeyomah Jan 16, 2025
de98600
update kanvas filepath
Aijeyomah Jan 16, 2025
3a4fed0
update kanvas filepath
Aijeyomah Jan 16, 2025
2f40035
update kanvas filepath
Aijeyomah Jan 16, 2025
c0c98d5
update kanvas filepath
Aijeyomah Jan 16, 2025
299dfa6
Add application url in the kanvas workflow
Aijeyomah Jan 16, 2025
8e157a9
Add application url in the kanvas workflow
Aijeyomah Jan 16, 2025
15c68d1
update kanvas snapshot version
Aijeyomah Jan 16, 2025
8368c7b
update kanvas snapshot version
Aijeyomah Jan 16, 2025
d02c39e
update kanvas yml file
Aijeyomah Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/kanvas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Kanvas Screenshot Service
'on':
workflow_dispatch:
inputs:
contentID:
contentID:
description: ID of the design to render.
required: true
type: string
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# include build/Makefile.core.mk
include helpers/Makefile.core.mk


.PHONY: all
Expand Down Expand Up @@ -58,7 +58,7 @@ DATE?=$(shell date)
PLATFORM?=$(shell go env GOOS)
ARCHITECTURE?=$(shell go env GOARCH)
GOVERSION?=$(shell go version | awk '{printf $$3}')
BUILD_WITH_FLAGS="-s -w -X 'github.com/meshery/helm-kanvas-snapshot/version.Version=${VERSION}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Env=${BUILD_ENVIRONMENT}' -X 'github.com/meshery/helm-kanvas-snapshot/version.BuildDate=${DATE}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Revision=${REVISION}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Platform=${PLATFORM}/${ARCHITECTURE}' -X 'github.com/meshery/helm-kanvas-snapshot/version.GoVersion=${GOVERSION}' -X 'main.providerToken=$(PROVIDER_TOKEN)' -X 'main.MesheryCloudApiBaseUrl=$(MESHERY_CLOUD_API_BASE_URL)' -X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)'"
BUILD_WITH_FLAGS="-s -w -X 'github.com/meshery/helm-kanvas-snapshot/version.Version=${VERSION}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Env=${BUILD_ENVIRONMENT}' -X 'github.com/meshery/helm-kanvas-snapshot/version.BuildDate=${DATE}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Revision=${REVISION}' -X 'github.com/meshery/helm-kanvas-snapshot/version.Platform=${PLATFORM}/${ARCHITECTURE}' -X 'github.com/meshery/helm-kanvas-snapshot/version.GoVersion=${GOVERSION}' -X 'main.workflowAccessToken=$(GITHUB_TOKEN)' -X 'main.providerToken=$(PROVIDER_TOKEN)' -X 'main.mesheryCloudApiBaseUrl=$(MESHERY_CLOUD_API_BASE_URL)' -X 'main.mesheryApiBaseUrl=$(MESHERY_API_BASE_URL)'"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -81,7 +81,8 @@ local.check: local.fmt ## Loads all dependencies
@go mod tidy

local.build: local.check ## Generates the artifact with 'go build'
@go build -o $(APP_NAME) -ldflags="-s -w"
@echo "BUILD_WITH_FLAGS: ${BUILD_WITH_FLAGS}"
@go build -o $(APP_NAME) -ldflags=${BUILD_WITH_FLAGS}

local.snapshot: local.check ## Generates the artifact with 'go build'
GOVERSION=${GOVERSION} BUILD_ENVIRONMENT=${BUILD_ENVIRONMENT} goreleaser build --snapshot --clean
Expand Down
4 changes: 3 additions & 1 deletion cmd/kanvas-snapshot/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {

func GenerateSnapshot(contentID, assetLocation string, ghAccessToken string) error {
fmt.Println(len(ghAccessToken))
payload := fmt.Sprintf(`{"ref":"master","inputs":{"contentID":"%s","assetLocation":"%s"}}`, contentID, assetLocation)
applicationType := url.PathEscape("Helm Chart")

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
2 changes: 2 additions & 0 deletions helpers/Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ GOVERSION = 1.21
PROVIDER_TOKEN="dev_token"
MESHERY_CLOUD_API_BASE_URL="http://localhost:9876"
MESHERY_API_BASE_URL="http://localhost:3000"
GITHUB_TOKEN="..."

Loading