generated from guardrails-ai/validator-template
-
Notifications
You must be signed in to change notification settings - Fork 4
81 lines (71 loc) · 2.28 KB
/
ecr_sagemaker_publish.yml
File metadata and controls
81 lines (71 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Sagemaker ECR Publish (RC)
on:
push:
branches:
- main
workflow_dispatch:
inputs:
is_release_candidate:
description: 'Is this a release candidate?'
required: true
default: 'true'
# Needed for OIDC / assume role
permissions:
id-token: write
contents: read
jobs:
publish_image:
name: Publish Sagemaker Image (Release Candidate)
runs-on: ubuntu-latest
env:
VALIDATOR_TAG_NAME: competitorcheck
AWS_REGION: us-east-1
WORKING_DIR: "./"
AWS_CI_ROLE__PROD: ${{ secrets.AWS_CI_ROLE__PROD }}
AWS_ECR_RELEASE_CANDIDATE: ${{ inputs.is_release_candidate || 'true' }}
steps:
- name: Check out head
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set ECR Tag
id: set-ecr-tag
run: |
if [ ${{ env.AWS_ECR_RELEASE_CANDIDATE }} == 'true' ]; then
echo "This is a release candidate."
echo "Setting tag to -rc"
ECR_TAG=$VALIDATOR_TAG_NAME-rc
else
echo "This is a production image."
ECR_TAG=$VALIDATOR_TAG_NAME
fi
echo "Setting ECR tag to $ECR_TAG"
echo "ECR_TAG=$ECR_TAG" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: linux/amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
with:
platforms: linux/amd64
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.AWS_CI_ROLE__PROD}}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
- name: Build & Push ECR Image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ${{ env.WORKING_DIR }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: 064852979926.dkr.ecr.us-east-1.amazonaws.com/gr-sagemaker-validator-images-prod:${{ steps.set-ecr-tag.outputs.ECR_TAG }}