Skip to content

Commit

Permalink
test the cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostas Demiris committed Mar 28, 2024
1 parent 55202c2 commit c3754cf
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 396 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/build_the_image.yaml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/cicd_develop_build_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#name: Deploy V2 holoclis to staging[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 }}
# #
# CLUSTER_NAME: staging
# #
# AWS_KEY_ID: ${{ secrets.NEWSTAGE_USER_AWS_ACCESS_KEY_ID }}
# AWS_ACCESS_KEY: ${{ secrets.NEWSTAGE_USER_AWS_SECRET_ACCESS_KEY }}
#
#on:
# push:
# branches:
# - 'feat/separate-v1-v2-cli-cicd'
# # Excluded branches
# - '!testnet'
# - '!main'
# - '!mainnet'
# - '!master'
#
#jobs:
# build-the-image:
# name: build-the-image
# 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@v2

# 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
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
99 changes: 4 additions & 95 deletions .github/workflows/cicd_develop_main.yaml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy V2 indexer [develop-v2]
name: Deploy V2 holoclis to staging[develop-v2]

permissions:
id-token: write
Expand All @@ -15,25 +15,6 @@ env:
#
AWS_KEY_ID: ${{ secrets.NEWSTAGE_USER_AWS_ACCESS_KEY_ID }}
AWS_ACCESS_KEY: ${{ secrets.NEWSTAGE_USER_AWS_SECRET_ACCESS_KEY }}
#
# STG_HOLOGRAPH_INDEXER_HOST: 'http://devel-holo-api.develop.svc.cluster.local:443'
# STG_HOLOGRAPH_OPERATOR_HOST: 'http://devel-holo-api.develop.svc.cluster.local:443'
#
# set the RPC endpoints config files
INDEXER_HOLOGRAPH_CONFIG_FILE_DATA: dev-config-file
#
HOLOGRAPH_ENVIRONMENT: develop
BLOCK_PROCESSING_VERSION: 'V2'
#
STG_DOMAIN: 'holograph.xyz' # needed only for the health checks
#
# SQS User [indexer_processor_sqs_user]
#
STG_COMMON_NAMESPACE_V2: 'develop-v2'
#######################################
STG_HOLOGRAPH_INDEXER_HELM_CHART_VERSION: 0.1.81
INDEXER_RELEASE_NAME_V2: 'indexer-dev-v2' # format -> [release_name]-indexer-[env]
#######################################

on:
push:
Expand All @@ -46,78 +27,6 @@ on:
- '!master'

jobs:
deploy-indexer-in-develop:
name: deploy-indexer-[develop]
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: Get secrets from AWS Secrets Manager
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
aws-region: ${{ env.AWS_REGION }}
secret-ids: |
DEV_INDEXER_V2
COMMON
parse-json-secrets: true # to be able to get the json k/v pairs

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

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

# Include steps from separate files
- <<: *build_the_image

# - name: Checkout the code
# uses: actions/checkout@v2
#
# # 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
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- name: Configure AWS creds to access EKS
# TIP: the deployment user must be in the masters group in the aws-auth config map in the cluster
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_KEY_ID }} #notice: unique for each env
aws-secret-access-key: ${{ env.AWS_ACCESS_KEY }} #notice: unique for each env
aws-region: ${{ env.AWS_REGION }}
build-the-image:
- name: cicd_develop_build_image
uses: ./.github/cicd_develop_build_image
Loading

0 comments on commit c3754cf

Please sign in to comment.