From fd4662030342259947a0b2745a4068b79f41dee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Dalleau?= <frederic.dalleau@collabora.com> Date: Wed, 6 Feb 2019 13:45:10 +0000 Subject: [PATCH] Generate an ostree static delta for rollback test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test ostree commit is generated after the successful commit. Removing updatectl, it makes it impossible to mark an update successful. Hence the bootcount will be increased at each boot, eventually causing rollback to the previous deployment. Signed-off-by: Frédéric Dalleau <frederic.dalleau@collabora.com> Make a separate recipe from the test commit Signed-off-by: Frédéric Dalleau <frederic.dalleau@collabora.com> --- Jenkinsfile | 32 ++++++++++++++++++++++++++++ apertis-ostree-rollback-commit.yaml | 33 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 apertis-ostree-rollback-commit.yaml diff --git a/Jenkinsfile b/Jenkinsfile index 133383ee..5b3de0e9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -264,6 +264,37 @@ def buildOStree(architecture, type, board, debosarguments = "", repo = "repo") { --filename ${image_name}.delta""") } +def buildOStreeRollbackDelta(architecture, type, board, debosarguments = "", repo = "repo") { + def image_name = imageName(architecture, type, board, true) + def branch = "${osname}/${release}/${architecture}-${board}/${type}" + def rollback_branch = "${osname}/${release}/${architecture}-${board}/${type}-rollback" + + sh(script: """ + cd ${PIPELINE_VERSION}/${architecture}/${type} + debos ${debosarguments} \ + --show-boot \ + -t architecture:${architecture} \ + -t type:$type \ + -t board:$board \ + -t suite:$release \ + -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \ + -t image:${image_name} \ + -t message:${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \ + -t ostree:${repo} \ + ${WORKSPACE}/${osname}-ostree-rollback-commit.yaml""") + + sh(script: """ + cd ${PIPELINE_VERSION}/${architecture}/${type} + ostree --repo=${repo} static-delta generate \ + --from=${branch} \ + --to=${rollback_branch} \ + --inline \ + --min-fallback-size=1024 \ + --filename ${image_name}_rollback.delta""") +} + + + /** Generate the image name * * To have a single place for image name generation. @@ -321,6 +352,7 @@ def buildOStreeImage(architecture, type, board, debosarguments = "") { stage("${architecture} ${type} ${board} OStree image build") { buildOStree(architecture, type, board, debosarguments, repo) + buildOStreeRollbackDelta(architecture, type, board, debosarguments, repo) sh(script: """ cd ${PIPELINE_VERSION}/${architecture}/${type} diff --git a/apertis-ostree-rollback-commit.yaml b/apertis-ostree-rollback-commit.yaml new file mode 100644 index 00000000..20cdeae0 --- /dev/null +++ b/apertis-ostree-rollback-commit.yaml @@ -0,0 +1,33 @@ +{{ $architecture := or .architecture "amd64" }} +{{ $type := or .type "minimal" }} +{{ $suite := or .suite "18.12" }} +{{ $image := or .image (printf "apertis-ostree-%s-%s-%s" $suite $type $architecture) }} + +{{ $board := or .board "uefi" }} +{{ $repourl := or .repourl "https://images.apertis.org/ostree/repo" }} +{{ $osname := or .osname "apertis" }} +{{ $branch := or .branch (printf "%s/%s/%s-%s/%s-rollback" $osname $suite $architecture $board $type) }} +{{ $ostree := or .ostree "repo" }} + +{{ $cmdline := or .cmdline "console=tty0 console=ttyS0,115200n8 rootwait rw quiet splash plymouth.ignore-serial-consoles" }} + +architecture: {{ $architecture }} + +actions: + - action: ostree-deploy + description: Deploying ostree onto image + repository: {{ $ostree }} + remote_repository: {{ $repourl }} + branch: {{ $branch }} + os: {{ $osname }} + append-kernel-cmdline: {{ $cmdline }} + + - action: run + chroot: false + command: "rm ${ROOTDIR}/usr/bin/updatectl" + + - action: ostree-commit + repository: {{ $ostree }} + branch: {{ $branch }} + subject: {{ $message }} rollback test commit + -- GitLab