Skip to content

Commit 3405ba8

Browse files
jalphonsoJoe Alphonso
authored andcommitted
rework compose CI logic (#3084)
CI pipeline will now succeed as long as at least one Compose Job passes Reusable workflows helped with code de-duplication Broke out compose job into meaningful descriptive steps Leveraging existing Github action `actions/setup-java` to setup Maven settings.xml --------- Co-authored-by: Joe Alphonso <jfalpho@uwe.nsa.gov>
1 parent 3e7fca8 commit 3405ba8

File tree

10 files changed

+238
-252
lines changed

10 files changed

+238
-252
lines changed

.github/workflows/build-accumulo.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ env:
2323
DATAWAVE_JAVA_VERSION: '11'
2424
JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8
2525
GITHUB_REGISTRY: ghcr.io
26-
GITHUB_USER_NAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
27-
GITHUB_ACCESS_TOKEN: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
26+
GITHUB_USERNAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
27+
GITHUB_PASSWORD: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
2828

2929
jobs:
3030
build-and-deploy-accumulo:
@@ -54,15 +54,19 @@ jobs:
5454
distribution: ${{env.JAVA_DISTRIBUTION}}
5555
java-version: ${{env.ACCUMULO_JAVA_VERSION}}
5656
cache: 'maven'
57+
server-id: github-datawave
5758
- run: echo "ACCUMULO_JAVA=$JAVA_HOME" >> $GITHUB_ENV
5859
- name: Set up JDK ${{env.DATAWAVE_JAVA_VERSION}}
5960
uses: actions/setup-java@v4
6061
with:
6162
distribution: ${{env.JAVA_DISTRIBUTION}}
6263
java-version: ${{env.DATAWAVE_JAVA_VERSION}}
6364
cache: 'maven'
65+
server-id: github-datawave
66+
# username and password are the env variables names that maven will use
67+
server-username: GITHUB_USERNAME
68+
server-password: GITHUB_PASSWORD
6469
- run: echo "DATAWAVE_JAVA=$JAVA_HOME" >> $GITHUB_ENV
65-
6670
- name: Get Accumulo Version
6771
id: get-accumulo-version
6872
run: |
@@ -76,24 +80,24 @@ jobs:
7680
run: |
7781
export JAVA_HOME="$ACCUMULO_JAVA"
7882
cd "$GITHUB_WORKSPACE/accumulo"
79-
mvn -DaltDeploymentRepository=github-datawave::https://maven.pkg.github.com/NationalSecurityAgency/datawave --show-version --batch-mode --errors --no-transfer-progress "-Dstyle.color=always" -DskipTests -T1C clean source:jar deploy -s "$GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml"
83+
mvn -DaltDeploymentRepository=github-datawave::https://maven.pkg.github.com/NationalSecurityAgency/datawave --show-version --batch-mode --errors --no-transfer-progress "-Dstyle.color=always" -DskipTests -T1C clean source:jar deploy
8084
- name: Log in to the Container registry
8185
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
8286
with:
8387
registry: ${{ env.GITHUB_REGISTRY }}
84-
username: ${{ env.GITHUB_USER_NAME }}
85-
password: ${{ env.GITHUB_ACCESS_TOKEN }}
88+
username: ${{ secrets.GHCR_WRITE_USER_NAME }}
89+
password: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
8690

8791
- name: Update DataWave Dependency Version
8892
run: |
8993
9094
export JAVA_HOME="$DATAWAVE_JAVA"
9195
cd "$GITHUB_WORKSPACE/datawave"
92-
mvn --settings $GITHUB_WORKSPACE/.github/workflows/settings.xml versions:set-property -Dproperty=version.accumulo -DnewVersion=${{ steps.get-accumulo-version.outputs.accumuloVersion }} -DgenerateBackupPoms=false
96+
mvn versions:set-property -Dproperty=version.accumulo -DnewVersion=${{ steps.get-accumulo-version.outputs.accumuloVersion }} -DgenerateBackupPoms=false
9397
- name: Build Web and Ingest Docker Images (Maven)
9498
run: |
9599
export JAVA_HOME="$DATAWAVE_JAVA"
96100
cd "$GITHUB_WORKSPACE/datawave"
97-
mvn --settings $GITHUB_WORKSPACE/.github/workflows/settings.xml clean deploy -Pkubernetes -Dtar -Ddeploy -Ddist -Pdocker -Ddocker-release -DskipTests -Dversion.accumulo=${{ steps.get-accumulo-version.outputs.accumuloVersion }}
101+
mvn clean deploy -Pkubernetes -Dtar -Ddeploy -Ddist -Pdocker -Ddocker-release -DskipTests -Dversion.accumulo=${{ steps.get-accumulo-version.outputs.accumuloVersion }}
98102
99103

.github/workflows/check-formatting.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ env:
2020
JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8
2121
MAVEN_OPTS: "-Djansi.force=true -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true -XX:ThreadStackSize=1m -Daether.connector.basic.threads=8 -Daether.metadataResolver.threads=8 -Daether.syncContext.named.time=480"
2222
GITHUB_REGISTRY: ghcr.io
23-
GITHUB_USER_NAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
24-
GITHUB_ACCESS_TOKEN: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
23+
GITHUB_USERNAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
24+
GITHUB_PASSWORD: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
2525

2626
jobs:
2727
# Runs the pom sorter and code formatter to ensure that the code
@@ -38,6 +38,10 @@ jobs:
3838
distribution: ${{env.JAVA_DISTRIBUTION}}
3939
java-version: ${{env.JAVA_VERSION}}
4040
cache: 'maven'
41+
server-id: github-datawave
42+
# username and password are the env variables names that maven will use
43+
server-username: GITHUB_USERNAME
44+
server-password: GITHUB_PASSWORD
4145
- name: Extract branch name
4246
shell: bash
4347
run: |
@@ -50,7 +54,7 @@ jobs:
5054
- name: Format code
5155
run: |
5256
if [[ "${{ github.event_name }}" != "merge_group" ]]; then
53-
mvn --settings $GITHUB_WORKSPACE/.github/workflows/settings.xml --show-version --batch-mode --errors --no-transfer-progress "-Dstyle.color=always" clean formatter:format sortpom:sort impsort:sort -Dmaven.build.cache.enabled=false -Pautoformat -Dutils -Dservices -Dstarters
57+
mvn --show-version --batch-mode --errors --no-transfer-progress "-Dstyle.color=always" clean formatter:format sortpom:sort impsort:sort -Dmaven.build.cache.enabled=false -Pautoformat -Dutils -Dservices -Dstarters
5458
if ! git diff-index --quiet HEAD; then
5559
echo "Code formatting issues detected. Please format locally.";
5660
exit 1;

.github/workflows/compose-and-quickstart.yml

Lines changed: 0 additions & 185 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Compose Coordinator
2+
3+
on:
4+
push:
5+
paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE']
6+
branches:
7+
- 'integration'
8+
- 'release/version*'
9+
pull_request:
10+
paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE']
11+
merge_group:
12+
workflow_dispatch:
13+
14+
jobs:
15+
call-compose-tests:
16+
uses: ./.github/workflows/compose-tests.yml
17+
with:
18+
allow-snapshots: false
19+
secrets: inherit
20+
call-compose-tests-with-snapshots:
21+
uses: ./.github/workflows/compose-tests.yml
22+
with:
23+
allow-snapshots: true
24+
secrets: inherit
25+
compose-check-jobs:
26+
runs-on: ubuntu-latest
27+
if: always()
28+
needs: [call-compose-tests, call-compose-tests-with-snapshots]
29+
steps:
30+
- name: Status message
31+
run: |
32+
echo "compose-tests: ${{ needs.call-compose-tests.result }}"
33+
echo "compose-tests-with-snapshots: ${{ needs.call-compose-tests-with-snapshots.result }}"
34+
- name: Check a condition and fail if not met
35+
if: ${{ !contains(needs.*.result, 'success') }}
36+
uses: actions/github-script@v6
37+
with:
38+
script: |
39+
core.setFailed('Neither compose jobs passed');

0 commit comments

Comments
 (0)