mirror of
https://gitlab.archlinux.org/archlinux/archlinux-docker.git
synced 2025-08-07 14:47:14 +02:00
Refactor to use BUILD_VERSION instead of BUILD_DATE
This commit is contained in:
parent
b0ecf075d4
commit
d6d626619e
120
.gitlab-ci.yml
120
.gitlab-ci.yml
@ -18,7 +18,7 @@ lint:
|
|||||||
.rootfs:
|
.rootfs:
|
||||||
stage: rootfs
|
stage: rootfs
|
||||||
before_script:
|
before_script:
|
||||||
- echo "BUILD_DATE=$(date +%Y%m%d).$CI_JOB_ID" > build.env
|
- echo "BUILD_VERSION=$(date +%Y%m%d).$CI_JOB_ID" > build.env
|
||||||
- pacman -Syu --noconfirm make devtools fakechroot fakeroot
|
- pacman -Syu --noconfirm make devtools fakechroot fakeroot
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
@ -117,7 +117,7 @@ image:base:secure:
|
|||||||
--whitelist-var-run="false"
|
--whitelist-var-run="false"
|
||||||
--context $CI_PROJECT_DIR/output
|
--context $CI_PROJECT_DIR/output
|
||||||
--dockerfile $CI_PROJECT_DIR/output/Dockerfile.base
|
--dockerfile $CI_PROJECT_DIR/output/Dockerfile.base
|
||||||
--destination $CI_REGISTRY_IMAGE:base-$CI_COMMIT_REF_SLUG
|
--destination $CI_REGISTRY_IMAGE:base
|
||||||
|
|
||||||
image:base-devel:secure:
|
image:base-devel:secure:
|
||||||
extends: .image
|
extends: .image
|
||||||
@ -133,31 +133,49 @@ image:base-devel:secure:
|
|||||||
--whitelist-var-run="false"
|
--whitelist-var-run="false"
|
||||||
--context $CI_PROJECT_DIR/output
|
--context $CI_PROJECT_DIR/output
|
||||||
--dockerfile $CI_PROJECT_DIR/output/Dockerfile.base-devel
|
--dockerfile $CI_PROJECT_DIR/output/Dockerfile.base-devel
|
||||||
--destination $CI_REGISTRY_IMAGE:base-devel-$CI_COMMIT_REF_SLUG
|
--destination $CI_REGISTRY_IMAGE:base-devel
|
||||||
|
|
||||||
|
.test:
|
||||||
|
script:
|
||||||
|
- pacman -Sy
|
||||||
|
- pacman -Qqk
|
||||||
|
- pacman -Syu --noconfirm docker grep
|
||||||
|
- docker -v
|
||||||
|
- id -u http
|
||||||
|
- locale | grep -q UTF-8
|
||||||
|
|
||||||
test:base:
|
test:base:
|
||||||
|
extends: .test
|
||||||
stage: test
|
stage: test
|
||||||
image: $CI_REGISTRY_IMAGE:base-$CI_COMMIT_REF_SLUG
|
image: $CI_REGISTRY_IMAGE:base-$CI_COMMIT_REF_SLUG
|
||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
|
||||||
- pacman -Sy
|
|
||||||
- pacman -Qqk
|
|
||||||
- pacman -Syu --noconfirm docker grep
|
|
||||||
- docker -v
|
|
||||||
- id -u http
|
|
||||||
- locale | grep -q UTF-8
|
|
||||||
|
|
||||||
test:base-devel:
|
test:base-devel:
|
||||||
|
extends: .test
|
||||||
stage: test
|
stage: test
|
||||||
image: $CI_REGISTRY_IMAGE:base-devel-$CI_COMMIT_REF_SLUG
|
image: $CI_REGISTRY_IMAGE:base-devel-$CI_COMMIT_REF_SLUG
|
||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
after_script:
|
||||||
- pacman -Sy
|
- gcc -v
|
||||||
- pacman -Qqk
|
- g++ -v
|
||||||
- pacman -Syu --noconfirm docker grep
|
- make -v
|
||||||
- docker -v
|
|
||||||
- id -u http
|
test:base:secure:
|
||||||
- locale | grep -q UTF-8
|
extends: .test
|
||||||
|
stage: test
|
||||||
|
tags:
|
||||||
|
- secure
|
||||||
|
image: $CI_REGISTRY_IMAGE:base
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
|
test:base-devel:secure:
|
||||||
|
extends: .test
|
||||||
|
stage: test
|
||||||
|
tags:
|
||||||
|
- secure
|
||||||
|
image: $CI_REGISTRY_IMAGE:base-devel
|
||||||
|
dependencies: []
|
||||||
|
after_script:
|
||||||
- gcc -v
|
- gcc -v
|
||||||
- g++ -v
|
- g++ -v
|
||||||
- make -v
|
- make -v
|
||||||
@ -176,52 +194,28 @@ release:
|
|||||||
script:
|
script:
|
||||||
- python ci/release.py
|
- python ci/release.py
|
||||||
|
|
||||||
# Publish base to the Arch Linux group namespace: https://hub.docker.com/r/archlinux/archlinux:base
|
# Publish base to the Arch Linux group namespace: https://hub.docker.com/r/archlinux/archlinux
|
||||||
# publish:org:base:
|
publish:base:
|
||||||
# stage: publish
|
stage: publish
|
||||||
# image:
|
tags:
|
||||||
# name: gcr.io/go-containerregistry/crane:debug
|
- secure
|
||||||
# entrypoint: [""]
|
image:
|
||||||
# needs:
|
name: gcr.io/go-containerregistry/crane:debug
|
||||||
# - job: "test:base"
|
entrypoint: [""]
|
||||||
# artifacts: true
|
variables:
|
||||||
# tags:
|
GIT_STRATEGY: none
|
||||||
# - secure
|
before_script:
|
||||||
# variables:
|
- echo $CI_REGISTRY_PASSWORD | crane auth login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
|
||||||
# GIT_STRATEGY: none
|
- cat $DOCKER_ACCESS_TOKEN | crane auth login -u $DOCKER_USERNAME --password-stdin index.docker.io
|
||||||
# before_script:
|
script:
|
||||||
# - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
- crane cp $CI_REGISTRY_IMAGE:base archlinux/archlinux:base
|
||||||
# - crane auth login -u $SOME_TECHNICAL_DOCKER_HUB_USER -p $SOME_TECHNICAL_DOCKER_HUB_PASSWORD archlinux/archlinux
|
- crane tag archlinux/archlinux:base latest
|
||||||
# script:
|
- crane tag archlinux/archlinux:base base-$BUILD_VERSION
|
||||||
# - crane cp $CI_REGISTRY_IMAGE:base-$CI_COMMIT_REF_SLUG archlinux/archlinux:base
|
- crane cp $CI_REGISTRY_IMAGE:base-devel archlinux/archlinux:base-devel
|
||||||
# - crane tag archlinux/archlinux:base latest
|
- crane tag archlinux/archlinux:base-devel base-devel-$BUILD_VERSION
|
||||||
# - crane tag archlinux/archlinux:base base-$BUILD_DATE
|
only:
|
||||||
# only:
|
variables:
|
||||||
# variables:
|
- $SCHEDULED_PUBLISH == "TRUE"
|
||||||
# - $SCHEDULED_PUBLISH == "TRUE"
|
|
||||||
|
|
||||||
# Publish base-devel to the Arch Linux group namespace: https://hub.docker.com/r/archlinux/archlinux:base-devel
|
|
||||||
# publish:org:base-devel:
|
|
||||||
# stage: publish
|
|
||||||
# image:
|
|
||||||
# name: gcr.io/go-containerregistry/crane:debug
|
|
||||||
# entrypoint: [""]
|
|
||||||
# needs:
|
|
||||||
# - job: "test:base-devel"
|
|
||||||
# artifacts: true
|
|
||||||
# tags:
|
|
||||||
# - secure
|
|
||||||
# variables:
|
|
||||||
# GIT_STRATEGY: none
|
|
||||||
# before_script:
|
|
||||||
# - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
||||||
# - crane auth login -u $SOME_TECHNICAL_DOCKER_HUB_USER -p $SOME_TECHNICAL_DOCKER_HUB_PASSWORD archlinux/archlinux
|
|
||||||
# script:
|
|
||||||
# - crane cp $CI_REGISTRY_IMAGE:base-devel-$CI_COMMIT_REF_SLUG archlinux/archlinux:base-devel
|
|
||||||
# - crane tag archlinux/archlinux:base-devel base-devel-$BUILD_DATE
|
|
||||||
# only:
|
|
||||||
# variables:
|
|
||||||
# - $SCHEDULED_PUBLISH == "TRUE"
|
|
||||||
|
|
||||||
# Publish to the official Docker namespace: https://hub.docker.com/_/archlinux
|
# Publish to the official Docker namespace: https://hub.docker.com/_/archlinux
|
||||||
# publish:official:
|
# publish:official:
|
||||||
|
@ -5,7 +5,7 @@ Should only be called from GitLab CI!
|
|||||||
|
|
||||||
Required env vars:
|
Required env vars:
|
||||||
- GITLAB_PROJECT_TOKEN
|
- GITLAB_PROJECT_TOKEN
|
||||||
- BUILD_DATE
|
- BUILD_VERSION
|
||||||
- CI_PROJECT_ID
|
- CI_PROJECT_ID
|
||||||
- CI_PROJECT_URL
|
- CI_PROJECT_URL
|
||||||
"""
|
"""
|
||||||
@ -16,14 +16,14 @@ from pathlib import Path
|
|||||||
import gitlab
|
import gitlab
|
||||||
|
|
||||||
token = os.environ['GITLAB_PROJECT_TOKEN']
|
token = os.environ['GITLAB_PROJECT_TOKEN']
|
||||||
build_date = os.environ['BUILD_DATE']
|
build_version = os.environ['BUILD_VERSION']
|
||||||
project_id = os.environ['CI_PROJECT_ID']
|
project_id = os.environ['CI_PROJECT_ID']
|
||||||
project_url = os.environ['CI_PROJECT_URL']
|
project_url = os.environ['CI_PROJECT_URL']
|
||||||
|
|
||||||
|
|
||||||
def upload(name):
|
def upload(name):
|
||||||
print(f"Uploading {name}.tar.xz")
|
print(f"Uploading {name}.tar.xz")
|
||||||
filename = f"{name}-{build_date}.tar.xz"
|
filename = f"{name}-{build_version}.tar.xz"
|
||||||
uploaded_url = project.upload(
|
uploaded_url = project.upload(
|
||||||
filename, filepath=f"output/{name}.tar.xz"
|
filename, filepath=f"output/{name}.tar.xz"
|
||||||
)["url"]
|
)["url"]
|
||||||
@ -49,7 +49,7 @@ if __name__ == "__main__":
|
|||||||
print("Templating Dockerfiles")
|
print("Templating Dockerfiles")
|
||||||
data = {
|
data = {
|
||||||
"branch": "add-base-devel-tags",
|
"branch": "add-base-devel-tags",
|
||||||
"commit_message": f"Release {build_date}",
|
"commit_message": f"Release {build_version}",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"action": "update",
|
"action": "update",
|
||||||
@ -68,9 +68,9 @@ if __name__ == "__main__":
|
|||||||
print("Creating release")
|
print("Creating release")
|
||||||
release = project.releases.create(
|
release = project.releases.create(
|
||||||
{
|
{
|
||||||
"name": f"Release {build_date}",
|
"name": f"Release {build_version}",
|
||||||
"tag_name": build_date,
|
"tag_name": build_version,
|
||||||
"description": f"Release {build_date}",
|
"description": f"Release {build_version}",
|
||||||
"ref": "add-base-devel-tags",
|
"ref": "add-base-devel-tags",
|
||||||
"assets": {
|
"assets": {
|
||||||
"links": [
|
"links": [
|
||||||
|
Loading…
Reference in New Issue
Block a user