From 7e2ae8fc43709eb09220ea9085f9ff7a6f4fe40e Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Thu, 15 Jun 2023 10:51:38 -0500 Subject: [PATCH] cicd: fix nightly-ci error This fixes the nightly-ci workflow and adds a means to lint and validate the workflow files. Signed-off-by: Hank Donnay --- .github/workflows/.gitignore | 3 +++ .github/workflows/.yamllint.yml | 6 ++++++ .github/workflows/Makefile | 19 +++++++++++++++++++ .github/workflows/config-ci.yml | 2 +- .../{nightly-ci.yaml => nightly-ci.yml} | 3 +-- .github/workflows/prepare-release.yml | 2 +- .github/workflows/v2-issues.yml | 1 + 7 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/.gitignore create mode 100644 .github/workflows/.yamllint.yml create mode 100644 .github/workflows/Makefile rename .github/workflows/{nightly-ci.yaml => nightly-ci.yml} (99%) diff --git a/.github/workflows/.gitignore b/.github/workflows/.gitignore new file mode 100644 index 0000000000..c57303e32e --- /dev/null +++ b/.github/workflows/.gitignore @@ -0,0 +1,3 @@ +yq +yajsv +*.json-schema diff --git a/.github/workflows/.yamllint.yml b/.github/workflows/.yamllint.yml new file mode 100644 index 0000000000..383dd73407 --- /dev/null +++ b/.github/workflows/.yamllint.yml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: false + truthy: + check-keys: false diff --git a/.github/workflows/Makefile b/.github/workflows/Makefile new file mode 100644 index 0000000000..f8148bef23 --- /dev/null +++ b/.github/workflows/Makefile @@ -0,0 +1,19 @@ +check: github-workflow.json-schema yajsv yq + for f in *.yml; do ./yq -o json "$$f" > "$${f%yml}json"; done + ./yajsv -s $< *.json + rm *.json + command -v yamllint >/dev/null 2>&1 && yamllint . + +clean: + rm -rf yq yajsv github-workflow.json-schema + +.PHONY: check clean + +yq: + cd /tmp && GOBIN=$(PWD) go install github.com/mikefarah/yq/v4@latest + +yajsv: + cd /tmp && GOBIN=$(PWD) go install github.com/neilpa/yajsv@latest + +github-workflow.json-schema: + curl -sSLf https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/github-workflow.json > $@ diff --git a/.github/workflows/config-ci.yml b/.github/workflows/config-ci.yml index 530edc5be6..db707e88af 100644 --- a/.github/workflows/config-ci.yml +++ b/.github/workflows/config-ci.yml @@ -25,7 +25,7 @@ jobs: run: | echo 'go_versions=["1.20", "1.19"]' >> "$GITHUB_OUTPUT" - commit-check: + commit-check: name: Commit Check runs-on: ubuntu-latest steps: diff --git a/.github/workflows/nightly-ci.yaml b/.github/workflows/nightly-ci.yml similarity index 99% rename from .github/workflows/nightly-ci.yaml rename to .github/workflows/nightly-ci.yml index 121fa7aea1..1ee215f9ca 100644 --- a/.github/workflows/nightly-ci.yaml +++ b/.github/workflows/nightly-ci.yml @@ -21,7 +21,6 @@ jobs: name: Integration Tests needs: ['config'] runs-on: ubuntu-latest - env: services: # These will be used by a container on the same docker network, so no need to expose ports. postgres: @@ -62,7 +61,7 @@ jobs: with: platforms: linux/${{ matrix.platform }} - name: Make directories on cache miss - run: mkdir -p "$(go env GOMODCACHE)" "$(go env GOCACHE)" + run: mkdir -p "$(go env GOMODCACHE)" "$(go env GOCACHE)" if: ${{ ! steps.cache.outputs.cache-hit }} - name: Configure RabbitMQ run: | diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 4d5c27c36b..dd34f63e17 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -39,7 +39,7 @@ jobs: filter_tag="--tag-filter-pattern v4" branch=${{ github.event.inputs.branch }} echo "discovered branch $branch" - if [[ ${branch%-*} == "release" ]]; then + if [[ ${branch%-*} == "release" ]]; then filter_tag="--tag-filter-pattern v${branch#release-}" fi diff --git a/.github/workflows/v2-issues.yml b/.github/workflows/v2-issues.yml index bc6100fa91..e3f49b3e09 100644 --- a/.github/workflows/v2-issues.yml +++ b/.github/workflows/v2-issues.yml @@ -1,3 +1,4 @@ +--- name: 'Manage v2 Issues' on: workflow_dispatch: