From 1c98f26ae56c7b6a1e3528ae184816991e974cf2 Mon Sep 17 00:00:00 2001 From: Griefed <griefed@griefed.de> Date: Wed, 27 Jul 2022 11:03:18 +0200 Subject: [PATCH] no message --- .gitlab-ci.yml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73955ea..13ad7b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,8 @@ stages: - release - build -image: griefed/gitlab-ci-cd:2.0.8 - services: - - name: docker:dind + - name: ghcr.io/griefed/gitlab-ci-cd:2.0.8 alias: docker variables: @@ -23,6 +21,7 @@ workflow: test docker: stage: test + image: ghcr.io/griefed/gitlab-ci-cd:2.0.8 before_script: - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY @@ -57,6 +56,7 @@ release: build: stage: build + image: ghcr.io/griefed/gitlab-ci-cd:2.0.8 before_script: - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY @@ -88,7 +88,7 @@ Check Packages:on-schedule: if [[ "$(git config --list | grep user.email)" != "user.email=$GIT_MAIL" ]];then git config --global user.email $GIT_MAIL fi - + # Clean system of potentially interrupting images docker image rm -f $DOCKERHUB_USER/$DOCKERHUB_REPO:latest docker image rm -f $DOCKERHUB_REPO @@ -101,51 +101,51 @@ Check Packages:on-schedule: # Clone the repository git clone $CI_PROJECT_URL.git /tmp/$CI_PROJECT_PATH && \ cd /tmp/$CI_PROJECT_PATH && \ - + if [ ! -s "package_versions.txt" ];then echo "No package_versions.txt available..." && \ - + # Gather package information from latest build docker run --rm --entrypoint /bin/sh -v /tmp/$CI_PROJECT_PATH:/tmp $DOCKERHUB_USER/$DOCKERHUB_REPO:latest -c '\ apk info -v > /tmp/package_versions.txt && \ sort -o /tmp/package_versions.txt /tmp/package_versions.txt && \ chmod 777 /tmp/package_versions.txt' && \ - + # Checkout our branch git checkout -f $CI_DEFAULT_BRANCH && \ - + wait && \ - + # Add and commit new file to repository git add package_versions.txt && \ git commit -m 'chore: Add list of package versions.' && \ - + # Push the changes to the remote git push "https://$GIT_USER:$GITLAB_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git" --all && \ - + # Nice - echo "package_versions.txt added." - + echo "package_versions.txt added." + elif [ -s "package_versions.txt" ];then echo "Local package_versions.txt available..." && \ # Build local image for new package versions list docker build --no-cache --tag $DOCKERHUB_REPO . && \ - + # Get packages from newly build local image docker run --rm --entrypoint /bin/sh -v /tmp/$CI_PROJECT_PATH:/tmp $DOCKERHUB_REPO -c '\ apk info -v > /tmp/package_versions_new.txt && \ sort -o /tmp/package_versions_new.txt /tmp/package_versions_new.txt && \ chmod 777 /tmp/package_versions_new.txt' && \ - + # Get checksum of old packages OLD_CHECKSUM=$(md5sum package_versions.txt | cut -f1 -d" ") && \ - + # Get checksum of new packages NEW_CHECKSUM=$(md5sum package_versions_new.txt | cut -f1 -d" ") - + # If new checksum is not the same as old checksum, we have new versions if [ "${OLD_CHECKSUM}" != "${NEW_CHECKSUM}" ]; then @@ -153,25 +153,25 @@ Check Packages:on-schedule: # Checkout our branch git checkout -f $CI_DEFAULT_BRANCH && \ - + # Copy the new package versions list to repository mv -f package_versions_new.txt package_versions.txt && \ - + wait && \ - + # Add and commit new file to repository git add package_versions.txt && \ - git commit -m 'build: Update installed packages.' && \ - + git commit -m 'build: Update installed packages in Docker container.' && \ + # Push the changes to the remote git push "https://$GIT_USER:$GITLAB_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git" --all && \ - + # Nice echo "Packages updated." else echo "No package updates available." fi - + fi echo "Comparison complete." after_script: -- GitLab