-
Notifications
You must be signed in to change notification settings - Fork 2
Creating gf gold disk workflow #1479
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
Open
oluwolenpbc
wants to merge
13
commits into
main
Choose a base branch
from
PLT-1045-gd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d6ddbdf
Creating gf gold disk workflow
dce63ca
update wf
d75db16
update wf
fb5c4ca
update wf
ad8647c
update wf
820f8f3
fix assume role
eea424f
fix parent_env
a29f5d6
update input
f8d3e38
update wf
d1ad5c9
remove long inputs
927e63b
add oidc perms
76f0530
update gold disk file name
0695e77
update wf
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Update Gold Disk | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
required: false | ||
type: string | ||
description: "Branch to run this workflow on (defaults to main)" | ||
environment: | ||
required: false | ||
type: choice | ||
options: | ||
- test | ||
- prod | ||
description: "Deployment environment (defaults to dev on pull request)" | ||
|
||
jobs: | ||
update-gold-disk: | ||
runs-on: codebuild-ab2d-${{github.run_id}}-${{github.run_attempt}} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Get AWS params | ||
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main | ||
env: | ||
AWS_REGION: ${{ vars.AWS_REGION }} | ||
with: | ||
params: | | ||
OPS_GITHUB_TOKEN=/ci/github/token | ||
|
||
- name: Determine Branch and Environment | ||
run: | | ||
echo "ENVIRONMENT=${{ github.event.inputs.environment || 'test' }}" >> $GITHUB_ENV | ||
echo "BRANCH=${{ github.event.inputs.branch || 'main' }}" >> $GITHUB_ENV | ||
|
||
|
||
- name: Checkout AB2D-Ops Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'cmsgov/ab2d-ops' | ||
token: ${{ env.OPS_GITHUB_TOKEN }} | ||
ref: ${{ env.BRANCH }} | ||
|
||
- name: Fetch all branches | ||
run: git fetch --all | ||
|
||
- name: Set PARENT_ENV | ||
run: | | ||
aws sts get-caller-identity | ||
case "${{ env.ENVIRONMENT }}" in | ||
test) echo "PARENT_ENV=ab2d-east-test" >> $GITHUB_ENV ;; | ||
prod) echo "PARENT_ENV=ab2d-east-prod" >> $GITHUB_ENV ;; | ||
*) echo "Invalid environment: $ENVIRONMENT" && exit 1 ;; | ||
esac | ||
|
||
- name: Assume role in AB2D account for this environment | ||
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 | ||
env: | ||
ACCOUNT: ${{ inputs.environment == 'test' && 'non_prod' || inputs.environment }} | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: arn:aws:iam::${{ secrets[format('{0}_ACCOUNT', env.ACCOUNT)] }}:role/delegatedadmin/developer/ab2d-${{ inputs.environment }}-github-actions | ||
|
||
- name: Set AWS_ACCOUNT_NUMBER from current credentials | ||
run: | | ||
ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) | ||
echo "AWS_ACCOUNT_NUMBER=$ACCOUNT_ID" >> $GITHUB_ENV | ||
|
||
- name: Setup `packer` | ||
uses: hashicorp/setup-packer@main | ||
id: setup | ||
with: | ||
version: 1.10.0 | ||
|
||
- name: Symlink packer to /usr/bin if not already linked | ||
run: | | ||
if [ ! -f /usr/bin/packer ]; then | ||
sudo ln -s "$(which packer)" /usr/bin/packer | ||
else | ||
echo "✅ /usr/bin/packer already exists, skipping symlink." | ||
fi | ||
|
||
|
||
- name: Run Update Gold Disk Script | ||
run: | | ||
chmod +x scripts/deployment/update-gold-disk.sh | ||
scripts/deployment/update-gold-disk-gf.sh --cms_env $PARENT_ENV --cloud_tamer false | ||
env: | ||
AWS_ACCOUNT_NUMBER: ${{ env.AWS_ACCOUNT_NUMBER }} | ||
CLOUD_TAMER: false | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be using either NON_PROD_ACCOUNT or PROD_ACOUNT?