From da3ffbf9af62bd519de5b4644f677d08f67fb821 Mon Sep 17 00:00:00 2001 From: dnitsch Date: Mon, 16 Jun 2025 15:56:02 +0100 Subject: [PATCH 1/5] fix: eirctl used bump tp 24.4 --- .github/workflows/build.yml | 14 +-- .github/workflows/release.yml | 14 +-- eirctl.yaml | 185 ++++++++++++++++++++++++++++++++++ go.mod | 2 +- taskfile.yml | 105 ------------------- 5 files changed, 200 insertions(+), 120 deletions(-) create mode 100644 eirctl.yaml delete mode 100644 taskfile.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f24c70f..2d86685 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,11 +51,11 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 - - name: Install Task - uses: arduino/setup-task@v2 - with: - version: 3.x - repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Eirctl + uses: ensono/actions/eirctl-setup@v0.3.1 + with: + version: 0.6.5 + isPrerelease: false - name: install deps run: | @@ -66,10 +66,10 @@ jobs: - name: Run Lint run: | - task lint + eirctl run pipeline lint - name: Run Tests run: | - task coverage + eirctl run pipeline test ls -alt .coverage/out ls -lat .coverage/report-junit.xml - name: Publish Junit style Test Report diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29c1d15..7a5d263 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,11 +52,11 @@ jobs: with: fetch-depth: 1 - - name: Install Task - uses: arduino/setup-task@v2 - with: - version: 3.x - repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Eirctl + uses: ensono/actions/eirctl-setup@v0.3.1 + with: + version: 0.6.5 + isPrerelease: false - name: install deps run: | @@ -66,10 +66,10 @@ jobs: git config user.name ${{ github.actor }} - name: release library run: | - task tag GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA + GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA eirctl run tag - name: build binary run: | - task bin REVISION=$GITHUB_SHA GIT_TAG=${SEMVER} + eirctl run pipeline build:bin --set VERSION=${SEMVER} --set REVISION=$GITHUB_SHA - name: Release binary uses: softprops/action-gh-release@v2 with: diff --git a/eirctl.yaml b/eirctl.yaml new file mode 100644 index 0000000..9c02908 --- /dev/null +++ b/eirctl.yaml @@ -0,0 +1,185 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/Ensono/eirctl/refs/heads/main/schemas/schema_v1.json + +output: prefixed +debug: false + +contexts: + go1x: + container: + name: golang:1.24.4-bookworm + enable_dind: true + enable_mount: true + envfile: + exclude: + - GO + - CXX + - CGO + + golint: + container: + name: golangci/golangci-lint:v2.1.5-alpine + enable_mount: true + envfile: + exclude: + - GO + - CXX + - CGO + - PATH + - HOME + +tasks: + clean: + context: go1x + command: + - rm -rf dist/* + - rm -rf .coverage + - mkdir -p dist .coverage + + run:test: + description: Runs the tests + context: go1x + command: + - | + go test ./... -v -buildvcs=false -mod=readonly -race -coverpkg=./... -coverprofile=.coverage/out | tee .coverage/unit + + install: + description: Install dependencies + command: | + go mod tidy + + lint:vet: + description: Runs lint and vet + context: go1x + command: | + go vet + + golint: + # in CI it is run + context: golint + description: Runs the linter and go vet and other default static checks + allow_failure: false + command: + # echo "lint ran with exit code: $?" + # pwd && ls -lat + - | + golangci-lint run + + vuln:check: + context: go1x + description: | + Runs a vulnerability scan against the code base + command: + - | + go install golang.org/x/vuln/cmd/govulncheck@latest + govulncheck ./... + + coverage: + description: generate coverage + context: go1x + command: + - | + go install github.com/jstemmer/go-junit-report/v2@latest + go install github.com/axw/gocov/gocov@latest + go install github.com/AlekSi/gocov-xml@latest + go-junit-report -in .coverage/unit > .coverage/report-junit.xml + gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml + + show:coverage: + description: Opens the current coverage viewer for the the configmanager utility. + command: go tool cover -html=.coverage/out + + show_docs: + description: | + Opens a webview with godoc running + Already filters the packages to this one and enables + internal/private package documentation +# go install golang.org/x/tools/cmd/godoc@latest + command: | + open http://localhost:6060/pkg/github.com/DevLabFoundry/configmanager/v2/?m=all + godoc -notes "BUG|TODO" -play -http=:6060 + + build:binary: + context: go1x + description: | + Generates binaries in a dist folder + + Generates all the binaries for the configmanager utility. + command: + - | + ldflags="-s -w -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Version={{.VERSION}}\" -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Revision={{.REVISION}}\" -extldflags -static" + GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} CGO_ENABLED=0 go build -mod=readonly -buildvcs=false -ldflags="$ldflags" \ + -o ./dist/configmanager-${GOOS}-${GOARCH}${BUILD_SUFFIX} ./cmd + reset_context: true + variations: + - BUILD_GOOS: darwin + BUILD_GOARCH: amd64 + BUILD_SUFFIX: "" + - BUILD_GOOS: darwin + BUILD_GOARCH: arm64 + BUILD_SUFFIX: "" + - BUILD_GOOS: linux + BUILD_GOARCH: amd64 + BUILD_SUFFIX: "" + - BUILD_GOOS: linux + BUILD_GOARCH: arm64 + BUILD_SUFFIX: "" + - BUILD_GOOS: windows + BUILD_GOARCH: amd64 + BUILD_SUFFIX: ".exe" + - BUILD_GOOS: windows + BUILD_GOARCH: arm64 + BUILD_SUFFIX: ".exe" + - BUILD_GOOS: windows + BUILD_GOARCH: "386" + BUILD_SUFFIX: ".exe" + required: + args: + - VERSION + - REVISION + + tag: + description: | + Usage `eirctl tag GIT_TAG=2111dsfsdfa REVISION=as2342432` + + command: | + git tag -a ${VERSION} -m "ci tag release" ${REVISION} + git push origin ${VERSION} + required: + env: + - VERSION + - REVISION + +pipelines: + test: + - task: clean + - task: run:test + depends_on: clean + - task: coverage + depends_on: run:test + + lint: + - task: lint:vet + - task: vuln:check + + show_coverage: + - pipeline: test + - task: show:coverage + depends_on: test + + build:bin: + - task: clean + - task: build:binary + depends_on: clean + +# version: '3' + +# env: +# OWNER: DevLabFoundry +# NAME: configmanager +# GO_TARGET_ARCH: "darwin" +# GIT_TAG: "0.0.0" +# VERSION: "v{{.GIT_TAG}}" +# REVISION: '{{.REVISION | default "aaaa1234" }}' + +# tasks: + diff --git a/go.mod b/go.mod index 92a5b0f..04f1901 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/DevLabFoundry/configmanager/v2 -go 1.24.3 +go 1.24.4 require ( cloud.google.com/go/secretmanager v1.14.7 diff --git a/taskfile.yml b/taskfile.yml deleted file mode 100644 index 6a2c9e1..0000000 --- a/taskfile.yml +++ /dev/null @@ -1,105 +0,0 @@ -# yaml-language-server: $schema=https://taskfile.dev/schema.json -version: '3' - -env: - OWNER: DevLabFoundry - NAME: configmanager - GO_TARGET_ARCH: "darwin" - GIT_TAG: "0.0.0" - VERSION: "v{{.GIT_TAG}}" - REVISION: '{{.REVISION | default "aaaa1234" }}' - -tasks: - test_prereq: - internal: true - preconditions: - - go version - cmd: | - mkdir -p .coverage - go install github.com/jstemmer/go-junit-report/v2@latest - go install github.com/axw/gocov/gocov@latest - go install github.com/AlekSi/gocov-xml@latest - - clean_go: - internal: true - cmds: - - rm -rf dist/* - - rm -rf .coverage - - mkdir -p dist - - test: - desc: Install dependencies - internal: false - deps: - - test_prereq - cmds: - - | - set -exo pipefail - go test ./... -v -buildvcs=false -mod=readonly -race -coverpkg=./... -coverprofile=.coverage/out | tee .coverage/unit - - install: - desc: Install dependencies - internal: true - cmd: | - go mod tidy - - lint: - desc: Runs lint and vet - cmd: | - go vet - - coverage: - desc: generate coverage - deps: - - test - cmds: - - go-junit-report -in .coverage/unit > .coverage/report-junit.xml - - gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml - - show_coverage: - desc: Opens the current coverage viewer for the the configmanager utility. - deps: - - coverage - cmd: go tool cover -html=.coverage/out - - show_docs: - desc: Opens a webview with godoc running - summary: | - Already filters the packages to this one and enables - internal/private package documentation -# go install golang.org/x/tools/cmd/godoc@latest - cmd: | - open http://localhost:6060/pkg/github.com/DevLabFoundry/configmanager/v2/?m=all - godoc -notes "BUG|TODO" -play -http=:6060 - - bin: - desc: Generates binaries in a dist folder - summary: | - Generates all the binaries for the configmanager utility. - - can be called from inside CI like this: - - `task bin GIT_TAG=0.1.2 REVISION=$commit_sha` - deps: - - clean_go - cmds: - - cmd: mkdir -p ./dist - - for: { var: GO_ARCHS, as: GO_TARGET_ARCH } - cmd: | - GOOS={{.GO_TARGET_ARCH}} CGO_ENABLED=0 go build -mod=readonly -buildvcs=false {{.LDFLAGS}} -o ./dist/configmanager-{{.GO_TARGET_ARCH}} ./cmd - - for: { var: GO_ARCHS, as: GO_TARGET_ARCH } - cmd: | - GOOS={{.GO_TARGET_ARCH}} GOARCH=arm64 CGO_ENABLED=0 go build -mod=readonly -buildvcs=false {{.LDFLAGS}} -o ./dist/configmanager-{{.GO_TARGET_ARCH}}-arm64 ./cmd - - for: { var: GO_ARCHS, as: GO_TARGET_ARCH } - cmd: | - GOOS={{.GO_TARGET_ARCH}} GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -buildvcs=false {{.LDFLAGS}} -o ./dist/configmanager-{{.GO_TARGET_ARCH}}-amd64 ./cmd - vars: - LDFLAGS: -ldflags="-s -w -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Version=${VERSION}\" -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Revision={{.REVISION}}\" -extldflags -static" - GO_ARCHS: darwin windows linux - - tag: - desc: | - Usage `task tag GIT_TAG=2111dsfsdfa REVISION=as2342432` - cmd: | - git tag -a ${VERSION} -m "ci tag release" ${REVISION} - git push origin ${VERSION} From b86973df09cecadc8bd19e00f7219a199ba8b2db Mon Sep 17 00:00:00 2001 From: dnitsch Date: Tue, 17 Jun 2025 09:29:06 +0100 Subject: [PATCH 2/5] fix: remove commetns --- eirctl.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/eirctl.yaml b/eirctl.yaml index 9c02908..3eabbaf 100644 --- a/eirctl.yaml +++ b/eirctl.yaml @@ -171,15 +171,3 @@ pipelines: - task: build:binary depends_on: clean -# version: '3' - -# env: -# OWNER: DevLabFoundry -# NAME: configmanager -# GO_TARGET_ARCH: "darwin" -# GIT_TAG: "0.0.0" -# VERSION: "v{{.GIT_TAG}}" -# REVISION: '{{.REVISION | default "aaaa1234" }}' - -# tasks: - From 05102e2c56f92200a1a355c38fbfed4f7d071c7f Mon Sep 17 00:00:00 2001 From: dnitsch Date: Tue, 17 Jun 2025 09:52:58 +0100 Subject: [PATCH 3/5] fix: remove deps --- .github/workflows/build.yml | 16 ++++++++-------- eirctl.yaml | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d86685..e0994c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,8 +40,8 @@ jobs: echo "VERSION -> $GITVERSION_SEMVER" test: runs-on: ubuntu-latest - container: - image: golang:1.24-bookworm + # container: + # image: golang:1.24-bookworm needs: set-version env: SEMVER: ${{ needs.set-version.outputs.semVer }} @@ -57,12 +57,12 @@ jobs: version: 0.6.5 isPrerelease: false - - name: install deps - run: | - apt update && apt install -y jq git unzip - git config --global --add safe.directory "$GITHUB_WORKSPACE" - git config user.email ${{ github.actor }}-ci@gha.org - git config user.name ${{ github.actor }} + # - name: install deps + # run: | + # apt update && apt install -y jq git unzip + # git config --global --add safe.directory "$GITHUB_WORKSPACE" + # git config user.email ${{ github.actor }}-ci@gha.org + # git config user.name ${{ github.actor }} - name: Run Lint run: | diff --git a/eirctl.yaml b/eirctl.yaml index 3eabbaf..667116d 100644 --- a/eirctl.yaml +++ b/eirctl.yaml @@ -18,6 +18,7 @@ contexts: golint: container: name: golangci/golangci-lint:v2.1.5-alpine + enable_dind: true enable_mount: true envfile: exclude: From 9607f3c61fef2276ee431c0b8fbf44e9abe4d1d6 Mon Sep 17 00:00:00 2001 From: dnitsch Date: Tue, 17 Jun 2025 10:05:37 +0100 Subject: [PATCH 4/5] fix: enable containers --- .github/workflows/build.yml | 11 ++--------- sonar-project.properties | 3 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0994c4..e5c887a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,8 +40,8 @@ jobs: echo "VERSION -> $GITVERSION_SEMVER" test: runs-on: ubuntu-latest - # container: - # image: golang:1.24-bookworm + container: + image: golang:1.24-bookworm needs: set-version env: SEMVER: ${{ needs.set-version.outputs.semVer }} @@ -57,13 +57,6 @@ jobs: version: 0.6.5 isPrerelease: false - # - name: install deps - # run: | - # apt update && apt install -y jq git unzip - # git config --global --add safe.directory "$GITHUB_WORKSPACE" - # git config user.email ${{ github.actor }}-ci@gha.org - # git config user.name ${{ github.actor }} - - name: Run Lint run: | eirctl run pipeline lint diff --git a/sonar-project.properties b/sonar-project.properties index 1536a52..4869d51 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -12,4 +12,5 @@ sonar.tests=. sonar.test.inclusions=**/*_test.go sonar.test.exclusions=**/*_generated*.go,**/*_generated/**,**/vendor/** -sonar.sourceEncoding=UTF-8 \ No newline at end of file +sonar.sourceEncoding=UTF-8 +sonar.qualitygate.wait=true From ae90cad043f7acb8721f2e76e7e89b3bc5718d99 Mon Sep 17 00:00:00 2001 From: dnitsch Date: Tue, 17 Jun 2025 10:11:32 +0100 Subject: [PATCH 5/5] fix: use eirctl exclusively --- .github/workflows/build.yml | 2 -- .github/workflows/release.yml | 11 +++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5c887a..cbe47fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,8 +40,6 @@ jobs: echo "VERSION -> $GITVERSION_SEMVER" test: runs-on: ubuntu-latest - container: - image: golang:1.24-bookworm needs: set-version env: SEMVER: ${{ needs.set-version.outputs.semVer }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a5d263..040ca81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,10 +40,6 @@ jobs: release: runs-on: ubuntu-latest - container: - image: golang:1.24-bookworm - env: - FOO: Bar needs: set-version env: SEMVER: ${{ needs.set-version.outputs.semVer }} @@ -58,18 +54,17 @@ jobs: version: 0.6.5 isPrerelease: false - - name: install deps + - name: release library run: | - apt-get update && apt-get install jq git -y git config --global --add safe.directory "$GITHUB_WORKSPACE" git config user.email ${{ github.actor }}-ci@gha.org git config user.name ${{ github.actor }} - - name: release library - run: | GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA eirctl run tag + - name: build binary run: | eirctl run pipeline build:bin --set VERSION=${SEMVER} --set REVISION=$GITHUB_SHA + - name: Release binary uses: softprops/action-gh-release@v2 with: