Skip to content

added step to pull params from ab2d #7

added step to pull params from ab2d

added step to pull params from ab2d #7

name: GitHub Actions Workflow
on:
push:
branches:
- '*'
jobs:
build:
runs-on: self-hosted
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
E2E_ENVIRONMENT: 'CI'
AB2D_V2_ENABLED: 'true'
SEARCH_BENE_BATCH_SIZE: '10'
AWS_DEFAULT_REGION: "us-east-1"
WORKSPACE: ${{ github.workspace }}
AB2D_BFD_KEYSTORE_LOCATION: "${{ github.workspace }}/opt/ab2d/ab2d_bfd_keystore"
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
maven-version: '3.6.3'
- name: Set env vars from AWS params
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
ECR_REPO_ENV_AWS_ACCOUNT_NUMBER: ${{ vars.SBX_ACCOUNT_NUMBER }}
with:
params: |
ARTIFACTORY_URL=/artifactory/url
ARTIFACTORY_USER=/artifactory/user
ARTIFACTORY_PASSWORD=/artifactory/password
CC_TEST_REPORTER_ID=cc-test-reporter-id
- name: Assume role in target account
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ vars.SBX_ACCOUNT_NUMBER }}:role/delegatedadmin/developer/github-actions-runner-role
- name: Set Environment Variables
run: |
AWS_ACCOUNT_ID=${{ vars.SBX_ACCOUNT_NUMBER }}
AWS_REGION=${{ vars.AWS_REGION }}
OKTA_CLIENT_ID=$(aws ssm get-parameter --name okta/client-id --region $AWS_REGION --account-id $AWS_ACCOUNT_ID --query "Parameter.Value" --output text)
OKTA_CLIENT_PASSWORD=$(aws ssm get-parameter --name okta/client-secret --region $AWS_REGION --account-id $AWS_ACCOUNT_ID --query "Parameter.Value" --output text)
SECONDARY_USER_OKTA_CLIENT_ID=$(aws ssm get-parameter --name secondary-okta/client-id --region $AWS_REGION --account-id $AWS_ACCOUNT_ID --query "Parameter.Value" --output text)
SECONDARY_USER_OKTA_CLIENT_PASSWORD=$(aws ssm get-parameter --name ${PARAMETER_PATH}/SECONDARY_USER_OKTA_CLIENT_PASSWORD --region $AWS_REGION --account-id $AWS_ACCOUNT_ID --query "Parameter.Value" --output text)
echo "OKTA_CLIENT_ID=$OKTA_CLIENT_ID" >> $GITHUB_ENV
echo "OKTA_CLIENT_PASSWORD=$OKTA_CLIENT_PASSWORD" >> $GITHUB_ENV
echo "SECONDARY_USER_OKTA_CLIENT_ID=$SECONDARY_USER_OKTA_CLIENT_ID" >> $GITHUB_ENV
echo "SECONDARY_USER_OKTA_CLIENT_PASSWORD=$SECONDARY_USER_OKTA_CLIENT_PASSWORD" >> $GITHUB_ENV
- name: Install Maven 3.6.3
run: |
wget https://archive.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.6.3-bin.tar.gz
tar xzvf apache-maven-3.6.3-bin.tar.gz
sudo mv apache-maven-3.6.3 /opt/maven
echo "PATH=$PATH:/opt/maven/bin" >> $GITHUB_ENV
- name: Create ab2d workspace directory and copy in keystore
run: sudo mkdir -p "$WORKSPACE/opt/ab2d"
- name: Download Code Coverage
run: |
mkdir -p codeclimate
if [ ! -f ./codeclimate/cc-test-reporter ]; then
curl -L --no-progress-meter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
> ./codeclimate/cc-test-reporter && chmod +x ./codeclimate/cc-test-reporter
fi
- name: Set directory permissions
run: |
sudo chmod -R 777 /opt/actions-runner/_work/ab2d/ab2d/common/
# Add other commands if necessary
- name: Clean maven
run: |
mvn --version
echo $WORKSPACE
mvn -U clean
# ... (Similar conversions for other stages)
# - name: Set env vars from AWS params
# 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
- name: Run unit and integration tests
run: |
mvn -s settings.xml -X -Dusername=${ARTIFACTORY_USER} -Dpassword=${ARTIFACTORY_PASSWORD} -Drepository_url=${ARTIFACTORY_URL} test -pl common,job,coverage,api,worker
- name: Cleanup - first pass of docker deletions part 1
run: |
docker volume ls -qf dangling=true | xargs -I name docker volume rm name
docker ps -aq | xargs -I name docker rm --force name