Skip to content

Commit

Permalink
Tag via init script, not grep and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
timyates committed Jun 30, 2022
1 parent 3889e3e commit e2f12f4
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,14 @@ jobs:
build_command: mvn clean package -Dpackaging=docker -Djib.to.image=${{ steps.infrastructure-deployment.outputs.container_registry_name }}.azurecr.io/${{ steps.infrastructure-deployment.outputs.application_name }}/${{ steps.infrastructure-deployment.outputs.application_name }}:${{ github.sha }}
<%/runtimeMaven%>
<%#runtimeGradle%>
- name: Create an init script with the required image tag
run: |
echo 'allprojects { afterEvaluate { tasks.named("dockerBuild") { images = ["${{ steps.infrastructure-deployment.outputs.container_registry_name }}.azurecr.io/${{ steps.infrastructure-deployment.outputs.application_name }}/${{ steps.infrastructure-deployment.outputs.application_name }}:${{ github.sha }}"] } } }' > /tmp/init.gradle
shell: bash
- name: Build a Micronaut docker image project using Gradle
uses: microsoft/nubesgen-actions/gitops-build-java-gradle@<%compositeActionsVersion%>
id: dockerbuild
with:
build_command: gradle dockerBuild | tee stdout.txt
- name: Re-tag the image
run: |
echo "::group::Retagging docker image"
appname=$(grep -o '[^ ]\+:latest' stdout.txt)
echo "::debug::Found $appname"
docker tag $appname ${{ steps.infrastructure-deployment.outputs.container_registry_name }}.azurecr.io/${{ steps.infrastructure-deployment.outputs.application_name }}/${{ steps.infrastructure-deployment.outputs.application_name }}:${{ github.sha }}
shell: bash
build_command: gradle -I /tmp/init.gradle dockerBuild
<%/runtimeGradle%>
- name: Login to Azure
uses: azure/login@v1
Expand Down

0 comments on commit e2f12f4

Please sign in to comment.