Skip to content

Commit

Permalink
testing actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaucier-sf committed Jan 18, 2024
1 parent 8c97920 commit e86427c
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker-push-superset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Docker Push - Superset

on: # yamllint disable-line rule:truthy
push:
branches:
- feat-text-to-sql

# workflow_run:
# workflows: ["Tag"]
# types:
# - completed

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_push_superset_poc:
name: Build & Push Superset Image - POC
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
# if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set output
id: vars
run: echo "git_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT

# configure iam
- name: Configure IAM Role
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.POC_SUPERSET_DEPLOY_ARN }}
aws-region: us-east-1
continue-on-error: false

- name: Build, Tag, and Push
run: |
export IMAGE_TAG=${{ steps.vars.outputs.git_tag }}
export ENVIRONMENT=poc
./scrips/docker-build-tag-and-push.sh
34 changes: 34 additions & 0 deletions scripts/docker-build-tag-and-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

# optional
: "${AWS_REGION:=us-east-1}"
: "${ENVIRONMENT:=poc}"

## required
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
: "${IMAGE_TAG:-$IMAGE_TAG}"

ECR_REGISTRY_ENDPOINT="$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com"
IMAGE_NAME="$ECR_REGISTRY_ENDPOINT/superset-base"

echo "Account: $AWS_ACCOUNT_ID"

printf "\nECR Login...\n"
aws ecr get-login-password \
--region $AWS_REGION \
| docker login \
--username AWS \
--password-stdin $ECR_REGISTRY_ENDPOINT

printf "\nBuilding docker images...\n"
docker build -t sourcefuse/superset-base:latest .

printf "\nTagging image $IMAGE_NAME:$IMAGE_TAG...\n"
docker tag sourcefuse/superset-base:latest $IMAGE_NAME:$IMAGE_TAG

printf "\nPushing $IMAGE_NAME:$IMAGE_TAG to ECR...\n"
docker push $IMAGE_NAME:$IMAGE_TAG

echo "::set-output name=image::$IMAGE_NAME:$IMAGE_TAG"

0 comments on commit e86427c

Please sign in to comment.