55 # We are deliberately *not* running on push events here to avoid double runs.
66 # Instead, push events will trigger from the base image and maven unit tests via workflow_call.
77 workflow_call :
8+ inputs :
9+ base-image-ref :
10+ type : string
11+ description : " Reference of the base image to build on in full qualified form [<registry>/]<namespace>/<repo>:<tag>"
12+ required : false
13+ default : " gdcc/base:unstable"
814 pull_request :
915 branches :
1016 - develop
1622
1723env :
1824 IMAGE_TAG : unstable
19- BASE_IMAGE_TAG : unstable
2025 REGISTRY : " " # Empty means default to Docker Hub
2126 PLATFORMS : " linux/amd64,linux/arm64"
2227 MASTER_BRANCH_TAG : alpha
@@ -33,20 +38,24 @@ jobs:
3338 if : ${{ github.repository_owner == 'IQSS' }}
3439
3540 steps :
36- - name : Checkout repository
37- uses : actions/checkout@v3
38-
39- - name : Set up JDK
40- uses : actions/setup-java@v3
41+ - name : Checkout and Setup Maven
42+ uses : IQSS/dataverse/.github/actions/setup-maven@develop
4143 with :
42- java-version : " 17"
43- distribution : temurin
44- cache : maven
44+ pom-paths : |
45+ pom.xml
46+ modules/container-configbaker/pom.xml
47+ modules/dataverse-parent/pom.xml
48+
49+ # TODO: Add a filter step here, that avoids building the image if this is a PR and there are other files touched than declared above.
50+ # Use https://github.com/dorny/paths-filter to solve this. This will ensure we do not run this twice if this workflow
51+ # will be triggered by the other workflows already (base image or java changes)
52+ # To become a part of #10618.
4553
4654 - name : Build app and configbaker container image with local architecture and submodules (profile will skip tests)
4755 run : >
4856 mvn -B -f modules/dataverse-parent
4957 -P ct -pl edu.harvard.iq:dataverse -am
58+ $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
5059 install
5160
5261 # TODO: add smoke / integration testing here (add "-Pct -DskipIntegrationTests=false")
@@ -59,15 +68,15 @@ jobs:
5968 if : ${{ github.event_name != 'pull_request' && github.ref_name == 'develop' && github.repository_owner == 'IQSS' }}
6069 runs-on : ubuntu-latest
6170 steps :
62- - uses : actions/checkout@v3
63- - uses : peter-evans/dockerhub-description@v3
71+ - uses : actions/checkout@v4
72+ - uses : peter-evans/dockerhub-description@v4
6473 with :
6574 username : ${{ secrets.DOCKERHUB_USERNAME }}
6675 password : ${{ secrets.DOCKERHUB_TOKEN }}
6776 repository : gdcc/dataverse
6877 short-description : " Dataverse Application Container Image providing the executable"
6978 readme-filepath : ./src/main/docker/README.md
70- - uses : peter-evans/dockerhub-description@v3
79+ - uses : peter-evans/dockerhub-description@v4
7180 with :
7281 username : ${{ secrets.DOCKERHUB_USERNAME }}
7382 password : ${{ secrets.DOCKERHUB_TOKEN }}
@@ -106,29 +115,31 @@ jobs:
106115 if : needs.check-secrets.outputs.available == 'true' &&
107116 ( github.event_name != 'push' || ( github.event_name == 'push' && contains(fromJSON('["develop", "master"]'), github.ref_name)))
108117 steps :
109- - uses : actions/checkout@v3
110- - uses : actions/setup-java@v3
118+ - name : Checkout and Setup Maven
119+ uses : IQSS/dataverse/.github/ actions/setup-maven@develop
111120 with :
112- java-version : " 17"
113- distribution : temurin
121+ pom-paths : |
122+ pom.xml
123+ modules/container-configbaker/pom.xml
124+ modules/dataverse-parent/pom.xml
114125
115126 # Depending on context, we push to different targets. Login accordingly.
116127 - if : github.event_name != 'pull_request'
117128 name : Log in to Docker Hub registry
118- uses : docker/login-action@v2
129+ uses : docker/login-action@v3
119130 with :
120131 username : ${{ secrets.DOCKERHUB_USERNAME }}
121132 password : ${{ secrets.DOCKERHUB_TOKEN }}
122133 - if : ${{ github.event_name == 'pull_request' }}
123134 name : Login to Github Container Registry
124- uses : docker/login-action@v2
135+ uses : docker/login-action@v3
125136 with :
126137 registry : ghcr.io
127138 username : ${{ secrets.GHCR_USERNAME }}
128139 password : ${{ secrets.GHCR_TOKEN }}
129140
130141 - name : Set up QEMU for multi-arch builds
131- uses : docker/setup-qemu-action@v2
142+ uses : docker/setup-qemu-action@v3
132143
133144 - name : Re-set image tag based on branch (if master)
134145 if : ${{ github.ref_name == 'master' }}
@@ -146,11 +157,13 @@ jobs:
146157 run : >
147158 mvn -B -f modules/dataverse-parent
148159 -P ct -pl edu.harvard.iq:dataverse -am
160+ $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
149161 install
150162 - name : Deploy multi-arch application and configbaker container image
151163 run : >
152164 mvn
153- -Dapp.image.tag=${{ env.IMAGE_TAG }} -Dbase.image.tag=${{ env.BASE_IMAGE_TAG }}
165+ -Dapp.image.tag=${{ env.IMAGE_TAG }}
166+ $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
154167 ${{ env.REGISTRY }} -Ddocker.platforms=${{ env.PLATFORMS }}
155168 -P ct deploy
156169
0 commit comments