File tree 7 files changed +46
-29
lines changed
.github/workflows/maven-goal
7 files changed +46
-29
lines changed Original file line number Diff line number Diff line change @@ -45,16 +45,23 @@ echo "--- Configure git context :git:"
45
45
git config --global user.email " infra-root+apmmachine@elastic.co"
46
46
git config --global user.name " apmmachine"
47
47
48
- echo " --- Install JDK17 :java:"
49
- JAVA_URL=https://jvm-catalog.elastic.co/jdk
50
- JAVA_HOME=$( pwd) /.openjdk17
51
- JAVA_PKG=" $JAVA_URL /latest_openjdk_17_linux.tar.gz"
52
- curl -L --output /tmp/jdk.tar.gz " $JAVA_PKG "
53
- mkdir -p " $JAVA_HOME "
54
- tar --extract --file /tmp/jdk.tar.gz --directory " $JAVA_HOME " --strip-components 1
55
-
48
+ # Configure the java version
49
+ JAVA_VERSION=$( cat .java-version | xargs | tr -dc ' [:print:]' )
50
+ JAVA_HOME=" ${HOME} /.java/openjdk${JAVA_VERSION} "
56
51
export JAVA_HOME
57
- PATH=$ JAVA_HOME /bin:$PATH
52
+ PATH=" ${ JAVA_HOME} /bin:${ PATH} "
58
53
export PATH
59
54
60
- java -version || true
55
+ # Fallback to install at runtime
56
+ if [ ! -d " ${JAVA_HOME} " ] ; then
57
+ # This should not be the case normally untless the .java-version file has been changed
58
+ # and the VM Image is not yet available with the latest version.
59
+ echo " --- Install JDK${JAVA_VERSION} :java:"
60
+ JAVA_URL=https://jvm-catalog.elastic.co/jdk
61
+ JAVA_PKG=" ${JAVA_URL} /latest_openjdk_${JAVA_VERSION} _linux.tar.gz"
62
+ curl -L --output /tmp/jdk.tar.gz " ${JAVA_PKG} "
63
+ mkdir -p " $JAVA_HOME "
64
+ tar --extract --file /tmp/jdk.tar.gz --directory " ${JAVA_HOME} " --strip-components 1
65
+ fi
66
+
67
+ java -version
Original file line number Diff line number Diff line change 1
1
agents :
2
2
provider : " gcp"
3
+ # image: "family/ecs-logging-java-ubuntu-2204"
3
4
4
5
steps :
5
6
- label : " Run the release"
8
9
artifact_paths : " release.txt"
9
10
10
11
notify :
11
- - slack :
12
- channels :
13
- - " #apm-agent-java "
12
+ - slack : " #apm-agent-java "
13
+ # skip slack messages if no failures and dry-run mode
14
+ if : ' build.state != "passed" && build.env("dry_run") == "false" '
Original file line number Diff line number Diff line change 1
1
agents :
2
2
provider : " gcp"
3
+ # image: "family/ecs-logging-java-ubuntu-2204"
3
4
4
5
steps :
5
6
- label : " Run the snapshot"
11
12
12
13
notify :
13
14
- slack : " #apm-agent-java"
14
- if : ' build.state != "passed"'
15
+ # skip slack messages if no failures and dry-run mode
16
+ if : ' build.state != "passed" && build.env("dry_run") == "false"'
Original file line number Diff line number Diff line change @@ -27,9 +27,14 @@ echo $PATH
27
27
java -version
28
28
29
29
set +x
30
- echo " --- Release the binaries to Maven Central :maven:"
31
- if [[ " ${dry_run} " == " true" ]] ; then
32
- ./mvnw -V -s .ci/settings.xml -Pgpg clean package --batch-mode | tee release.txt
33
- else
34
- ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy --batch-mode | tee release.txt
30
+ # Default in dry-run mode
31
+ GOAL=" package"
32
+ DRY_RUN_MSG=" (dry-run)"
33
+ # Otherwise, a RELEASE
34
+ if [[ " $dry_run " == " false" ]] ; then
35
+ GOAL=" deploy"
36
+ DRY_RUN_MSG=" "
35
37
fi
38
+
39
+ echo " --- Release the binaries to Maven Central :maven: [./mvnw ${GOAL} )] ${DRY_RUN_MSG} "
40
+ ./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt
Original file line number Diff line number Diff line change @@ -24,9 +24,14 @@ echo $PATH
24
24
java -version
25
25
26
26
set +x
27
- echo " --- Deploy the snapshot :package:"
28
- if [[ " $dry_run " == " true" ]] ; then
29
- ./mvnw -V -s .ci/settings.xml -Pgpg clean package --batch-mode | tee snapshot.txt
30
- else
31
- ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy --batch-mode | tee snapshot.txt
27
+ # Default in dry-run mode
28
+ GOAL=" package"
29
+ DRY_RUN_MSG=" (dry-run)"
30
+ # Otherwise, a RELEASE
31
+ if [[ " $dry_run " == " false" ]] ; then
32
+ GOAL=" deploy"
33
+ DRY_RUN_MSG=" "
32
34
fi
35
+
36
+ echo " --- Deploy the snapshot :package: [./mvnw ${GOAL} )] ${DRY_RUN_MSG} "
37
+ ./mvnw -V -s .ci/settings.xml -Pgpg clean ${GOAL} -DskipTests --batch-mode | tee snapshot.txt
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ name: maven-goal
4
4
description : Install specific JDK and run a command
5
5
6
6
inputs :
7
- version :
8
- description : ' Java version'
9
- required : true
10
- default : ' 17'
11
7
distribution :
12
8
description : ' Java distribution'
13
9
required : true
26
22
- name : Set up JDK
27
23
uses : actions/setup-java@v4
28
24
with :
29
- java-version : ${{ inputs. version }}
25
+ java-version-file : .java- version
30
26
distribution : ${{ inputs.distribution }}
31
27
cache : ' maven'
32
28
- run : ${{ inputs.command }}
Original file line number Diff line number Diff line change
1
+ 17
You can’t perform that action at this time.
0 commit comments