From 29da436fa283fa8ef040516812400fc2986d0beb Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Wed, 17 Mar 2021 21:59:49 +0200 Subject: [PATCH 1/4] Test docker buildkit --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ab4cc1838..f99c8e6e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -70,7 +70,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -123,7 +123,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { From afd3108f2c6d0c14088fcb9a5b055dd4235b9e52 Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Wed, 17 Mar 2021 22:58:20 +0200 Subject: [PATCH 2/4] Enable docker-compose env var too --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f99c8e6e7..4646bc836 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -70,7 +70,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -123,7 +123,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { From c911a3417719d7bb829d6134a070486674738f45 Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Thu, 18 Mar 2021 12:22:18 +0200 Subject: [PATCH 3/4] Use top level environment variables --- Jenkinsfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4646bc836..8d3711180 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,8 @@ pipeline { agent none environment { + COMPOSE_DOCKER_CLI_BUILD = 1 + DOCKER_BUILDKIT = 1 MY127WS_KEY = credentials('base-my127ws-key-20190523') } options { @@ -17,7 +19,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -70,7 +72,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { @@ -123,7 +125,7 @@ pipeline { label 'my127ws' alwaysPull true image 'quay.io/inviqa_images/workspace:latest' - args '--env COMPOSE_DOCKER_CLI_BUILD=1 --env DOCKER_BUILDKIT=1 --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' + args '--entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } stages { From 8b0e5db1625dbfe955eeb0c6b72339826e19e25f Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Thu, 18 Mar 2021 12:24:01 +0200 Subject: [PATCH 4/4] Enable for projects, controllable via attribute --- src/_base/application/overlay/Jenkinsfile.twig | 2 ++ src/_base/harness/attributes/common.yml | 7 +++++-- src/drupal8/application/overlay/Jenkinsfile.twig | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/_base/application/overlay/Jenkinsfile.twig b/src/_base/application/overlay/Jenkinsfile.twig index e13656573..535963d4c 100644 --- a/src/_base/application/overlay/Jenkinsfile.twig +++ b/src/_base/application/overlay/Jenkinsfile.twig @@ -1,6 +1,8 @@ pipeline { agent { label "my127ws" } environment { + COMPOSE_DOCKER_CLI_BUILD = {{ @('jenkins.docker.buildkit.enabled') ? '1' : '0' }} + DOCKER_BUILDKIT = {{ @('jenkins.docker.buildkit.enabled') ? '1' : '0' }} MY127WS_KEY = credentials('{{ @('jenkins.credentials.my127ws_key') }}') MY127WS_ENV = "pipeline" } diff --git a/src/_base/harness/attributes/common.yml b/src/_base/harness/attributes/common.yml index d643357f2..2640640ec 100644 --- a/src/_base/harness/attributes/common.yml +++ b/src/_base/harness/attributes/common.yml @@ -23,10 +23,13 @@ attributes.default: mutagen: yes jenkins: - tests: - isolated: true credentials: my127ws_key: = @('workspace.name') ~ '-my127ws-key' + docker: + buildkit: + enabled: true + tests: + isolated: true pipeline: base: diff --git a/src/drupal8/application/overlay/Jenkinsfile.twig b/src/drupal8/application/overlay/Jenkinsfile.twig index 16a97237e..142920e8b 100644 --- a/src/drupal8/application/overlay/Jenkinsfile.twig +++ b/src/drupal8/application/overlay/Jenkinsfile.twig @@ -1,6 +1,8 @@ pipeline { agent { label "my127ws" } environment { + COMPOSE_DOCKER_CLI_BUILD = {{ @('jenkins.docker.buildkit.enabled') ? '1' : '0' }} + DOCKER_BUILDKIT = {{ @('jenkins.docker.buildkit.enabled') ? '1' : '0' }} MY127WS_KEY = credentials('{{ @('jenkins.credentials.my127ws_key') }}') MY127WS_ENV = "pipeline" }