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 payload to generate snapshot #33

Merged
merged 17 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
63 changes: 63 additions & 0 deletions .github/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
project_name: kanvas-snapshot
version: 2
before:
hooks:
- go mod tidy

builds:
- main: cmd/kanvas-snapshot/main.go

env:
- CGO_ENABLED=0

ldflags:
- -s -w
- -X main.providerToken=${{ .Env.PROVIDER_TOKEN }}
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
- -X main.MesheryCloudApiBaseUrl="https://meshery.layer5.io"
- -X main.MesheryApiBaseUrl="https://playground.meshery.io"

goos:
- darwin
- linux
- windows

goarch:
- 386
- amd64
- arm
- arm64

ignore:
- goos: windows
goarch: arm
- goos: windows
goarch: arm64

archives:
- id: stable
name_template: >-
{{ .ProjectName }}_{{.Version}}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format: tar.gz
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'checksums.txt'

snapshot:
version_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
name_template: "Helm Kanvas Snapshot {{.Tag}}"
13 changes: 3 additions & 10 deletions .github/workflows/build-and-release-snapshot-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_CHANNEL: "stable"
MESHERY_CLOUD_API_COOKIE: ${{ secrets.MESHERY_CLOUD_API_COOKIE }}
MESHERY_API_COOKIE: ${{ secrets.MESHERY_API_COOKIE }}
OWNER: ${{ secrets.OWNER }}
REPO: ${{ secrets.REPO }}
WORKFLOW: ${{ secrets.WORKFLOW }}
BRANCH: ${{ secrets.BRANCH }}
MESHERY_CLOUD_API_BASE_URL: ${{ secrets.MESHERY_CLOUD_API_BASE_URL }}
MESHERY_API_BASE_URL: ${{ secrets.MESHERY_API_BASE_URL }}
SYSTEM_ID: ${{ secrets.SYSTEM_ID }}
PROVIDER_TOKEN: ${{ secrets.PROVIDER_TOKEN }}

with:
version: '~> v2'
args: release --clean --skip-validate
args: release --clean --skip validate -f .github/.goreleaser.yml
91 changes: 91 additions & 0 deletions .github/workflows/go-testing-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Golang Unit and Integration Tests
on:
push:
branches:
- "master"
paths:
- "**.go"
pull_request:
branches:
- "master"
paths:
- "**.go"
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"

jobs:
golangci:
strategy:
matrix:
go: [1.21]
os: [ubuntu-22.04]
name: golangci-lint
if: github.repository == 'meshery/helm-kanvas-snapshot'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
args: --config=.golangci.yml --timeout=10m
unit-tests:
name: Unit tests
runs-on: ubuntu-22.04
needs: golangci
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Run coverage
run: go test --short ./... -race -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
if: github.repository == 'meshery/helm-kanvas-snapshot'
uses: codecov/[email protected]
with:
files: ./coverage.txt
flags: unittests
integration-tests:
name: Integration tests
runs-on: ubuntu-22.04
needs: golangci
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: "kind-cluster"
- name: Run coverage
run:
# TODO: add tests for snapshot
echo "Running kanvas snapshot test completed."

- name: Upload coverage to Codecov
if: github.repository == 'meshery/helm-kanvas-snapshot'
uses: codecov/codecov-action@v4
with:
files: ./coverage.txt
flags: gointegrationtests
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
RELEASE_CHANNEL: "edge"
with:
version: latest
args: release --snapshot --skip-publish --clean
args: release --snapshot --skip publish --clean -f .github/.goreleaser.yml
4 changes: 2 additions & 2 deletions .github/workflows/meshmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ jobs:
githubToken: ${{ secrets.GITHUB_TOKEN }} # github's personal access token example: "ghp_...."
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: Kubernetes Manifest # your application type, could be any of three: "Kubernetes Manifest", "Docker Compose", "Helm Chart"
filePath: ${{ inputs.fileName == '' && 'install/deployment_yamls/k8s' || inputs.fileName }} # 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: "Helm chart" # your application type, could be any of three: "Kubernetes Manifest", "Docker Compose", "Helm Chart"
application_url: "https://github.com/meshery/meshery.io/raw/refs/heads/master/charts/meshery-v0.7.110.tgz"
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ include build/Makefile.core.mk
.PHONY: all
all: dep-check build
## Lint check
# golangci: error dep-check
# golangci-lint run --exclude-use-default
golangci: error dep-check
golangci-lint run --exclude-use-default

## Analyze error codes
error: dep-check
Expand Down Expand Up @@ -58,16 +58,9 @@ BINNAME_WINDOWS ?= kanvas-snapshot-windows-$(ARCH).exe


LDFLAGS := "\
-X 'main.GithubToken=$(GITHUB_TOKEN)' \
-X 'main.MesheryCloudApiCookie=$(MESHERY_CLOUD_API_COOKIES)' \
-X 'main.MesheryApiCookie=$(MESHERY_API_COOKIES)' \
-X 'main.Owner=$(OWNER)' \
-X 'main.Repo=$(REPO)' \
-X 'main.Workflow=$(WORKFLOW)' \
-X 'main.Branch=$(BRANCH)' \
-X 'main.providerToken=$(PROVIDER_TOKEN)' \
-X 'main.MesheryCloudApiBaseUrl=$(MESHERY_CLOUD_API_BASE_URL)' \
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)' \
-X 'main.SystemID=$(SYSTEM_ID)'"
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)'"

.PHONY: build
build:
Expand Down
11 changes: 2 additions & 9 deletions build/Makefile.core.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
GOVERSION = 1.23
GITHUB_TOKEN=""
MESHERY_API_COOKIE=""
MESHERY_CLOUD_API_COOKIE=""
OWNER="Aijeyomah"
REPO="Ng-depl"
WORKFLOW="meshmap.yml"
BRANCH="new-mesh"
PROVIDER_TOKEN="dev_token"
MESHERY_CLOUD_API_BASE_URL="http://localhost:9876"
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
MESHERY_API_BASE_URL="http://localhost:9081"
SYSTEM_ID="3ae41e77-5626-42d3-aa04-ee871ad3035c"
MESHERY_API_BASE_URL="http://localhost:3000"
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading