Skip to content

Commit

Permalink
Merge pull request #7 from tokamak-network/OR-1691-thanos-event-liste…
Browse files Browse the repository at this point in the history
…ner-deploy-github-action-CI

Or 1691 thanos event listener deploy GitHub action ci
  • Loading branch information
xxeonge authored Jul 3, 2024
2 parents 362a4a5 + 1bed60f commit 58cda81
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
91 changes: 91 additions & 0 deletions .github/workflows/release-docker-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish thanos-event-listener (nightly)

on:
push:
branches:
- main

jobs:
version:
name: Publish Packages (nightly)
runs-on: ubuntu-latest
# map the step outputs to job outputs
outputs:
nightly-docker-tag: ${{ steps.docker-image-name.outputs.nightly-docker-tag }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
repository: tokamak-network/tokamak-thanos-event-listener
fetch-depth: 0

- name: Docker Image Name
id: docker-image-name
run: |
echo "nightly-docker-tag=nightly-${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
thanos-event-listener:
name: Publish thanos-event-listener
needs: [version]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}

- name: Build and Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./Dockerfile
push: true
tags: tokamaknetwork/thanos-event-listener:${{ needs.version.outputs.nightly-docker-tag }}

update-kustomize:
name: Update image version in kustomize manifest file (nightly)
needs: [version, thanos-event-listener]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: tokamak-network/tokamak-infra
ref: main
token: ${{ secrets.ACCESS_TOKEN }}
path: tokamak-infra

- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
with:
github-token: ${{ secrets.ACCESS_TOKEN }}

- name: Update notif_thanos Kubernetes resources
run: |
cd tokamak-infra/apps/notif_thanos/kustomize/overlays/aws/sepolia-nightly
kustomize edit set image tokamaknetwork/thanos-event-listener:${{ needs.version.outputs.nightly-docker-tag}}
- name: Show updated Kubernetes resources
run: |
cd tokamak-infra/apps/notif_thanos/kustomize/overlays/aws/sepolia-nightly
cat kustomization.yaml
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
github_token: ${{ secrets.ACCESS_TOKEN }}
message: '[AUTO] Update thanos-event-listener images tag for sepolia-nightly'
cwd: 'tokamak-infra/'
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ FROM --platform=${TARGETOS}/${TARGETARCH} busybox:latest
COPY --from=thanos-build /thanos-events/thanos-app-notif /bin/thanos-app-notif
COPY --from=certs /etc/ssl/certs /etc/ssl/certs

ENTRYPOINT [ "thanos-app-notif" ]
ENTRYPOINT [ "thanos-app-notif" ]

CMD ["listener"]

0 comments on commit 58cda81

Please sign in to comment.