From 1beda3c85eb6f5f5c547c084ecd12a365580967a Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Wed, 15 May 2024 20:41:41 +0530 Subject: [PATCH] chore(ci): move to gha Move to using GHA. Signed-off-by: Noel Georgi --- .drone.yml | 94 ----------------------------- .github/workflows/ci.yaml | 69 +++++++++++++++++++++ .github/workflows/slack-notify.yaml | 92 ++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 94 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/slack-notify.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 3c63272..0000000 --- a/.drone.yml +++ /dev/null @@ -1,94 +0,0 @@ ---- -kind: pipeline -type: kubernetes -name: default - -steps: - - name: setup-ci - image: autonomy/build-container:latest - commands: - - git fetch --tags - - setup-ci - environment: - DOCKER_CLI_EXPERIMENTAL: enabled - privileged: true - volumes: - - name: outer-docker-socket - path: /var/outer-run - - name: docker - path: /root/.docker/buildx - - - name: build-container - image: autonomy/build-container:latest - pull: always - environment: - DOCKER_CLI_EXPERIMENTAL: enabled - commands: - - make - when: - event: - include: - - pull_request - volumes: - - name: outer-docker-socket - path: /var/outer-run - - name: docker - path: /root/.docker/buildx - - - name: build-and-publish-container - image: autonomy/build-container:latest - pull: always - environment: - GHCR_USERNAME: - from_secret: ghcr_username - GHCR_PASSWORD: - from_secret: ghcr_token - commands: - - docker login ghcr.io --username "$${GHCR_USERNAME}" --password "$${GHCR_PASSWORD}" - - make PUSH=true - when: - event: - include: - - tag - volumes: - - name: outer-docker-socket - path: /var/outer-run - - name: docker - path: /root/.docker/buildx - -volumes: - - name: outer-docker-socket - host: - path: /var/ci-docker - - name: outer-docker-socket - path: /var/outer-run - - name: docker - temp: {} - ---- -kind: pipeline -type: kubernetes -name: notify - -clone: - disable: true - -steps: - - name: slack - image: plugins/slack - settings: - webhook: - from_secret: slack_webhook - channel: proj-talos-maintainers - when: - status: - - success - - failure - -trigger: - status: - - success - - failure - -depends_on: - - default diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..59158fa --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,69 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-05-09T12:19:43Z by kres 1e986af. + +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.2 + 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: + append: | + - endpoint: tcp://buildkit-arm64.ci.svc.cluster.local:1234 + platforms: linux/arm64 + driver: remote + endpoint: tcp://127.0.0.1:1234 + - name: Build + run: | + make + - name: Login to registry + if: startsWith(github.ref, 'refs/tags/') + uses: docker/login-action@v3 + with: + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.repository_owner }} + - name: Push to registry + if: startsWith(github.ref, 'refs/tags/') + run: | + make PUSH=true diff --git a/.github/workflows/slack-notify.yaml b/.github/workflows/slack-notify.yaml new file mode 100644 index 0000000..aad1bed --- /dev/null +++ b/.github/workflows/slack-notify.yaml @@ -0,0 +1,92 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2023-11-20T10:44:06Z by kres latest. + +name: slack-notify +"on": + workflow_run: + workflows: + - default + 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 }}