From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@citrix.com>,
Doug Goldstein <cardoe@cardoe.com>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: [RFC XEN PATCH 1/7] automation: Automatically rebuild debian:unstable container
Date: Thu, 2 Mar 2023 17:53:26 +0000 [thread overview]
Message-ID: <20230302175332.56052-2-anthony.perard@citrix.com> (raw)
In-Reply-To: <20230302175332.56052-1-anthony.perard@citrix.com>
Only run this on the staging branch, whenever the dockerfile changes.
Allow to set a suffix when building containers, to be able to test it
before changing the one in production.
Using "rules" instead of "only" as this allow to use variables in the
"changes" rules. Also, "rules" is the preferred keyword as
"only/except" isn't being actively developed in GitLab.
Use $CI_PIPELINE_SOURCE==push to evaluate "rules:changes" only on
push. In most other cases, "rules:changes" evaluate to true so
checking CI_PIPELINE_SOURCE is important.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
.gitlab-ci.yml | 2 ++
automation/build/Makefile | 4 ++--
automation/gitlab-ci/containers.yaml | 25 +++++++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
create mode 100644 automation/gitlab-ci/containers.yaml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c8bd7519d5..c5d499b321 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,9 @@
stages:
- build
- test
+ - containers
include:
- 'automation/gitlab-ci/build.yaml'
- 'automation/gitlab-ci/test.yaml'
+ - 'automation/gitlab-ci/containers.yaml'
diff --git a/automation/build/Makefile b/automation/build/Makefile
index 4df43b0407..5515938878 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -16,9 +16,9 @@ help:
include yocto/yocto.inc
%: %.dockerfile ## Builds containers
- $(DOCKER_CMD) build --pull -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
+ $(DOCKER_CMD) build --pull -t $(REGISTRY)/$(@D):$(@F)$(BUILD_CONTAINER_SUFFIX) -f $< $(<D)
@if [ ! -z $${PUSH+x} ]; then \
- $(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \
+ $(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F)$(BUILD_CONTAINER_SUFFIX); \
fi
.PHONY: all clean
diff --git a/automation/gitlab-ci/containers.yaml b/automation/gitlab-ci/containers.yaml
new file mode 100644
index 0000000000..ace93eaccf
--- /dev/null
+++ b/automation/gitlab-ci/containers.yaml
@@ -0,0 +1,25 @@
+.container-build-tmpl:
+ stage: containers
+ image: docker:stable
+ tags:
+ - container-builder
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"
+ changes:
+ - automation/build/${BUILD_CONTAINER}.dockerfile
+ services:
+ - docker:dind
+ before_script:
+ - apk add make
+ - docker info
+ - docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
+ script:
+ - make -C automation/build ${BUILD_CONTAINER} PUSH=1 BUILD_CONTAINER_SUFFIX=-test
+ after_script:
+ - docker logout
+
+debian-unstable-container:
+ extends:
+ - .container-build-tmpl
+ variables:
+ BUILD_CONTAINER: debian/unstable
--
Anthony PERARD
next prev parent reply other threads:[~2023-03-02 17:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 17:53 [RFC XEN PATCH 0/7] automation, RFC prototype, Have GitLab CI built its own containers Anthony PERARD
2023-03-02 17:53 ` Anthony PERARD [this message]
2023-03-02 17:53 ` [RFC XEN PATCH 2/7] automation: Introduce test-containers stage Anthony PERARD
2023-03-02 17:53 ` [RFC XEN PATCH 3/7] automation: Add a template per container for build jobs Anthony PERARD
2023-03-02 17:53 ` [RFC XEN PATCH 4/7] automation: Adding containers build jobs and test of thoses Anthony PERARD
2023-03-02 17:53 ` [RFC XEN PATCH 5/7] automation: Introduce DO_REBUILD_CONTAINER, to allow to rebuild a container Anthony PERARD
2023-03-02 17:53 ` [RFC XEN PATCH 6/7] automation: Push container been tested Anthony PERARD
2023-03-02 17:53 ` [RFC XEN PATCH 7/7] automation: Add some more push containers jobs Anthony PERARD
2023-03-03 2:48 ` [RFC XEN PATCH 0/7] automation, RFC prototype, Have GitLab CI built its own containers Stefano Stabellini
2023-03-03 17:24 ` Anthony PERARD
2023-03-03 20:27 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230302175332.56052-2-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=cardoe@cardoe.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.