diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a443f5d..081a35e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -173,8 +173,9 @@ release: refs: - schedules variables: - - $SCHEDULED_PUBLISH == "TRUE" + - $PUBLISH_ARCHLINUX_REPOSITORY == "TRUE" before_script: + - apk update - apk add jq curl script: - | @@ -190,7 +191,7 @@ release: sed -i "s|TEMPLATE_ROOTFS_HASH|$(cat output/${group}.tar.xz.SHA256)|" output/Dockerfile.${group} done - > - curl -sSf --request POST + curl -sSf --request POST -o commit-response.json --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" --form "branch=releases" --form "commit_message=Release ${BUILD_VERSION}" @@ -204,6 +205,7 @@ release: --form "actions[][file_path]=.gitlab-ci.yml" --form "actions[][content]=<.gitlab-ci.yml" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits" + - echo "BUILD_COMMIT=$(jq -r '.id' commit-response.json)" >> build.env - | base_url=$(./ci/get-public-download-for-generic-package.sh base-${BUILD_VERSION}.tar.xz) echo "${base_url}" @@ -223,6 +225,9 @@ release: --assets-link "{\"name\":\"base-${BUILD_VERSION}.tar.xz.SHA256\",\"url\":\"${base_sha_url}\"}" \ --assets-link "{\"name\":\"base-devel-${BUILD_VERSION}.tar.xz\",\"url\":\"${base_devel_url}\"}" \ --assets-link "{\"name\":\"base-devel-${BUILD_VERSION}.tar.xz.SHA256\",\"url\":\"${base_devel_sha_url}\"}" + artifacts: + reports: + dotenv: build.env # Publish base to the Arch Linux group namespace: https://hub.docker.com/r/archlinux/archlinux publish: @@ -244,5 +249,44 @@ publish: - crane tag archlinux/archlinux:base-devel-$BUILD_VERSION base-devel # Publish to the official Docker namespace: https://hub.docker.com/_/archlinux -# publish:official: -# TODO No idea right now how we're going to automatically do the official Docker Hub pull request +publish:official: + stage: publish + only: + refs: + - schedules + variables: + - $PUBLISH_OFFICIAL_LIBRARY == "TRUE" + before_script: + - export | grep -q BUILD_VERSION= + - export | grep -q BUILD_COMMIT= + - test -n "$BUILD_VERSION" + - test -n "$BUILD_COMMIT" + - test -n "$GITHUB_TOKEN" + - pacman -Syu --noconfirm github-cli git gettext + - git config --global user.email "github@archlinux.org" + - git config --global user.name "Arch Linux Technical User" + script: + - mkdir official-images + - cd official-images + - git init + - 'git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/archlinux/official-images.git"' + - git fetch --depth=1 https://github.com/docker-library/official-images.git + - git reset --hard FETCH_HEAD + - head="release/${BUILD_VERSION}" + - git checkout -b "$head" + - envsubst < ../docker-library.template > library/archlinux + - git diff + - git add library/archlinux + - maintainers="$(grep \(@ ../docker-library.template | cut -d\( -f2 | cut -d\) -f1 | xargs)" + - test -n "$maintainers" + - 'git commit + -m "archlinux: Release ${BUILD_VERSION}" + -m "This is an automated release [1]." + -m "Maintainers: ${maintainers}" + -m "[1] ${CI_PROJECT_URL}/-/blob/master/.gitlab-ci.yml"' + - git push -u origin "$head" + - gh pr create + --repo docker-library/official-images + --fill + --base master + --head archlinux:"$head" diff --git a/Dockerfile.base b/Dockerfile.base index 9c8d734..f5c349e 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -10,8 +10,8 @@ # allow us to automate the releaes process. FROM archlinux:latest AS verify SHELL ["/bin/bash", "-c"] -RUN ROOTFS="$(curl -OJL --continue-at - -w "%{filename_effective}" https://gitlab.archlinux.org/archlinux/archlinux-docker/-/package_files/97/download)" && \ - sha256sum -c <<< "4e13c9b2c134ff82429f5302b01cf6306bd6e17d71674c0ea2d3e6b078b18c3e base-20201101.0.7847.tar.xz" && \ +RUN ROOTFS="$(curl -OJL --continue-at - -w "%{filename_effective}" https://gitlab.archlinux.org/archlinux/archlinux-docker/-/package_files/101/download)" && \ + sha256sum -c <<< "00da3fffe8db12b03176305862f437c425ff1ed3fcd8d602dee447c9bfb475b6 base-20201101.0.7893.tar.xz" && \ mkdir /rootfs && \ tar -C /rootfs --extract --auto-compress --file "${ROOTFS}" diff --git a/Dockerfile.base-devel b/Dockerfile.base-devel index 65d9e62..94fe27f 100644 --- a/Dockerfile.base-devel +++ b/Dockerfile.base-devel @@ -10,8 +10,8 @@ # allow us to automate the releaes process. FROM archlinux:latest AS verify SHELL ["/bin/bash", "-c"] -RUN ROOTFS="$(curl -OJL --continue-at - -w "%{filename_effective}" https://gitlab.archlinux.org/archlinux/archlinux-docker/-/package_files/99/download)" && \ - sha256sum -c <<< "24f48576919172f05ecc27ea9c3407aec1df32913c91470770568ae9b89461b8 base-devel-20201101.0.7847.tar.xz" && \ +RUN ROOTFS="$(curl -OJL --continue-at - -w "%{filename_effective}" https://gitlab.archlinux.org/archlinux/archlinux-docker/-/package_files/103/download)" && \ + sha256sum -c <<< "236bc84e7b145cc3687b120e2ac91ecc5e38700f6f81420ca1904e41d4997feb base-devel-20201101.0.7893.tar.xz" && \ mkdir /rootfs && \ tar -C /rootfs --extract --auto-compress --file "${ROOTFS}"