From f19a8ec20b4f2ddb71f72bd4529a618b6ae1f82a Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Tue, 23 Apr 2024 23:31:44 +0530 Subject: [PATCH] chore(ci): kresify gh actions Kresify, only handle gh workflows. Signed-off-by: Noel Georgi --- .github/workflows/ci.yaml | 189 ++++++++++++++++++++++++++++ .github/workflows/slack-notify.yaml | 95 ++++++++++++++ .kres.yaml | 88 +++++++++++++ Makefile | 5 + 4 files changed, 377 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/slack-notify.yaml create mode 100644 .kres.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000000..8239b39f67b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,189 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-04-26T15:56:46Z by kres ebc009d-dirty. + +name: default +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true +"on": + push: + branches: + - main + - release-* + tags: + - v* + pull_request: + branches: + - main + - release-* +jobs: + default: + permissions: + actions: read + contents: write + issues: read + packages: write + pull-requests: read + runs-on: + - self-hosted + - generic + if: (!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/')) + services: + buildkitd: + image: moby/buildkit:v0.13.1 + options: --privileged + ports: + - 1234:1234 + volumes: + - /var/lib/buildkit/${{ github.repository }}:/var/lib/buildkit + - /usr/etc/buildkit/buildkitd.toml:/etc/buildkit/buildkitd.toml + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Unshallow + run: | + git fetch --prune --unshallow + - name: Set up Docker Buildx + id: setup-buildx + uses: docker/setup-buildx-action@v3 + with: + driver: remote + endpoint: tcp://127.0.0.1:1234 + timeout-minutes: 10 + - name: external-artifacts + run: | + make external-artifacts + - name: generate + run: | + make generate docs + - name: uki-certs + run: | + make uki-certs PLATFORM=linux/amd64 + - name: check-dirty + run: | + make check-dirty + - name: build + run: | + make talosctl-all kernel sd-boot sd-stub initramfs installer imager talos _out/integration-test-linux-amd64 PLATFORM=linux/amd64,linux/arm64 IMAGE_REGISTRY=registry.dev.talos-systems.io PUSH=true + - name: lint + run: | + make lint + - name: talosctl-cni-bundle + run: | + make talosctl-cni-bundle + - name: iso + run: | + make iso secureboot-iso IMAGE_REGISTRY=registry.dev.talos-systems.io + - name: images-essential + run: | + make images-essential + - name: unit-tests + run: | + make unit-tests + - name: unit-tests-race + run: | + make unit-tests-race + - name: coverage + run: | + make coverage + - name: Generate executable list + run: | + find _out -type f -executable > _out/executable-artifacts + - name: save-artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: | + _out + retention-days: "5" + e2e-docker-short: + permissions: + actions: read + contents: write + issues: read + packages: write + pull-requests: read + runs-on: + - self-hosted + - generic + if: (!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/')) + needs: + - default + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Unshallow + run: | + git fetch --prune --unshallow + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: _out + - name: Fix artifact permissions + run: | + xargs -a _out/executable-artifacts -I {} chmod +x {} + - name: e2e-docker + run: | + make e2e-docker IMAGE_REGISTRY=registry.dev.talos-systems.io SHORT_INTEGRATION_TEST=yes + e2e-iso: + permissions: + actions: read + contents: write + issues: read + packages: write + pull-requests: read + runs-on: + - self-hosted + - generic + if: (!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/')) + needs: + - default + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Unshallow + run: | + git fetch --prune --unshallow + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: _out + - name: Fix artifact permissions + run: | + xargs -a _out/executable-artifacts -I {} chmod +x {} + - name: e2e-iso + run: | + sudo -E make e2e-iso IMAGE_REGISTRY=registry.dev.talos-systems.io + e2e-qemu-short: + permissions: + actions: read + contents: write + issues: read + packages: write + pull-requests: read + runs-on: + - self-hosted + - generic + if: (!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/')) + needs: + - default + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Unshallow + run: | + git fetch --prune --unshallow + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: _out + - name: Fix artifact permissions + run: | + xargs -a _out/executable-artifacts -I {} chmod +x {} + - name: e2e-qemu + run: | + sudo -E make e2e-qemu IMAGE_REGISTRY=registry.dev.talos-systems.io SHORT_INTEGRATION_TEST=yes diff --git a/.github/workflows/slack-notify.yaml b/.github/workflows/slack-notify.yaml new file mode 100644 index 00000000000..6b86e3c949f --- /dev/null +++ b/.github/workflows/slack-notify.yaml @@ -0,0 +1,95 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-04-26T15:24:12Z by kres ebc009d-dirty. + +name: slack-notify +"on": + workflow_run: + workflows: + - default + - e2e-iso + - e2e-qemu-short + - e2e-docker-short + types: + - completed +jobs: + slack-notify: + runs-on: + - self-hosted + - generic + if: github.event.workflow_run.conclusion != 'skipped' + steps: + - name: Get PR number + id: get-pr-number + if: github.event.workflow_run.event == 'pull_request' + env: + GH_TOKEN: ${{ github.token }} + run: | + echo pull_request_number=$(gh pr view -R ${{ github.repository }} ${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }} --json number --jq .number) >> $GITHUB_OUTPUT + - name: Slack Notify + uses: slackapi/slack-github-action@v1 + with: + channel-id: proj-talos-maintainers + payload: | + { + "attachments": [ + { + "color": "${{ github.event.workflow_run.conclusion == 'success' && '#2EB886' || github.event.workflow_run.conclusion == 'failure' && '#A30002' || '#FFCC00' }}", + "fallback": "test", + "blocks": [ + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "${{ github.event.workflow_run.event == 'pull_request' && format('*Pull Request:* {0} (`{1}`)\n<{2}/pull/{3}|{4}>', github.repository, github.ref_name, github.event.repository.html_url, steps.get-pr-number.outputs.pull_request_number, github.event.workflow_run.display_title) || format('*Build:* {0} (`{1}`)\n<{2}/commit/{3}|{4}>', github.repository, github.ref_name, github.event.repository.html_url, github.sha, github.event.workflow_run.display_title) }}" + }, + { + "type": "mrkdwn", + "text": "*Status:*\n`${{ github.event.workflow_run.conclusion }}`" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Author:*\n`${{ github.actor }}`" + }, + { + "type": "mrkdwn", + "text": "*Event:*\n`${{ github.event.workflow_run.event }}`" + } + ] + }, + { + "type": "divider" + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Logs" + }, + "url": "${{ github.event.workflow_run.html_url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Commit" + }, + "url": "${{ github.event.repository.html_url }}/commit/${{ github.sha }}" + } + ] + } + ] + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.kres.yaml b/.kres.yaml new file mode 100644 index 00000000000..17bb20af19e --- /dev/null +++ b/.kres.yaml @@ -0,0 +1,88 @@ +--- +kind: auto.CI +spec: + compileGHWorkflowsOnly: true +--- +kind: common.GHWorkflow +spec: + jobs: + - name: default + setupBuildx: true + runners: + - self-hosted + - generic + steps: + - name: external-artifacts + - name: generate + command: generate docs + - name: uki-certs + arguments: + - PLATFORM=linux/amd64 + - name: check-dirty + - name: build + command: talosctl-all kernel sd-boot sd-stub initramfs installer imager talos _out/integration-test-linux-amd64 + arguments: + - PLATFORM=linux/amd64,linux/arm64 + - IMAGE_REGISTRY=registry.dev.talos-systems.io + - PUSH=true + - name: lint + - name: talosctl-cni-bundle + - name: iso + command: iso secureboot-iso + arguments: + - IMAGE_REGISTRY=registry.dev.talos-systems.io + - name: images-essential + - name: unit-tests + - name: unit-tests-race + - name: coverage + - name: save-artifacts + artifactStep: + type: upload + artifactPath: _out + - name: e2e-iso + depends: + - default + runners: + - self-hosted + - generic + steps: + - name: download-artifacts + artifactStep: + type: download + artifactPath: _out + - name: e2e-iso + withSudo: true + arguments: + - IMAGE_REGISTRY=registry.dev.talos-systems.io + - name: e2e-qemu-short + depends: + - default + runners: + - self-hosted + - generic + steps: + - name: download-artifacts + artifactStep: + type: download + artifactPath: _out + - name: e2e-qemu + withSudo: true + arguments: + - IMAGE_REGISTRY=registry.dev.talos-systems.io + - SHORT_INTEGRATION_TEST=yes + - name: e2e-docker-short + depends: + - default + runners: + - self-hosted + - generic + steps: + - name: download-artifacts + artifactStep: + type: download + artifactPath: _out + - name: e2e-docker + withSudo: false + arguments: + - IMAGE_REGISTRY=registry.dev.talos-systems.io + - SHORT_INTEGRATION_TEST=yes diff --git a/Makefile b/Makefile index 1bbe2988124..9eb71e85356 100644 --- a/Makefile +++ b/Makefile @@ -448,6 +448,11 @@ unit-tests: ## Performs unit tests. unit-tests-race: ## Performs unit tests with race detection enabled. @$(MAKE) target-$@ TARGET_ARGS="--allow security.insecure" PLATFORM=linux/amd64 + +.PHONY: coverage +coverage: ## Upload coverage data to codecov.io. + bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/coverage.txt -X fix" + $(ARTIFACTS)/$(INTEGRATION_TEST_DEFAULT_TARGET)-amd64: @$(MAKE) local-$(INTEGRATION_TEST_DEFAULT_TARGET) DEST=$(ARTIFACTS) PLATFORM=linux/amd64 WITH_RACE=true NAME=Client PUSH=false