Fix image building.
This commit is contained in:
parent
12ca211fdb
commit
7df0cc386c
5 changed files with 86 additions and 84 deletions
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -37,4 +37,4 @@ jobs:
|
|||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- name: Push with Gradle
|
||||
run: ./gradlew -Pwebsite.push.token=${{ secrets.WEBSITE_PUSH_TOKEN }} -Pdocker.registry=ghcr.io/${{ github.actor }} stage pushImages
|
||||
run: ./gradlew -Pwebsite.push.token=${{ secrets.WEBSITE_PUSH_TOKEN }} -Pdocker.registry=ghcr.io/${{ github.actor }} stage publishImage
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ publish-images:
|
|||
dependencies:
|
||||
- build-jars
|
||||
script:
|
||||
- ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE pushImage
|
||||
- ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE publishImage
|
||||
|
||||
.pages-job:
|
||||
extends: .any-job
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ application {
|
|||
}
|
||||
|
||||
project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
|
||||
task buildImage(type: Exec) {
|
||||
dependsOn installDist
|
||||
|
|
@ -61,20 +62,23 @@ task pushImage(type: Exec) {
|
|||
// Don't push without testing first
|
||||
dependsOn test
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}:${project.gitBranch}", \
|
||||
"${project.name}:${project.gitBranch}", \
|
||||
"${registry}/${project.name}:${project.gitBranch}"
|
||||
|
||||
if (!project.version.contains("SNAPSHOT")) {
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}:${project.gitBranch}",\
|
||||
"${registry}/${project.name}:${project.version}"
|
||||
}
|
||||
}
|
||||
|
||||
task tagWithVersion(type: Exec) {
|
||||
dependsOn pushImage
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}:${project.gitBranch}",\
|
||||
"${registry}/${project.name}:${project.version}"
|
||||
}
|
||||
|
||||
task tagAsLatest(type: Exec) {
|
||||
dependsOn pushImage
|
||||
dependsOn tagWithVersion
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
&& !project.version.contains("alpha") \
|
||||
|
|
@ -83,17 +87,22 @@ task tagAsLatest(type: Exec) {
|
|||
&& project.rootProject.properties['docker.registry'] \
|
||||
== project.rootProject.properties['docker.testRegistry']
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}:${project.version}",\
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}:${project.gitBranch}",\
|
||||
"${registry}/${project.name}:latest"
|
||||
}
|
||||
|
||||
task publishImage {
|
||||
dependsOn pushImage
|
||||
dependsOn tagWithVersion
|
||||
dependsOn tagAsLatest
|
||||
}
|
||||
|
||||
task pushForTest(type: Exec) {
|
||||
dependsOn buildImage
|
||||
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}:${project.gitBranch}", \
|
||||
"${project.name}:${project.gitBranch}", \
|
||||
"${project.rootProject.properties['docker.testRegistry']}" \
|
||||
+ "/${project.name}:test"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ application {
|
|||
}
|
||||
|
||||
project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
|
||||
task buildArchImage(type: Exec) {
|
||||
task buildImageArch(type: Exec) {
|
||||
dependsOn installDist
|
||||
inputs.files 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch'
|
||||
|
||||
|
|
@ -42,23 +43,26 @@ task buildArchImage(type: Exec) {
|
|||
'-f', 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch', '.'
|
||||
}
|
||||
|
||||
task pushArchImage(type: Exec) {
|
||||
dependsOn buildArchImage
|
||||
task pushImageArch(type: Exec) {
|
||||
dependsOn buildImageArch
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}-arch:${project.gitBranch}", \
|
||||
"${project.name}-arch:${project.gitBranch}", \
|
||||
"${registry}/${project.name}-arch:${project.gitBranch}"
|
||||
|
||||
if (!project.version.contains("SNAPSHOT")) {
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}-arch:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-arch:${project.version}"
|
||||
}
|
||||
}
|
||||
|
||||
task tagWithVersionArch(type: Exec) {
|
||||
dependsOn pushImageArch
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}-arch:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-arch:${project.version}"
|
||||
}
|
||||
|
||||
task tagAsLatestArch(type: Exec) {
|
||||
dependsOn pushArchImage
|
||||
dependsOn tagWithVersionArch
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
&& !project.version.contains("alpha") \
|
||||
|
|
@ -67,13 +71,12 @@ task tagAsLatestArch(type: Exec) {
|
|||
&& project.rootProject.properties['docker.registry'] \
|
||||
== project.rootProject.properties['docker.testRegistry']
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}-arch:${project.version}",\
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}-arch:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-arch:latest"
|
||||
}
|
||||
|
||||
task buildAlpineImage(type: Exec) {
|
||||
task buildImageAlpine(type: Exec) {
|
||||
dependsOn installDist
|
||||
inputs.files 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.alpine'
|
||||
|
||||
|
|
@ -82,23 +85,26 @@ task buildAlpineImage(type: Exec) {
|
|||
'-f', 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.alpine', '.'
|
||||
}
|
||||
|
||||
task pushAlpineImage(type: Exec) {
|
||||
dependsOn buildAlpineImage
|
||||
task pushImageAlpine(type: Exec) {
|
||||
dependsOn buildImageAlpine
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}-alpine:${project.gitBranch}", \
|
||||
"${registry}/${project.name}-alpine:${project.gitBranch}"
|
||||
|
||||
if (!project.version.contains("SNAPSHOT")) {
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}-alpine:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-alpine:${project.version}"
|
||||
}
|
||||
}
|
||||
|
||||
task tagWithVersionAlpine(type: Exec) {
|
||||
dependsOn pushImageAlpine
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}-alpine:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-alpine:${project.version}"
|
||||
}
|
||||
|
||||
task tagAsLatestAlpine(type: Exec) {
|
||||
dependsOn pushAlpineImage
|
||||
dependsOn tagWithVersionAlpine
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
&& !project.version.contains("alpha") \
|
||||
|
|
@ -107,19 +113,16 @@ task tagAsLatestAlpine(type: Exec) {
|
|||
&& project.rootProject.properties['docker.registry'] \
|
||||
== project.rootProject.properties['docker.testRegistry']
|
||||
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
commandLine 'podman', 'tag', \
|
||||
"${registry}/${project.name}-alpine:${project.version}",\
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}-alpine:${project.gitBranch}",\
|
||||
"${registry}/${project.name}-alpine:latest"
|
||||
}
|
||||
|
||||
task pushImage {
|
||||
dependsOn pushArchImage
|
||||
dependsOn pushAlpineImage
|
||||
}
|
||||
|
||||
task tagAsLatest {
|
||||
task publishImage {
|
||||
dependsOn pushImageArch
|
||||
dependsOn tagWithVersionArch
|
||||
dependsOn tagAsLatestArch
|
||||
dependsOn pushImageAlpine
|
||||
dependsOn tagWithVersionAlpine
|
||||
dependsOn tagAsLatestAlpine
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,44 +5,36 @@ plugins {
|
|||
dependencies {
|
||||
}
|
||||
|
||||
project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
|
||||
def registry = "${project.rootProject.properties['docker.registry']}"
|
||||
|
||||
task buildImage(type: Exec) {
|
||||
inputs.files 'Containerfile'
|
||||
|
||||
commandLine 'podman', 'build', '--pull',
|
||||
'-t', "${project.name}:${project.version}",\
|
||||
'-t', "${project.name}:${project.gitBranch}",\
|
||||
'-f', 'Containerfile', '.'
|
||||
}
|
||||
|
||||
task tagLatestImage(type: Exec) {
|
||||
dependsOn buildImage
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
&& !project.version.contains("alpha") \
|
||||
&& !project.version.contains("beta") \
|
||||
|| project.rootProject.properties['docker.testRegistry'] \
|
||||
&& project.rootProject.properties['docker.registry'] \
|
||||
== project.rootProject.properties['docker.testRegistry']
|
||||
|
||||
commandLine 'podman', 'tag', "${project.name}:${project.version}",\
|
||||
"${project.name}:latest"
|
||||
}
|
||||
|
||||
task buildLatestImage {
|
||||
dependsOn buildImage
|
||||
dependsOn tagLatestImage
|
||||
}
|
||||
|
||||
task pushImage(type: Exec) {
|
||||
dependsOn buildImage
|
||||
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}:${project.version}", \
|
||||
"${project.rootProject.properties['docker.registry']}" \
|
||||
+ "/${project.name}:${project.version}"
|
||||
"${project.name}:${project.gitBranch}", \
|
||||
"${registry}/${project.name}:${project.gitBranch}"
|
||||
}
|
||||
task tagWithVersion(type: Exec) {
|
||||
dependsOn pushImage
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}:${project.gitBranch}",\
|
||||
"${registry}/${project.name}:${project.version}"
|
||||
}
|
||||
|
||||
task pushLatestImage(type: Exec) {
|
||||
dependsOn buildLatestImage
|
||||
task tagAsLatest(type: Exec) {
|
||||
dependsOn tagWithVersion
|
||||
|
||||
enabled = !project.version.contains("SNAPSHOT")
|
||||
&& !project.version.contains("alpha") \
|
||||
|
|
@ -51,18 +43,16 @@ task pushLatestImage(type: Exec) {
|
|||
&& project.rootProject.properties['docker.registry'] \
|
||||
== project.rootProject.properties['docker.testRegistry']
|
||||
|
||||
commandLine 'podman', 'push', '--tls-verify=false', \
|
||||
"localhost/${project.name}:${project.version}", \
|
||||
"${project.rootProject.properties['docker.registry']}" \
|
||||
+ "/${project.name}:latest"
|
||||
commandLine 'podman', 'push', \
|
||||
"${project.name}:${project.gitBranch}",\
|
||||
"${registry}/${project.name}:latest"
|
||||
}
|
||||
|
||||
task pushImages {
|
||||
// Don't push without testing first
|
||||
task publishImage {
|
||||
dependsOn pushImage
|
||||
dependsOn pushLatestImage
|
||||
dependsOn tagWithVersion
|
||||
dependsOn tagAsLatest
|
||||
}
|
||||
|
||||
test {
|
||||
enabled = project.hasProperty("k8s.testCluster")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue