Skip to content

Commit

Permalink
Rename release version, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpartridge committed Feb 18, 2025
1 parent 48f025b commit e740c7a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 60 deletions.
77 changes: 37 additions & 40 deletions .github/workflows/build-and-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Build and Package
on:
workflow_call:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string
workflow_dispatch:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string
Expand All @@ -19,27 +19,24 @@ permissions:
contents: read

jobs:
# ci_checks:
# # uses: ./.github/workflows/ci-checks.yml
# uses: CMSgov/bcda-ssas-app/.github/workflows/ci-checks.yml@carl/BCDA-8633-build-bcda-on-ami
# with:
# release_version: ${{ inputs.release_version }}
# secrets: inherit
ci_checks:
uses: CMSgov/bcda-ssas-app/.github/workflows/ci-checks.yml@main
with:
ssas_release_version: ${{ inputs.ssas_release_version }}
secrets: inherit

build_and_package:
uses: ./.github/workflows/package-rpm.yml
with:
release_version: ${{ inputs.release_version }}
ssas_release_version: ${{ inputs.ssas_release_version }}
secrets: inherit

post_build:
if: ${{ always() }}
name: Post Build (Cleanup, Alerts)
# needs: [ci_checks, build_and_package]
needs: [build_and_package]
needs: [ci_checks, build_and_package]
runs-on: self-hosted
steps:
# 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)?
# when/where are we creating these tagged docker images?
- name: Log created docker images as build artifacts
Expand Down Expand Up @@ -67,31 +64,31 @@ jobs:
if [[ $(cat output/docker-images-created-${SLIM_VERSION}.txt | wc -c | xargs) != "0" ]]; then
docker rmi $(docker images --filter reference="${{ secrets.ACCOUNT_ID }}${DOCKER_ECR_SUFFIX}/*:${SLIM_VERSION}" --format "{{.Repository}}:{{.Tag}}")
fi
# - name: Success Alert
# if: ${{ success() && needs.ci_checks.result == 'success' && needs.build_and_package.result == '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() || needs.ci_checks.result != 'success' || needs.build_and_package.result != 'success' }}
# 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: "SUCCESS: Build and Package SSAS (run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }})>"
# mrkdown_in:
# - text
- name: Success Alert
if: ${{ success() && needs.ci_checks.result == 'success' && needs.build_and_package.result == '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() || needs.ci_checks.result != 'success' || needs.build_and_package.result != 'success' }}
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: "SUCCESS: Build and Package SSAS (run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }})>"
mrkdown_in:
- text
7 changes: 3 additions & 4 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ on:
push:
workflow_call:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string
workflow_dispatch:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string

env:
RELEASE_VERSION: ${{ inputs.release_version || github.sha }}
RELEASE_VERSION: ${{ inputs.ssas_release_version || github.sha }}

jobs:
go_mod_tidy:
Expand Down Expand Up @@ -77,7 +77,6 @@ jobs:
needs: lint_and_test
runs-on: self-hosted
steps:
# checkout!?
- name: Download code coverage
uses: actions/download-artifact@v4
with:
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/package-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Package BCDA SSAS
on:
workflow_call:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string
workflow_dispatch:
inputs:
release_version:
ssas_release_version:
description: 'Release version (or branch name)'
required: true
type: string
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: CMSgov/bcda-ssas-app
ref: ${{ inputs.release_version }}
ref: ${{ inputs.ssas_release_version }}
- name: Get AWS params
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
env:
Expand All @@ -55,32 +55,24 @@ jobs:
GPG_PUB_KEY_FILE: "../ops/RPM-GPG-KEY-bcda"
GPG_SEC_KEY_FILE: "../ops/RPM-GPG-KEY-SECRET-bcda"
run: |
export SLIM_VERSION=`echo ${{ inputs.release_version }} | sed 's/.*\///'`
echo $SLIM_VERSION
pwd
ls -als
export SLIM_VERSION=`echo ${{ inputs.ssas_release_version }} | sed 's/.*\///'`
echo "${{ env.BCDA_GPG_PUB_KEY }}" > ops/${{ env.GPG_PUB_KEY_FILE }}
echo "${{ env.BCDA_GPG_SEC_KEY }}" > ops/${{ env.GPG_SEC_KEY_FILE }}
# Remove any slashes - we don't want RPM to contain slash
BCDA_GPG_RPM_PASSPHRASE=${{ env.BCDA_GPG_RPM_PASSPHRASE }} GPG_RPM_USER="${{ env.GPG_RPM_USER }}" GPG_RPM_EMAIL="${{ env.GPG_RPM_EMAIL }}" GPG_PUB_KEY_FILE=${{ env.GPG_PUB_KEY_FILE }} GPG_SEC_KEY_FILE=${{ env.GPG_SEC_KEY_FILE }} make package version=$SLIM_VERSION
- name: Upload BCDA RPM to s3 releases
# TODO: should we be checking blank release_version or should we be checking inputs.release_env == 'dev' ?
if: ${{ inputs.release_version != '' }}
# TODO: should we be checking blank release_version or should we be checking inputs.ssas_release_env == 'dev' ?
if: ${{ inputs.ssas_release_version != '' }}
working-directory: ./ssas
run: |
ls -als
export SSAS_RPM=`ls ssas-*.rpm | tr '\n' ' '`
echo $SSAS_RPM
aws s3 cp --only-show-errors $SSAS_RPM s3://ssas-rpms/ssas-releases/ssas-release-${{ inputs.release_version }}.rpm
aws s3 cp --only-show-errors $SSAS_RPM s3://ssas-rpms/ssas-releases/ssas-release-${{ inputs.ssas_release_version }}.rpm
aws s3 cp --only-show-errors $SSAS_RPM s3://ssas-rpms/ssas-release-latest.rpm
- name: Upload BCDA RPM to s3 dev
if: ${{ inputs.release_version == '' }}
if: ${{ inputs.ssas_release_version == '' }}
working-directory: ./ssas
run: |
ls -als
export SSAS_RPM=`ls ssas-*.rpm | tr '\n' ' '`
echo $SSAS_RPM
export NEW_SSAS_RPM_NAME=`echo $SSAS_RPM | sed -e 's/-1.x86_64.rpm/-'build'${{ github.run_id }}''.rpm/g'`
echo $NEW_SSAS_RPM_NAME
aws s3 cp --only-show-errors $SSAS_RPM s3://ssas-rpms/ssas-dev/${NEW_SSAS_RPM_NAME}
aws s3 cp --only-show-errors $SSAS_RPM s3://ssas-rpms/ssas-dev-latest.rpm

0 comments on commit e740c7a

Please # to comment.