-
Notifications
You must be signed in to change notification settings - Fork 1
Greenfield-related workflows #121
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
bennavapbc
wants to merge
85
commits into
main
Choose a base branch
from
more-workflows-gf
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
85 commits
Select commit
Hold shift + click to select a range
a04e6e3
WIP workflows
bennavapbc c3c379e
WIP workflows
bennavapbc f570a34
Update test-gf
bennavapbc 1144b1c
test
bennavapbc c103f75
Remove
bennavapbc 1045567
Test
bennavapbc 00e90f4
Fix typo
bennavapbc 0058e64
Update ECR repo
bennavapbc bab868c
Include SHA in tag
bennavapbc 4773393
Update promote-gf
bennavapbc c9c15fb
Temp
bennavapbc 5eb1ea0
Revert
bennavapbc 9824ce8
Fix role
bennavapbc 43334d1
Test
bennavapbc ad647d7
Test
bennavapbc 27ad528
Testing
bennavapbc 4f300d2
Test
bennavapbc c311485
Test
bennavapbc 072252e
Test
bennavapbc 06ce1fe
Test
bennavapbc ba4749a
Test
bennavapbc ca8b783
Test
bennavapbc 8542d49
Test
bennavapbc 46b6c7b
Test
bennavapbc 91330f5
Fix
bennavapbc f0574e2
Test
bennavapbc 8d52ed9
Revert
bennavapbc 69e204c
WIP
bennavapbc caac0d8
Fix
bennavapbc 7f237b4
Test
bennavapbc 0f19ea0
test
bennavapbc 6613606
Remove on push
bennavapbc 77a5910
Test
bennavapbc cdbbab8
test
bennavapbc 93631d8
Fix permissions
bennavapbc a47e462
Add 'needs'
bennavapbc 4db8d6f
Test
bennavapbc c45e7c9
test
bennavapbc c0ba725
Test
bennavapbc 1ae2bcf
Test
bennavapbc 10a4820
Test
bennavapbc 5359c21
Tet
bennavapbc 4754891
Test
bennavapbc 850c579
test
bennavapbc a684411
test
bennavapbc 3ff3e45
test
bennavapbc ebe39bb
Test
bennavapbc d9afb3f
Test
bennavapbc d2359d2
Remove >dev/null
bennavapbc cc98e82
Add
bennavapbc 2c68849
Test
bennavapbc f36ae51
Fix prefix
bennavapbc 0fcb247
Test
bennavapbc d613433
Fix
bennavapbc 79d6cbf
Fix
bennavapbc aabdd76
Revert
bennavapbc e099ed8
Rename
bennavapbc 19b8269
Testing
bennavapbc ad18c5c
Test
bennavapbc c6058b0
Fix
bennavapbc 128704d
Test
bennavapbc 26f7e72
Fix
bennavapbc 8865c70
Test
bennavapbc 9878400
Fix
bennavapbc ce5b0c3
Test
bennavapbc 1ab220f
Add summary
bennavapbc e23cbbf
Fix
bennavapbc 5decad2
Text
bennavapbc 4953c39
Formatting
bennavapbc 9b1bd60
Tset
bennavapbc 606e769
Test
bennavapbc fd1dd4f
Fix
bennavapbc 1a20f14
Test
bennavapbc 8b8b628
Update summary
bennavapbc c563c3e
Update event client to 3.3.6-gf-SNAPSHOT
bennavapbc 30e4df0
Fix ab2d branch
bennavapbc d35525d
Comment out step
bennavapbc 85084d2
Comment out step
bennavapbc 6f5a512
Update run-name
bennavapbc 1fb95dd
Fix promote-gf
bennavapbc cd72a8e
Finalize workflows
bennavapbc 079d61f
Finalize workflows
bennavapbc 52223ed
Revert
bennavapbc be854fa
fix
bennavapbc c2fdd6f
Fix
bennavapbc 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,62 @@ | ||
name: Build-gf | ||
run-name: build-gf | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: codebuild-ab2d-contracts-${{github.run_id}}-${{github.run_attempt}} | ||
env: | ||
ECR_REPO: ab2d-contracts | ||
TAG_PREFIX: contracts-service | ||
AWS_ACCOUNT: ${{ secrets.GF_NON_PROD_ACCOUNT }} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 | ||
with: | ||
gradle-version: 8.4 | ||
|
||
- uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main | ||
with: | ||
params: | | ||
ARTIFACTORY_URL=/artifactory/url | ||
ARTIFACTORY_USER=/artifactory/user | ||
ARTIFACTORY_PASSWORD=/artifactory/password | ||
|
||
- name: Assume role in target account | ||
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT }}:role/delegatedadmin/developer/ab2d-dev-github-actions | ||
|
||
- name: Build libraries | ||
run: | | ||
gradle -b build.gradle bootJar -Dset.root.project.build.filename=true | ||
|
||
- name: Build and push docker image | ||
run: | | ||
ECR_DOMAIN="$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com" | ||
SHA_SHORT=$(git rev-parse --short HEAD) | ||
aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_DOMAIN | ||
ECR_URI="$ECR_DOMAIN/$ECR_REPO" | ||
|
||
if [ "$GITHUB_REF_NAME" == "main" ]; then | ||
TAG_SHORT="$TAG_PREFIX-main-$SHA_SHORT" | ||
else | ||
TAG_SHORT="$TAG_PREFIX-$GITHUB_REF_NAME" | ||
fi | ||
|
||
docker build -t "$ECR_URI:$TAG_SHORT" . | ||
docker push "$ECR_URI" --all-tags | ||
echo "Published **$ECR_URI:$TAG_SHORT**" >> $GITHUB_STEP_SUMMARY |
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,42 @@ | ||
name: Deploy contracts GF | ||
run-name: deploy-gf ${{ inputs.environment }} ${{ inputs.image_tag_suffix }} | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
tag_suffix: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: AB2D environment | ||
required: true | ||
type: choice | ||
options: | ||
- dev | ||
- test | ||
- sandbox | ||
- prod | ||
image_tag_suffix: | ||
description: Image tag suffix | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
apply_tofu: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
uses: cmsgov/ab2d/.github/workflows/terraform-microservices-gf.yml@main # TODO set to main | ||
with: | ||
environment: ${{ inputs.environment }} | ||
contracts_service_image: contracts-service-${{ inputs.image_tag_suffix || github.ref }} | ||
apply: true | ||
ref: main | ||
runner: codebuild-ab2d-contracts-${{github.run_id}}-${{github.run_attempt}} | ||
secrets: | ||
aws_account: ${{contains(fromJSON('["dev", "test"]'), inputs.environment) && secrets.GF_NON_PROD_ACCOUNT || secrets.GF_PROD_ACCOUNT}} |
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,69 @@ | ||
name: promote-gf | ||
run-name: promote-gf ${{ inputs.image_tax_prefix }} | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tag_suffix: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
image_tag_suffix: | ||
description: Docker tag suffix | ||
required: false | ||
type: string | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
promote: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: codebuild-ab2d-contracts-${{github.run_id}}-${{github.run_attempt}} | ||
env: | ||
TAG_NAME: contracts-service-${{ inputs.image_tag_suffix || github.ref }} | ||
SOURCE_REPO: ab2d-contracts | ||
steps: | ||
- name: Define destination repo | ||
id: repos | ||
run: | | ||
echo "DEST_REPO=ab2d-contracts" >> $GITHUB_OUTPUT | ||
|
||
- name: Authenticate to source account (pull from test) | ||
uses: aws-actions/[email protected] | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: arn:aws:iam::${{ secrets.GF_NON_PROD_ACCOUNT }}:role/delegatedadmin/developer/ab2d-dev-github-actions | ||
|
||
- name: Pull image from test ECR | ||
id: pull-image | ||
run: | | ||
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
SRC_ECR="$ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com" | ||
docker login --username AWS --password-stdin $SRC_ECR <<< $(aws ecr get-login-password) | ||
echo "Pulling $SRC_ECR/$SOURCE_REPO:$TAG_NAME" | ||
docker pull "$SRC_ECR/$SOURCE_REPO:$TAG_NAME" | ||
echo "IMAGE=$SRC_ECR/$SOURCE_REPO:$TAG_NAME" >> $GITHUB_OUTPUT | ||
|
||
- name: Authenticate to destination account (push) | ||
uses: aws-actions/[email protected] | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: | | ||
arn:aws:iam::${{ secrets.GF_PROD_ACCOUNT }}:role/delegatedadmin/developer/ab2d-sandbox-github-actions | ||
|
||
- name: Tag and push image to destination ECR | ||
env: | ||
DEST_REPO: ${{ steps.repos.outputs.DEST_REPO }} | ||
IMAGE: ${{ steps.pull-image.outputs.IMAGE }} | ||
run: | | ||
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
DEST_ECR="$ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com" | ||
docker login --username AWS --password-stdin $DEST_ECR <<< $(aws ecr get-login-password) | ||
echo "Tagging and pushing image to $DEST_ECR/$DEST_REPO:$TAG_NAME" | ||
docker tag "$IMAGE" "$DEST_ECR/$DEST_REPO:$TAG_NAME" | ||
docker push "$DEST_ECR/$DEST_REPO:$TAG_NAME" |
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,81 @@ | ||
name: Unit tests and static analysis GF | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: # Allow manual trigger | ||
|
||
jobs: | ||
test: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: codebuild-ab2d-contracts-${{github.run_id}}-${{github.run_attempt}} | ||
env: | ||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 | ||
with: | ||
gradle-version: 8.4 | ||
|
||
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: arn:aws:iam::${{ secrets.GF_NON_PROD_ACCOUNT }}:role/delegatedadmin/developer/ab2d-test-github-actions | ||
|
||
- uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main | ||
env: | ||
AWS_REGION: ${{ vars.AWS_REGION }} | ||
with: | ||
params: | | ||
ARTIFACTORY_URL=/artifactory/url | ||
ARTIFACTORY_USER=/artifactory/user | ||
ARTIFACTORY_PASSWORD=/artifactory/password | ||
SONAR_HOST_URL=/sonarqube/url | ||
SONAR_TOKEN=/sonarqube/token | ||
|
||
- uses: aws-actions/aws-secretsmanager-get-secrets@fbd65ea98e018858715f591f03b251f02b2316cb #v2.0.8 | ||
with: | ||
secret-ids: | | ||
HPMS_AUTH_KEY_ID, ab2d/ab2d-east-impl/module/db/ab2d_hpms_auth_key_id/2020-01-02-09-15-01 | ||
HPMS_AUTH_KEY_SECRET, ab2d/ab2d-east-impl/module/db/ab2d_hpms_auth_key_secret/2020-01-02-09-15-01 | ||
Comment on lines
+47
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've got to eliminate usages of secrets manager like this. |
||
|
||
- name: Build files | ||
run: | | ||
gradle build -x test --info | ||
|
||
- name: Do tests | ||
run: | | ||
gradle clean test --info build | ||
|
||
- name: Build Jar | ||
run: | | ||
gradle jar --info build | ||
|
||
- name: Gradle task | ||
run: | | ||
gradle task | ||
|
||
- name: SonarQube Analysis | ||
run: | | ||
gradle sonar \ | ||
-Dsonar.projectKey=ab2d-contracts \ | ||
-Dsonar.host.url=https://sonarqube.cloud.cms.gov \ | ||
-Dsonar.login=$SONAR_TOKEN | ||
|
||
- name: Quality Gate | ||
id: sonarqube-quality-gate-check | ||
uses: sonarsource/sonarqube-quality-gate-action@master | ||
with: | ||
scanMetadataReportFile: build/sonar/report-task.txt | ||
timeout-minutes: 10 |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Do you know what action historically required this? I haven't looked extensively, but the external actions in use here appear to be modern node...