Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • prosper/gitlab-ci-cd
1 result
Show changes
Commits on Source (12)
......@@ -3,15 +3,16 @@ stages:
- release
- build
image: griefed/gitlab-ci-cd:2.0.0
services:
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
test docker:
stage: test
image: griefed/gitlab-ci-cd:1.0.4
services:
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
......@@ -29,18 +30,11 @@ test docker:
refs:
- tags
variables:
- $CI_COMMIT_TITLE =~ /^RELEASE:.+$/
- '$CI_COMMIT_TITLE =~ /^RELEASE:.+$/ || $CI_PIPELINE_SOURCE == "schedule"'
release:
needs: ['test docker']
stage: release
image: griefed/gitlab-ci-cd:1.0.4
services:
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
script:
- npx semantic-release
only:
......@@ -49,17 +43,10 @@ release:
refs:
- tags
variables:
- $CI_COMMIT_TITLE =~ /^RELEASE:.+$/
- '$CI_COMMIT_TITLE =~ /^RELEASE:.+$/ || $CI_PIPELINE_SOURCE == "schedule"'
build:
stage: build
image: griefed/gitlab-ci-cd:1.0.4
services:
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
......@@ -77,3 +64,110 @@ build:
--tag "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest" .
only:
- tags
Check Packages:on-schedule:
only:
- schedules
before_script:
- |-
echo "Preparing package versions comparison."
# Check and, if necessary, update git user and mail
if [[ "$(git config --list | grep user.name)" != "user.name=$GIT_USER" ]];then
git config --global user.name $GIT_USER
fi
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
rm -rf /tmp/$CI_PROJECT_PATH
mkdir -p /tmp/$CI_PROJECT_PATH
echo "Preparations complete."
script:
- |-
echo "Comparing package versions." && \
# 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."
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
echo "Checksums differ. Updating..." && \
# 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.' && \
# 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:
- |-
echo "Cleaning up."
docker image rm -f $DOCKERHUB_USER/$DOCKERHUB_REPO:latest
docker image rm -f $DOCKERHUB_REPO
rm -rf /tmp/$CI_PROJECT_PATH
echo "Done."
### [2.0.1](https://git.griefed.de/prosper/gitlab-ci-cd/compare/2.0.0...2.0.1) (2022-02-07)
### 🦊 CI/CD
* Update installed packages. ([2604ef8](https://git.griefed.de/prosper/gitlab-ci-cd/commit/2604ef878d676bd0182134d03411e5a94e93d58f))
* Check packages for updates and trigger pack release when new packages are available. Move services, image and variables to global. ([0cbce82](https://git.griefed.de/prosper/gitlab-ci-cd/commit/0cbce82ad03dfc084d65de37efaea90ee27e55e2))
* Correctly checkout repository ([ecbc1f1](https://git.griefed.de/prosper/gitlab-ci-cd/commit/ecbc1f1d66d924a6aa15c7607e6a632036adb4ca))
* Rework package versions job ([cfe6910](https://git.griefed.de/prosper/gitlab-ci-cd/commit/cfe6910367f1e5b488ef18b214bcc0545d1a9e7c))
### Other
* Add list of package versions. ([0a95e49](https://git.griefed.de/prosper/gitlab-ci-cd/commit/0a95e4922ffaa1f62240bd0744e5110b11756d5d))
* **deps:** update griefed/gitlab-ci-cd docker tag to v1.1.0 ([a120e43](https://git.griefed.de/prosper/gitlab-ci-cd/commit/a120e43607840f7e84d228ab9042b4ecc7488999))
* **deps:** update griefed/gitlab-ci-cd docker tag to v2 ([5cc3cc6](https://git.griefed.de/prosper/gitlab-ci-cd/commit/5cc3cc6cbd348fe77d817f6b484b6d6539f087ba))
## [2.0.0](https://git.griefed.de/prosper/gitlab-ci-cd/compare/1.1.0...2.0.0) (2022-01-23)
## [1.1.0](https://git.griefed.de/prosper/gitlab-ci-cd/compare/1.0.4...1.1.0) (2022-01-21)
......
alpine-baselayout-3.2.0-r18
alpine-keys-2.4-r1
alsa-lib-1.2.5.1-r1
apk-tools-2.12.7-r3
bash-5.1.8-r0
brotli-libs-1.0.9-r5
btrfs-progs-5.15.1-r0
busybox-1.34.1-r4
c-ares-1.18.1-r0
ca-certificates-20211220-r0
ca-certificates-bundle-20211220-r0
curl-7.80.0-r0
e2fsprogs-1.46.4-r0
e2fsprogs-extra-1.46.4-r0
e2fsprogs-libs-1.46.4-r0
encodings-1.0.5-r0
eudev-libs-3.2.11_pre1-r0
expat-2.4.4-r0
fontconfig-2.13.1-r4
freetype-2.11.0-r0
giflib-5.2.1-r0
git-2.34.1-r0
icu-libs-69.1-r1
inih-53-r1
ip6tables-1.8.7-r1
iptables-1.8.7-r1
java-cacerts-1.0-r1
java-common-0.4-r0
jq-1.6-r1
keyutils-libs-1.6.3-r0
krb5-conf-1.0-r2
krb5-libs-1.19.2-r4
lcms2-2.12-r1
libblkid-2.37.3-r0
libbsd-0.11.3-r1
libbz2-1.0.8-r1
libc-utils-0.7.2-r3
libc6-compat-1.2.2-r7
libcom_err-1.46.4-r0
libcrypto1.1-1.1.1l-r8
libcurl-7.80.0-r0
libedit-20210910.3.1-r0
libffi-3.4.2-r1
libfontenc-1.1.4-r0
libgcc-10.3.1_git20211027-r0
libintl-0.21-r0
libjpeg-turbo-2.1.2-r0
liblksctp-1.0.19-r0
libmd-1.0.3-r0
libmnl-1.0.4-r2
libnftnl-1.2.1-r0
libpng-1.6.37-r1
libretls-3.3.4-r2
libssl1.1-1.1.1l-r8
libstdc++-10.3.1_git20211027-r0
libtasn1-4.18.0-r0
libtirpc-1.3.2-r0
libtirpc-conf-1.3.2-r0
libuuid-2.37.3-r0
libuv-1.42.0-r0
libverto-0.3.2-r0
libx11-1.7.2-r0
libxau-1.0.9-r0
libxcb-1.14-r2
libxcomposite-0.4.5-r0
libxdmcp-1.1.3-r0
libxext-1.3.4-r0
libxi-1.8-r0
libxrender-0.9.10-r3
libxtst-1.2.3-r3
lzo-2.10-r2
mkfontscale-1.2.1-r1
musl-1.2.2-r7
musl-utils-1.2.2-r7
ncurses-libs-6.3_p20211120-r0
ncurses-terminfo-base-6.3_p20211120-r0
nghttp2-libs-1.46.0-r0
nodejs-current-17.3.1-r0
npm-8.1.3-r0
nspr-4.32-r0
nss-3.72.1-r0
oniguruma-6.9.7.1-r0
openjdk8-8.302.08-r2
openjdk8-jre-8.302.08-r2
openjdk8-jre-base-8.302.08-r2
openjdk8-jre-lib-8.302.08-r2
openssh-client-common-8.8_p1-r1
openssh-client-default-8.8_p1-r1
openssh-keygen-8.8_p1-r1
openssl-1.1.1l-r8
p11-kit-0.24.0-r1
p11-kit-trust-0.24.0-r1
pcre2-10.39-r0
pcsc-lite-libs-1.9.4-r0
pigz-2.6-r0
readline-8.1.1-r0
scanelf-1.3.3-r0
shadow-uidmap-4.8.1-r1
sqlite-libs-3.36.0-r0
ssl_client-1.34.1-r4
ttf-dejavu-2.37-r1
xfsprogs-5.13.0-r0
xz-5.2.5-r0
xz-libs-5.2.5-r0
zfs-2.1.2-r0
zfs-libs-2.1.2-r0
zlib-1.2.11-r3
zstd-libs-1.5.0-r0