add debug for k8s pipeline #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: K8s Staging Pipeline | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+-staging | |
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+ | |
env: | |
AWS_REGION: ap-southeast-1 | |
PROD_AWS_ASSUME_ROLE_ARN: arn:aws:iam::995365977188:role/github-action-warroom-access | |
ECR_REPOSITORY_NAME: warroom/miniapp | |
DOCKER_FILE_PATH: ./Dockerfile | |
jobs: | |
build_job: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
packages: read | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set BUILD_ENV for docker build to select the correct config | |
shell: bash | |
run: echo "BUILD_ENV=staging" >> $GITHUB_ENV | |
- name: Extract branch name | |
id: extract_branch | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
- name: Extract the tag version | |
id: extract_tag_version | |
shell: bash | |
run: echo "tag_version=${GITHUB_REF#refs/tags/}-devtool" >> $GITHUB_OUTPUT | |
- name: Show current branch/github.ref | |
run: | | |
echo "Current branch: ${{ steps.extract_branch.outputs.branch }}" | |
echo "github.ref: ${{ github.ref }}" | |
echo "tag_version: ${{ steps.extract_tag_version.outputs.tag_version }}" | |
- name: Assume role using OIDC prod | |
uses: aws-actions/configure-aws-credentials@v4.0.2 | |
with: | |
role-to-assume: ${{ env.PROD_AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_REGION }} | |
audience: sts.amazonaws.com | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build, tag and push ${{ env.ECR_REPOSITORY_NAME }} image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY_NAME }} | |
IMAGE_TAG: ${{ steps.extract_tag_version.outputs.tag_version }} | |
run: | | |
echo "ECR_REGISTRY: $ECR_REGISTRY }}" | |
echo "ECR_REPOSITORY: $ECR_REPOSITORY }}" | |
echo "IMAGE_TAG: $IMAGE_TAG }}" | |
echo "FILE_PATH: ${{ env.DOCKER_FILE_PATH }}" | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ | |
--file ${{ env.DOCKER_FILE_PATH }} . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
- name: Logout of Amazon ECR | |
if: always() | |
run: docker logout ${{ steps.login-ecr.outputs.registry }} |