Docker release task for latest tags (#4810)

Signed-off-by: Jason Frame <jason.frame@consensys.net>
pull/4832/head
Jason Frame 2 years ago
parent 4cf6c38e76
commit 1c59bdc7d8
  1. 13
      .github/workflows/release.yml
  2. 60
      build.gradle

@ -6,11 +6,12 @@ jobs:
dockerPromoteX64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
run: echo ${{ secrets.DOCKER_PASSWORD_RW }} | docker login -u ${{ secrets.DOCKER_USER_RW }} --password-stdin
- name: pull tagged image
run: docker pull ${{ secrets.DOCKER_ORG }}/besu:gitSha-${{ github.sha }}
- name: apply latest tag
run: docker tag ${{ secrets.DOCKER_ORG }}/besu:gitSha-${{ github.sha }} ${{ secrets.DOCKER_ORG }}/besu:latest
- name: push
run: docker push ${{ secrets.DOCKER_ORG }}/besu:latest
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Docker upload
run: ./gradlew "-Prelease.releaseVersion=${{ github.ref_name }}" "-PdockerOrgName=${{ secrets.DOCKER_ORG }}" dockerUploadRelease
- name: Docker manifest
run: ./gradlew "-Prelease.releaseVersion=${{ github.ref_name }}" "-PdockerOrgName=${{ secrets.DOCKER_ORG }}" manifestDockerRelease

@ -654,12 +654,6 @@ task distDocker {
}
}
def shaTag = "gitSha-${getCheckedOutGitCommitHash(40)}" //full length sha
exec {
executable "sh"
args "-c", "docker tag '${dockerImageName}:${dockerBuildVersion}-${dockerVariants[0]}' '${dockerImageName}:${shaTag}'"
}
// tag the "default" (which is the variant in the zero position)
exec {
executable "sh"
@ -767,9 +761,32 @@ task dockerUpload {
}
}
task manifestDocker {
dependsOn distDocker
task dockerUploadRelease {
def archs = ["arm64", "amd64"]
def image = "${dockerImageName}:${dockerBuildVersion}"
doLast {
for (def architecture in archs) {
for (def variant in dockerVariants) {
def variantImage = "${image}-${variant}"
exec {
def cmd = "docker pull '${variantImage}-${architecture}' && docker tag '${variantImage}-${architecture}' '${dockerImageName}:latest-${variant}-${architecture}' && docker push '${dockerImageName}:latest-${variant}-${architecture}'"
executable "sh"
args "-c", cmd
}
}
exec {
def archImage = "${image}-${architecture}"
def cmd = "docker pull '${archImage}' && docker tag ${archImage} '${dockerImageName}:latest-${architecture}' && docker push '${dockerImageName}:latest-${architecture}'"
executable "sh"
args "-c", cmd
}
}
}
}
task manifestDocker {
def image = "${dockerImageName}:${dockerBuildVersion}"
def archs = ["arm64", "amd64"]
def tags = ["${image}"]
@ -807,6 +824,33 @@ task manifestDocker {
}
}
task manifestDockerRelease {
def archs = ["arm64", "amd64"]
def baseTag = "${dockerImageName}:latest";
doLast {
for (def variant in dockerVariants) {
def variantImage = "${baseTag}-${variant}"
def targets = ""
archs.forEach { arch -> targets += "'${variantImage}-${arch}' " }
exec {
def cmd = "docker manifest create '${variantImage}' ${targets} && docker manifest push '${variantImage}'"
executable "sh"
args "-c", cmd
}
}
exec {
def targets = ""
archs.forEach { arch -> targets += "'${baseTag}-${arch}' " }
def cmd = "docker manifest create '${baseTag}' ${targets} && docker manifest push '${baseTag}'"
executable "sh"
args "-c", cmd
}
}
}
task checkSpdxHeader(type: CheckSpdxHeader) {
apply plugin: 'groovy'

Loading…
Cancel
Save