Skip to content

Try adding dsonar working dir #9

Try adding dsonar working dir

Try adding dsonar working dir #9

name: Build and Package
on:
push: # TEMP
branches: carl/BCDA-8633-build-bcda-on-ami
workflow_call:
inputs:
release_version:
description: 'Release version (or branch name)'
required: true
type: string
workflow_dispatch:
inputs:
release_version:
description: 'Release version (or branch name)'
required: true
type: string
permissions:
id-token: write
contents: read
jobs:
ci_checks:
uses: ./.github/workflows/ci-checks.yml
with:
# release_version: ${{ inputs.release_version }}
release_version: carl/BCDA-8633-build-bcda-on-ami
build_and_package:
uses: ./.github/workflows/package-rpm.yml
with:
# release_version: ${{ inputs.release_version }}
release_version: carl/BCDA-8633-build-bcda-on-ami
post_build:
if: ${{ always() }}
name: Post Build (Cleanup, Alerts)
needs: [ci_checks, build_and_package]
runs-on: self-hosted
steps:
# - name: Clear working dir
# - name: Checkout BCDA
# uses: actions/checkout@v4
# with:
# repository: CMSgov/bcda-app
# ref: ${{ inputs.release_version }}
# - name: Checkout BCDA-OPS
# - name: Decrypt secrets
# env:
# VAULT_PW: ${{ secrets.VAULT_PW }}
# run: |
# echo $VAULT_PW > .vault_password
# bash ops/secrets --decrypt
# mv -fv shared_files/encrypted/* shared_files/decrypted/
# Doing the above basic repo checkout in Quality Checks, does that make sense?
# script {
# dir('bcda-ssas-app') {
# SSAS_GIT_TAG = sh(returnStdout: true, script: """git tag -l ${params.SSAS_GIT_VERSION}""")
# COMMIT_SHA = sh(returnStdout: true, script: """git rev-parse HEAD""")
# SLIM_VERSION = sh(returnStdout: true, script: """echo ${params.SSAS_GIT_VERSION} | sed 's/.*\\///'""").trim()
# }
# TODO: junit 'bcda-ssas-app/test_results/latest/junit.xml'
# TODO: Do we need all/any of the following 3 steps (create docker version, upload, clean up)?
- name: Log created docker images as build artifacts
run: |
export DATE_TAG=`date +"%Y%m%d%H%M"`
export VERSION_TAG="build-rls-${DATE_TAG}-${{ github.run_id }}"
export DOCKER_ECR="${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com"
export SLIM_VERSION=`echo carl/BCDA-8633-build-bcda-on-ami | sed 's/.*\///'`
echo $DATE_TAG
echo $VERSION_TAG
echo $VERSTION_TAG >> $GITHUB_ENV
echo $DOCKER_ECR
echo $DOCKER_ECR >> $GITHUB_ENV
echo $SLIM_VERSION
echo $SLIM_VERSION >> $GITHUB_ENV
mkdir -p output
docker images --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.VERSION_TAG }}' --format "${{ github.repository }}:${{ github.ref }}" > output/docker-images-created-${{ env.VERSION_TAG }}.txt
docker images --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.SLIM_VERSION }}' --format "${{ github.repository }}:${{ github.ref }}" >> output/docker-images-created-${{ env.VERSION_TAG }}.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docker-image-versions
path: output/*.txt
- name: Cleanup Docker Images
run: |
cat output/*.txt
echo ${{ env.VERSION_TAG }}
echo ${{ env.DOCKER_ECR }}
echo ${{ env.SLIM_VERSION }}
echo "${{ github.repository }}:${{ github.ref }}"
docker images -qa --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.VERSION_TAG }}'
docker images -qa --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.SLIM_VERSION }}'
docker rmi $(docker images --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.VERSION_TAG }}' --format "${{ github.repository }}:${{ github.ref }}")
docker rmi $(docker images --filter=reference='${{ env.DOCKER_ECR }}/*:${{ env.SLIM_VERSION }}' --format "${{ github.repository }}:${{ github.ref }}")
- name: Success Alert
if: ${{ success() }}
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
# Sends to bcda-deploy
payload: |
channel: "C03S23MJFJS"
attachments:
- color: good
text: "SUCCESS: Build and Package SSAS (run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }})>"
mrkdown_in:
- text
# - name: Failure Alert
# if: ${{ failure() }}
# uses: slackapi/slack-github-action@v2.0.0
# with:
# method: chat.postMessage
# token: ${{ secrets.SLACK_BOT_TOKEN }}
# # Sends to bcda-alerts
# payload: |
# channel: "C034CFU945C"
# attachments:
# - color: danger
# text: "FAILURE: Build and Package SSAS (run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }})>"
# mrkdown_in:
# - text