5
5
# We are deliberately *not* running on push events here to avoid double runs.
6
6
# Instead, push events will trigger from the base image and maven unit tests via workflow_call.
7
7
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"
8
14
pull_request :
9
15
branches :
10
16
- develop
16
22
17
23
env :
18
24
IMAGE_TAG : unstable
19
- BASE_IMAGE_TAG : unstable
20
25
REGISTRY : " " # Empty means default to Docker Hub
21
26
PLATFORMS : " linux/amd64,linux/arm64"
22
27
MASTER_BRANCH_TAG : alpha
@@ -33,20 +38,24 @@ jobs:
33
38
if : ${{ github.repository_owner == 'IQSS' }}
34
39
35
40
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
41
43
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.
45
53
46
54
- name : Build app and configbaker container image with local architecture and submodules (profile will skip tests)
47
55
run : >
48
56
mvn -B -f modules/dataverse-parent
49
57
-P ct -pl edu.harvard.iq:dataverse -am
58
+ $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
50
59
install
51
60
52
61
# TODO: add smoke / integration testing here (add "-Pct -DskipIntegrationTests=false")
@@ -106,11 +115,13 @@ jobs:
106
115
if : needs.check-secrets.outputs.available == 'true' &&
107
116
( github.event_name != 'push' || ( github.event_name == 'push' && contains(fromJSON('["develop", "master"]'), github.ref_name)))
108
117
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
111
120
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
114
125
115
126
# Depending on context, we push to different targets. Login accordingly.
116
127
- if : github.event_name != 'pull_request'
@@ -146,11 +157,13 @@ jobs:
146
157
run : >
147
158
mvn -B -f modules/dataverse-parent
148
159
-P ct -pl edu.harvard.iq:dataverse -am
160
+ $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
149
161
install
150
162
- name : Deploy multi-arch application and configbaker container image
151
163
run : >
152
164
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 }}" )
154
167
${{ env.REGISTRY }} -Ddocker.platforms=${{ env.PLATFORMS }}
155
168
-P ct deploy
156
169
0 commit comments