Skip to content

Commit 7547d87

Browse files
authored
add manual docker hub with commit hash publishing circleci step (Consensys#8213)
* add manual docker hub with commit hash publishing circleci step
1 parent b610255 commit 7547d87

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

Diff for: .circleci/config.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,16 @@ commands:
143143
144144
docker_publish_images:
145145
description: "Upload the docker images"
146+
parameters:
147+
include_commit_hash:
148+
type: boolean
149+
default: false
146150
steps:
147151
- run:
148152
name: "Publish Docker Images"
149153
command: |
150154
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
151-
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH}" uploadDocker
155+
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH} -PincludeCommitHash=<< parameters.include_commit_hash >>" uploadDocker
152156
153157
notify:
154158
description: "Notify Slack"
@@ -431,23 +435,33 @@ jobs:
431435
- notify
432436

433437
publishDockerAmd64:
438+
parameters:
439+
include_commit_hash:
440+
type: boolean
441+
default: false
434442
executor: machine_executor_amd64
435443
steps:
436444
- prepare
437445
- attach_workspace:
438446
at: ~/project
439447
- docker_trust_sign
440-
- docker_publish_images
448+
- docker_publish_images:
449+
include_commit_hash: << parameters.include_commit_hash >>
441450
- notify
442451

443452
publishDockerArm64:
453+
parameters:
454+
include_commit_hash:
455+
type: boolean
456+
default: false
444457
executor: machine_executor_arm64
445458
steps:
446459
- prepare
447460
- attach_workspace:
448461
at: ~/project
449462
- docker_trust_sign
450-
- docker_publish_images
463+
- docker_publish_images:
464+
include_commit_hash: << parameters.include_commit_hash >>
451465
- notify
452466

453467
manifestDocker:

Diff for: build.gradle

+10
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,16 @@ def executableAndArg = System.getProperty('os.name').toLowerCase().contains('win
532532
task distDocker {
533533
dependsOn dockerDistUntar
534534
def dockerBuildVersion = 'develop'
535+
536+
if (project.hasProperty('includeCommitHash') && project.property('includeCommitHash').toBoolean()) {
537+
def commitHash = new ByteArrayOutputStream()
538+
exec {
539+
commandLine 'git', 'rev-parse', '--short', 'HEAD'
540+
standardOutput = commitHash
541+
}
542+
dockerBuildVersion += '-' + commitHash
543+
}
544+
535545
doLast {
536546
for (def variant in dockerJdkVariants) {
537547
copy {

0 commit comments

Comments
 (0)