From: Yann Dirson Date: Tue, 12 Dec 2023 16:21:32 +0000 (+0100) Subject: ci/deb: publish APT repository as a gitlab "generic package" X-Git-Tag: 0.3.0~7^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5bd9a3d442b37ea9d0357fe4170b549fb3b2a7ab;p=xen-guest-agent.git ci/deb: publish APT repository as a gitlab "generic package" This ought to be used as sources.list entry to access the repo, but for some reason `apt-get update` gets HTTP 400 on Packages file, whereas curl fetches it all right. deb [trusted=yes] https://gitlab.com/api/v4/projects/xen-project%252Fxen-guest-agent/packages/generic/deb-amd64/ci/ ./ Signed-off-by: Yann Dirson --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99d47a5..4af8435 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - build - package + - deploy # prevent duplicate pipelines for merge request workflow: @@ -12,6 +13,7 @@ workflow: variables: LINUX_RUSTIMG: "rust:buster" + PKG_ROOT: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" .build-template: stage: build @@ -197,11 +199,16 @@ pkg-deb-amd64: # repository metadata - cd target/release + + # mangle names to avoid chars rejected by the gitlab package registry, + # see https://gitlab.com/gitlab-org/gitlab/-/issues/413517 + - for FILE in *.deb; do mv $FILE $(echo $FILE | tr "~" "-"); done + - apt-ftparchive generate ../../apt-ftparchive.conf - apt-ftparchive release . - -o APT::FTPArchive::Release::Description="xen-guest-agent CI packages" + -o APT::FTPArchive::Release::Description="xen-guest-agent CI packages for ${CI_COMMIT_REF_NAME}" -o APT::FTPArchive::Release::Label="xen-guest-agent-ci" - -o APT::FTPArchive::Release::Suite="ci" + -o APT::FTPArchive::Release::Suite="${CI_COMMIT_REF_NAME}" > Release.part - mv Release.part Release artifacts: @@ -210,6 +217,27 @@ pkg-deb-amd64: - target/release/*Release* - target/release/Packages* - target/release/Contents-* + reports: + # propagates variables into the pipeline level + dotenv: version.env + +# The artifact repo does not seem to work well as an APT source, APT +# gets HTP 400 on Packages for some reason, so deploy it to a package +# repository instead. +deploy-deb-amd64: + stage: deploy + needs: + - pkg-deb-amd64 + image: "curlimages/curl:latest" + script: + - cd target/release + - for FILE in *; do + - echo "uploading '$FILE'" + - > + curl --header "JOB-TOKEN: $CI_JOB_TOKEN" + --upload-file "$FILE" + "${PKG_ROOT}/deb-amd64/${CI_COMMIT_REF_NAME}/${FILE}" + - done pkg-rpm-x86_64: stage: package diff --git a/CHANGELOG.md b/CHANGELOG.md index 61ce9ff..056248d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/) * executables and packages for supported guest platforms (currently Linux/Glibc and FreeBSD, both for x86_64 guests) are now available from Gitlab CI pipelines +* APT repositories (though not signed) are now available from Gitlab + CI pipelines * CI pipelines now testbuild every commit in a merge request ## 0.2.0 - 2023-10-11