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

Set the CLIs dev cicd to only do the CD #691

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
134 changes: 134 additions & 0 deletions .github/workflows/ci_clis_develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build V2 clis [develop-v2]

permissions:
id-token: write
contents: read # This is required for actions/checkout@v2

env:
AWS_REGION: us-west-2
IAM_ROLE: arn:aws:iam::177635894328:role/Github_role_to_access_ECR
ECR_REPOSITORY: holo-cli-dev # notice: the same for all cli apps
#
IMAGE_TAG: dev-${{ github.sha }}

on:
push:
branches:
- 'develop'
# Excluded branches
- '!testnet'
- '!main'
- '!mainnet'
- '!master'

jobs:
build-image:
name: build-image[dev]
runs-on: ubuntu-latest
steps:
- name: Use Githubs federated identity with AWS
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.IAM_ROLE }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Checkout the code
uses: actions/checkout@v4

# This is a separate action that sets up buildx runner
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

# So now you can use Actions' own caching!
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx

# And make it available for builds
- name: Build image
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
build-args: AWS_ECR_URL=${{ steps.login-ecr.outputs.registry }}
platforms: linux/amd64
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
push: true # set false to deactivate the push to ECR

# This ugly bit is necessary if you don't want your cache to grow forever until it hits GitHub's limit of 5GB.
# https://github.com/docker/build-push-action/issues/252 & https://github.com/moby/buildkit/issues/1896
- name: Move cache
shell: bash
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

update-indexer-helm-file:
name: update-indexer-helm-file[dev]
runs-on: ubuntu-latest
needs: build-image
env:
helm_repo_branch: 'datadog' # TODO - turn it to main branch
steps:
- name: Checkout the helm charts repo
uses: actions/checkout@v3
with:
token: '${{ secrets.HOLOGRAPH_GITHUB_PERSONAL_ACCESS_TOKEN }}'
repository: 'holographxyz/helm-charts'
ref: ${{env.helm_repo_branch}}

- name: Update the Indexer helm file
env:
helm_file: 'holo-indexer/values-v2-develop-iv.yaml'
run: |
git status
git config user.email "[email protected]"
git config user.name "wehappyfew"

sed -i "s+image_tag: .*+image_tag: ${{env.IMAGE_TAG}}+" $helm_file
cat $helm_file

git add $helm_file
git commit -m 'New tag by GH Actions: ${{ env.IMAGE_TAG }}'
git push origin ${{env.helm_repo_branch}}

update-operator-helm-file:
name: update-operator-helm-file[dev]
runs-on: ubuntu-latest
needs: build-image
env:
helm_repo_branch: 'datadog' # TODO - turn it to main branch
steps:
- name: Checkout the helm charts repo
uses: actions/checkout@v3
with:
token: '${{ secrets.HOLOGRAPH_GITHUB_PERSONAL_ACCESS_TOKEN }}'
repository: 'holographxyz/helm-charts'
ref: ${{env.helm_repo_branch}}

- name: Update the Operator helm file
env:
helm_file: 'holo-operator/values-v2-develop-iv.yaml'
run: |
git status
git config user.email "[email protected]"
git config user.name "wehappyfew"

sed -i "s+image_tag: .*+image_tag: ${{env.IMAGE_TAG}}+" $helm_file
cat $helm_file

git add $helm_file
git commit -m 'New tag by GH Actions: ${{ env.IMAGE_TAG }}'
git push origin ${{env.helm_repo_branch}}
3 changes: 2 additions & 1 deletion .github/workflows/cicd_clis_develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ env:
on:
push:
branches:
- 'develop'
- 'deactivated'
#- 'develop'
# Excluded branches
- '!testnet'
- '!main'
Expand Down
Loading