Skip to content

chore(deps): bump aws.version from 1.12.656 to 1.12.711 #1387

chore(deps): bump aws.version from 1.12.656 to 1.12.711

chore(deps): bump aws.version from 1.12.656 to 1.12.711 #1387

name: Java Build, Push, Test
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- .github/workflows/java-build-push-test.yaml
- 'backend/**'
- 'protos/**'
- pom.xml
- build_and_publish_backend.sh
push:
branches:
- main
- 'release/*'
permissions:
id-token: write # This is required for requesting the JWT
contents: write # Read is required for actions/checkout, write is required to comment on commits
pull-requests: write # This is needed for the coverage plugin to write comments to the PR
packages: write
statuses: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
VERTA_ECR_REGISTRY: "493416687123.dkr.ecr.us-east-1.amazonaws.com"
ECR_REPOSITORY: "493416687123.dkr.ecr.us-east-1.amazonaws.com/services/oss/modeldb/backend"
jobs:
build-push-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# need previous commit to find PR head commit info
fetch-depth: 2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::493416687123:role/github-actions
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Get branch names
id: branch_names
uses: tj-actions/branch-names@v8.0.1
- name: Get docker image tag
id: image_info
run: |
branch=$(echo ${{ steps.branch_names.outputs.current_branch }} | sed 's,/,_,g')
# PRs checkout a merge of PR head with target. Branches checkout current head of branch.
# When in a PR, use the PR head commit sha instead of the checkout commit sha.
pr_sha="${{ github.event.pull_request.head.sha }}"
sha=${pr_sha:-$GITHUB_SHA}
sha_details=$(TZ=UTC git show -s --format=%cd--%h --date='format-local:%Y-%m-%dT%H-%M-%S' --abbrev=7 $sha)
echo "sha=${sha}" >> $GITHUB_OUTPUT
echo "tag=${branch}-${sha_details}" >> $GITHUB_OUTPUT
- name: Update commit status with Docker image status
uses: ouzi-dev/commit-status-updater@v2
with:
name: "Tag: ${{ steps.image_info.outputs.tag }}"
description: "Building..."
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
server-id: github-verta # Value of the distributionManagement/repository/id field of the pom.xml
- name: Check formatting
run: mvn spotless:check
- name: Build and Publish to GitHub Packages Apache Maven
run: ./build_and_publish_backend.sh
env:
GITHUB_TOKEN: ${{ github.token }}
BRANCH_NAME: ${{ steps.branch_names.outputs.current_branch }}
- name: Update commit status with Docker image status
uses: ouzi-dev/commit-status-updater@v2
with:
name: "Tag: ${{ steps.image_info.outputs.tag }}"
description: "Publishing..."
- name: Inspect image to see if it already exists
id: should_publish
run: |
TARGETS=""
docker manifest inspect $ECR_REPOSITORY:${{ steps.image_info.outputs.tag }} || TARGETS="modeldb"
echo "targets=${TARGETS}" >> $GITHUB_OUTPUT
- name: Build and push Docker image to ECR
uses: docker/build-push-action@v5
if: "!(steps.should_publish.outputs.targets == '')"
with:
context: backend
push: true
build-args: |
BASE_IMAGE=${{ env.VERTA_ECR_REGISTRY }}/ops/containers/base/java:main-17-latest
tags: |
${{ env.ECR_REPOSITORY }}:${{ steps.image_info.outputs.tag }}
- name: Configure AWS credentials for us-west-2
if: startsWith( github.ref, 'refs/heads/release/' )
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::493416687123:role/github-actions
aws-region: us-west-2
- name: Login to Amazon ECR for us-west-2
id: login-ecr-release
if: startsWith( github.ref, 'refs/heads/release/' )
uses: aws-actions/amazon-ecr-login@v2
- name: Mirror Docker image to us-west-2
id: mirror-release
if: startsWith( github.ref, 'refs/heads/release/' )
shell: bash
run: |
export TARGET_REPOSITORY=${ECR_REPOSITORY/us-east-1/us-west-2}
docker manifest inspect ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }} || \
docker tag ${ECR_REPOSITORY}:${{ steps.image_info.outputs.tag }} ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }} && \
docker push ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }}
- name: Create commit comment
uses: peter-evans/commit-comment@v3
if: "!(steps.should_publish.outputs.targets == '')"
with:
body: "Docker Tag: ${{ steps.image_info.outputs.tag }}"
- name: Update commit status with Docker image status
uses: ouzi-dev/commit-status-updater@v2
with:
name: "Tag: ${{ steps.image_info.outputs.tag }}"
url: "${{ github.server_url }}/${{ github.repository }}/commit/${{ steps.image_info.outputs.sha }}#comments"
status: success
- name: Test
env:
VERTA_MODELDB_TEST_CONFIG: itconfig/config-test-h2.yaml
LIQUIBASE_MIGRATION: true
RUN_LIQUIBASE_SEPARATE: false
LOG4J_CONFIGURATION_FILE: itconfig/log4j2.yaml
LOG4J_FORMAT_MSG_NO_LOOKUPS: true
run: JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 ./test_backend.sh
- name: Upload Report
uses: 'actions/upload-artifact@v4'
with:
name: jacoco-reports
path: |
${{ github.workspace }}/backend/common/target/site/jacoco/jacoco.xml
${{ github.workspace }}/backend/server/target/site/jacoco/jacoco.xml
- name: Jacoco Report Common to PR
id: jacoco-common
uses: madrapps/jacoco-report@94dfcf8dae9680be2cfa714ca37fb37790bd7663 # Using specific commit until new release available
with:
paths: ${{ github.workspace }}/backend/common/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 10
min-coverage-changed-files: 70
debug-mode: false
update-comment: true
title: Common Code Coverage
- name: Jacoco Report Server to PR
id: jacoco-server
uses: madrapps/jacoco-report@94dfcf8dae9680be2cfa714ca37fb37790bd7663 # Using specific commit until new release available
with:
paths: ${{ github.workspace }}/backend/server/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 34
min-coverage-changed-files: 70
debug-mode: false
update-comment: true
title: Backend Code Coverage
- name: Create Code Coverage comment
uses: peter-evans/commit-comment@v3
with:
body: |
Total coverage (common): ${{ steps.jacoco-common.outputs.coverage-overall }}
Total coverage (server): ${{ steps.jacoco-server.outputs.coverage-overall }}
Changed Files coverage (common): coverage ${{ steps.jacoco-common.outputs.coverage-changed-files }}
Changed Files coverage (server): ${{ steps.jacoco-server.outputs.coverage-changed-files }}