264
.gitlab-ci.yml
264
.gitlab-ci.yml
@ -5,7 +5,7 @@ include:
|
|||||||
ref: development
|
ref: development
|
||||||
file:
|
file:
|
||||||
- .gitlab-ci_common.yaml
|
- .gitlab-ci_common.yaml
|
||||||
- type/docker-image.gitlab-ci.yaml
|
- template/docker-image.gitlab-ci.yaml
|
||||||
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
@ -32,153 +32,153 @@ variables:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
.build_docker_container:
|
# .build_docker_container:
|
||||||
stage: build
|
# stage: build
|
||||||
image: nofusscomputing/docker-buildx-qemu:dev
|
# image: nofusscomputing/docker-buildx-qemu:dev
|
||||||
services:
|
# services:
|
||||||
- name: docker:23-dind
|
# - name: docker:23-dind
|
||||||
entrypoint: ["env", "-u", "DOCKER_HOST"]
|
# entrypoint: ["env", "-u", "DOCKER_HOST"]
|
||||||
command: ["dockerd-entrypoint.sh"]
|
# command: ["dockerd-entrypoint.sh"]
|
||||||
variables:
|
# variables:
|
||||||
DOCKER_HOST: tcp://docker:2375/
|
# DOCKER_HOST: tcp://docker:2375/
|
||||||
DOCKER_DRIVER: overlay2
|
# DOCKER_DRIVER: overlay2
|
||||||
DOCKER_DOCKERFILE: Dockerfile
|
# DOCKER_DOCKERFILE: Dockerfile
|
||||||
# See https://github.com/docker-library/docker/pull/166
|
# # See https://github.com/docker-library/docker/pull/166
|
||||||
DOCKER_TLS_CERTDIR: ""
|
# DOCKER_TLS_CERTDIR: ""
|
||||||
before_script:
|
# before_script:
|
||||||
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi
|
# - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi
|
||||||
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
|
# - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
|
||||||
|
|
||||||
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
# - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
|
|
||||||
- docker info
|
# - docker info
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
#- pip3 install -r gitlab-ci/gitlab_release/requirements.txt
|
# #- pip3 install -r gitlab-ci/gitlab_release/requirements.txt
|
||||||
- pip3 install setuptools wheel
|
# - pip3 install setuptools wheel
|
||||||
- pip install -r $ROOT_DIR/conventional_commits/requirements.txt
|
# - pip install -r $ROOT_DIR/conventional_commits/requirements.txt
|
||||||
- pip3 install gitlab-ci/gitlab_release/python-module/cz_nfc/.
|
# - pip3 install gitlab-ci/gitlab_release/python-module/cz_nfc/.
|
||||||
|
|
||||||
|
|
||||||
# - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
# # - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
||||||
- update-binfmts --display
|
# - update-binfmts --display
|
||||||
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
|
|
||||||
#- docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use
|
|
||||||
- docker buildx create --driver=docker-container --use
|
|
||||||
- docker buildx inspect --bootstrap
|
|
||||||
# - ls -la /var/cache/ldconfig && rm -f /var/cache/ldconfig/aux-cache
|
|
||||||
# - /sbin/ldconfig && ls -la /var/cache/ldconfig
|
|
||||||
# - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
|
||||||
# - apt update
|
|
||||||
#- apt list --installed
|
|
||||||
|
|
||||||
#- apt remove -y qemu-user-static
|
|
||||||
#- apt list --installed
|
|
||||||
|
|
||||||
# - apt remove -y qemu-user-static
|
|
||||||
# - rm -f /var/cache/ldconfig/aux-cache
|
|
||||||
# - /sbin/ldconfig
|
|
||||||
# #- cp $(which qemu-aarch64-static) /usr/bin/qemu-aarch64 does nothing
|
|
||||||
# - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
|
||||||
# - update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
|
# - update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
|
||||||
#- docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use
|
# #- docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use
|
||||||
|
|
||||||
# - ls -la /var/cache/ldconfig && rm -f /var/cache/ldconfig/aux-cache
|
|
||||||
# - /sbin/ldconfig && ls -la /var/cache/ldconfig
|
|
||||||
# - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
|
||||||
# - apt update
|
|
||||||
# - apt list --installed
|
|
||||||
# - apt install -y qemu-user-static=1:7.2+dfsg-7~bpo11+1
|
|
||||||
# - apt remove -y qemu-user-static
|
|
||||||
|
|
||||||
# - update-binfmts --display
|
|
||||||
# - apt list --installed
|
|
||||||
# - curl https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh -o /qemu-binfmt-conf.sh
|
|
||||||
# - chmod +x /qemu-binfmt-conf.sh
|
|
||||||
# - mkdir -p /tester
|
|
||||||
# - /qemu-binfmt-conf.sh --exportdir /tester --debian --qemu-path /usr/bin
|
|
||||||
# - update-binfmts --importdir=/tester --import
|
|
||||||
# - update-binfmts --enable
|
|
||||||
#- update-binfmts --display
|
|
||||||
# - docker buildx create --driver=docker-container --use
|
# - docker buildx create --driver=docker-container --use
|
||||||
# - docker buildx inspect --bootstrap
|
# - docker buildx inspect --bootstrap
|
||||||
# - apt list --installed
|
# # - ls -la /var/cache/ldconfig && rm -f /var/cache/ldconfig/aux-cache
|
||||||
# - apt remove -y qemu-user-static
|
# # - /sbin/ldconfig && ls -la /var/cache/ldconfig
|
||||||
# - curl https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh -o /qemu-binfmt-conf.sh
|
# # - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
||||||
# - chmod +x /qemu-binfmt-conf.sh
|
# # - apt update
|
||||||
# - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
# #- apt list --installed
|
||||||
# - apt update
|
|
||||||
# - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
# #- apt remove -y qemu-user-static
|
||||||
# - mkdir -p /tester
|
# #- apt list --installed
|
||||||
# - /qemu-binfmt-conf.sh --exportdir /tester --debian --qemu-path /usr/bin
|
|
||||||
# - update-binfmts --importdir=/tester --import
|
# # - apt remove -y qemu-user-static
|
||||||
# - update-binfmts --enable
|
# # - rm -f /var/cache/ldconfig/aux-cache
|
||||||
|
# # - /sbin/ldconfig
|
||||||
|
# # #- cp $(which qemu-aarch64-static) /usr/bin/qemu-aarch64 does nothing
|
||||||
|
# # - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
||||||
|
# # - update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
|
||||||
|
# #- docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use
|
||||||
|
|
||||||
|
# # - ls -la /var/cache/ldconfig && rm -f /var/cache/ldconfig/aux-cache
|
||||||
|
# # - /sbin/ldconfig && ls -la /var/cache/ldconfig
|
||||||
|
# # - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
||||||
|
# # - apt update
|
||||||
|
# # - apt list --installed
|
||||||
|
# # - apt install -y qemu-user-static=1:7.2+dfsg-7~bpo11+1
|
||||||
|
# # - apt remove -y qemu-user-static
|
||||||
|
|
||||||
|
# # - update-binfmts --display
|
||||||
|
# # - apt list --installed
|
||||||
|
# # - curl https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh -o /qemu-binfmt-conf.sh
|
||||||
|
# # - chmod +x /qemu-binfmt-conf.sh
|
||||||
|
# # - mkdir -p /tester
|
||||||
|
# # - /qemu-binfmt-conf.sh --exportdir /tester --debian --qemu-path /usr/bin
|
||||||
|
# # - update-binfmts --importdir=/tester --import
|
||||||
|
# # - update-binfmts --enable
|
||||||
|
# #- update-binfmts --display
|
||||||
|
# # - docker buildx create --driver=docker-container --use
|
||||||
|
# # - docker buildx inspect --bootstrap
|
||||||
|
# # - apt list --installed
|
||||||
|
# # - apt remove -y qemu-user-static
|
||||||
|
# # - curl https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh -o /qemu-binfmt-conf.sh
|
||||||
|
# # - chmod +x /qemu-binfmt-conf.sh
|
||||||
|
# # - add-apt-repository "deb http://deb.debian.org/debian bullseye-backports main"
|
||||||
|
# # - apt update
|
||||||
|
# # - apt install -y qemu-user=1:7.2+dfsg-7~bpo11+1
|
||||||
|
# # - mkdir -p /tester
|
||||||
|
# # - /qemu-binfmt-conf.sh --exportdir /tester --debian --qemu-path /usr/bin
|
||||||
|
# # - update-binfmts --importdir=/tester --import
|
||||||
|
# # - update-binfmts --enable
|
||||||
|
# # - update-binfmts --display
|
||||||
|
|
||||||
|
# #- update-binfmts --enable
|
||||||
|
|
||||||
|
|
||||||
|
# # --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \
|
||||||
|
# # --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \
|
||||||
|
# script:
|
||||||
|
# #- update-binfmts --enable
|
||||||
# - update-binfmts --display
|
# - update-binfmts --display
|
||||||
|
# - |
|
||||||
|
|
||||||
#- update-binfmts --enable
|
# if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then
|
||||||
|
|
||||||
|
# echo "[DEBUG] building multiarch/specified arch image";
|
||||||
|
|
||||||
|
# docker buildx build --platform=$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS . \
|
||||||
|
# --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
||||||
|
# --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
||||||
|
# --label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
||||||
|
# --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
||||||
|
# --push \
|
||||||
|
# --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \
|
||||||
|
# --file $DOCKER_DOCKERFILE \
|
||||||
|
# --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
|
# docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
|
# # during docker multi platform build there are >=3 additional unknown images added to gitlab container registry. cleanup
|
||||||
|
|
||||||
|
# DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}");
|
||||||
|
|
||||||
|
# docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
|
# docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
# echo "[DEBUG] building image";
|
||||||
|
|
||||||
|
# docker build . \
|
||||||
|
# --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
||||||
|
# --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
||||||
|
# --label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
||||||
# --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \
|
# --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \
|
||||||
# --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \
|
# --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \
|
||||||
script:
|
# --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
||||||
#- update-binfmts --enable
|
# --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \
|
||||||
- update-binfmts --display
|
# --file $DOCKER_DOCKERFILE \
|
||||||
- |
|
# --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then
|
# docker push $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
||||||
|
|
||||||
echo "[DEBUG] building multiarch/specified arch image";
|
# fi
|
||||||
|
# rules:
|
||||||
docker buildx build --platform=$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS . \
|
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
--label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
# when: never
|
||||||
--label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
# - if: $CI_COMMIT_TAG
|
||||||
--label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
# when: on_success
|
||||||
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
# - if: '$CI_COMMIT_BRANCH == "development"'
|
||||||
--push \
|
# when: on_success
|
||||||
--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \
|
# - if: '$CI_COMMIT_BRANCH != "master"'
|
||||||
--file $DOCKER_DOCKERFILE \
|
# when: always
|
||||||
--tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
# - when: never
|
||||||
|
|
||||||
docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
||||||
|
|
||||||
# during docker multi platform build there are >=3 additional unknown images added to gitlab container registry. cleanup
|
|
||||||
|
|
||||||
DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}");
|
|
||||||
|
|
||||||
docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
||||||
|
|
||||||
docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "[DEBUG] building image";
|
|
||||||
|
|
||||||
docker build . \
|
|
||||||
--label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
|
||||||
--label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
|
||||||
--label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
|
||||||
--label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \
|
|
||||||
--label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \
|
|
||||||
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
|
||||||
--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \
|
|
||||||
--file $DOCKER_DOCKERFILE \
|
|
||||||
--tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
||||||
|
|
||||||
docker push $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
||||||
|
|
||||||
fi
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
||||||
when: never
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
when: on_success
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
|
||||||
when: on_success
|
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
|
||||||
when: always
|
|
||||||
- when: never
|
|
||||||
|
|
||||||
|
|
||||||
Docker Container:
|
# Docker Container:
|
||||||
extends: .build_docker_container
|
# extends: .build_docker_container
|
||||||
|
|
||||||
|
|
||||||
|
Submodule gitlab-ci updated: 18a2808787...588956b27e
Reference in New Issue
Block a user