From ea92f7143bad66ca986d7ba0714fd300179907a4 Mon Sep 17 00:00:00 2001 From: Michael J Burling Date: Thu, 7 Dec 2023 11:33:26 -0600 Subject: [PATCH] BFD-3090: Use bfd-parent version in bfd-apps image (#2084) --- .github/workflows/ci-java.yml | 12 +++++++++--- apps/Dockerfile | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-java.yml b/.github/workflows/ci-java.yml index 9bad694a03..eaa87da632 100644 --- a/.github/workflows/ci-java.yml +++ b/.github/workflows/ci-java.yml @@ -18,8 +18,7 @@ env: ^ops/ansible/roles/bfd-pipeline/|\ ^ops/ansible/roles/bfd-server/|\ ^.github/workflows/ci-ansible.yml|\ - ^.github/workflows/yml\ - )" + ^.github/workflows/ci-java.yml)" jobs: workflow: @@ -111,6 +110,11 @@ jobs: run: mvn --threads 1C --quiet --batch-mode -Dmaven.build.cache.enabled=false verify working-directory: ./apps + - name: 'Install yq' + run: | + sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq + sudo chmod +x /usr/bin/yq + - name: Login to GitHub Container Registry run: | echo "${{ secrets.GITHUB_TOKEN }}" \ @@ -118,12 +122,14 @@ jobs: - name: Build and Deliver Apps Container Image run: | + BFD_PARENT_VERSION="$(yq '.project.version' pom.xml)" SANITIZED_REF="${GITHUB_REF_NAME////-}" IMAGE_NAME="ghcr.io/cmsgov/bfd-apps" SHORT_SHA="$(git rev-parse --short HEAD)" FULL_BRANCH_TAG="${IMAGE_NAME}:${SANITIZED_REF}" # human readable, branch name tag FULL_COMMIT_TAG="${IMAGE_NAME}:${SHORT_SHA}" # a short sha suffixed image tag - docker build . --tag "$FULL_BRANCH_TAG" + echo "Building ${BFD_PARENT_VERSION} Container" + docker build --tag "$FULL_BRANCH_TAG" --build-arg="BFD_VERSION=${BFD_PARENT_VERSION}" . docker tag "$FULL_BRANCH_TAG" "$FULL_COMMIT_TAG" docker push "$FULL_BRANCH_TAG" docker push "$FULL_COMMIT_TAG" diff --git a/apps/Dockerfile b/apps/Dockerfile index b70e4da122..4bfc247253 100644 --- a/apps/Dockerfile +++ b/apps/Dockerfile @@ -1,17 +1,18 @@ # BASE_ANSIBLE tag, a known tag or latest available from https://github.com/CMSgov/beneficiary-fhir-data/pkgs/container/bfd-ansible ARG BASE_ANSIBLE_TAG=master FROM ghcr.io/cmsgov/bfd-ansible:$BASE_ANSIBLE_TAG +ARG BFD_VERSION LABEL org.opencontainers.image.source=https://github.com/CMSgov/beneficiary-fhir-data # flyway migrations for test harness setup COPY bfd-model/bfd-model-rif/src/main/resources/db/migration /flyway/sql # bfd-server assets -COPY bfd-server/bfd-server-launcher/target/bfd-server-launcher-1.0.0-SNAPSHOT.zip /.m2/repository/gov/cms/bfd/bfd-server-launcher/1.0.0-SNAPSHOT/bfd-server-launcher-1.0.0-SNAPSHOT.zip -COPY bfd-server/bfd-server-war/target/bfd-server-war-1.0.0-SNAPSHOT.war /.m2/repository/gov/cms/bfd/bfd-server-war/1.0.0-SNAPSHOT/bfd-server-war-1.0.0-SNAPSHOT.war +COPY bfd-server/bfd-server-launcher/target/bfd-server-launcher-${BFD_VERSION}.zip /.m2/repository/gov/cms/bfd/bfd-server-launcher/${BFD_VERSION}/bfd-server-launcher-${BFD_VERSION}.zip +COPY bfd-server/bfd-server-war/target/bfd-server-war-${BFD_VERSION}.war /.m2/repository/gov/cms/bfd/bfd-server-war/${BFD_VERSION}/bfd-server-war-${BFD_VERSION}.war # bfd-pipeline assets -COPY bfd-pipeline/bfd-pipeline-app/target/bfd-pipeline-app-1.0.0-SNAPSHOT.zip /.m2/repository/gov/cms/bfd/bfd-pipeline-app/1.0.0-SNAPSHOT/bfd-pipeline-app-1.0.0-SNAPSHOT.zip +COPY bfd-pipeline/bfd-pipeline-app/target/bfd-pipeline-app-${BFD_VERSION}.zip /.m2/repository/gov/cms/bfd/bfd-pipeline-app/${BFD_VERSION}/bfd-pipeline-app-${BFD_VERSION}.zip # bfd-db-migrator assets -COPY bfd-db-migrator/target/bfd-db-migrator-1.0.0-SNAPSHOT.zip /.m2/repository/gov/cms/bfd/bfd-db-migrator/1.0.0-SNAPSHOT/bfd-db-migrator-1.0.0-SNAPSHOT.zip +COPY bfd-db-migrator/target/bfd-db-migrator-${BFD_VERSION}.zip /.m2/repository/gov/cms/bfd/bfd-db-migrator/${BFD_VERSION}/bfd-db-migrator-${BFD_VERSION}.zip