Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ampd deployment k8s #16

Draft
wants to merge 10 commits into
base: solana
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ampd-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Ampd deployment
on:
push:
branches:
- "ampd-deployment-k8s"
paths:
- "ampd/**"

env:
# If one change any variable of this env block, all of them needs to be aligned, as
# we cannot re-user them.
IMAGE_NAME: ampd
IMAGE_VERSION: ${{ github.sha }}
IMAGE_ID: solanaaxelartestnetregistry.azurecr.io/solana-axelar/ampd
DEPLOYING_IMAGE_FQDN: solanaaxelartestnetregistry.azurecr.io/solana-axelar/ampd:${{ github.sha }}

jobs:
docker-image:
runs-on: ubuntu-latest
name: "Build and push docker image"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
cache-on-failure: true
workspaces: "ampd -> target"
shared-key: "ampd"

- name: Build image
run: docker build . --file ampd/Dockerfile --tag $IMAGE_NAME --tag latest

- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY_NAME }}.azurecr.io
username: ${{ secrets.AZ_SP_CLIENT_ID }}
password: ${{ secrets.AZ_SP_CLIENT_SECRET }}

- name: Push image
run: |
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_VERSION
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $DEPLOYING_IMAGE_FQDN

deployment:
needs: docker-image
runs-on: ubuntu-latest
name: "Deploy to k8s cluster"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: azure/[email protected]

- uses: Azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
context: solanaaxelartestnetk8s

- name: Deploy image in k8s
run: kubectl set image deployment/ampd ampd=${{ env.DEPLOYING_IMAGE_FQDN }}
Loading