Commit a5de5b49 authored by Marcel Huber's avatar Marcel Huber
Browse files

- gitlab variables renamed

- use own registry for images
parent 4a99938a
Pipeline #472 failed with stages
in 30 seconds
image: docker:latest
variables:
MY_IMAGE_NAME: "ArchLinux yaourt build image"
MY_BUILT_IMAGE: "archyaourt:latest"
MY_BUILT_IMAGE: $CI_REGISTRY_IMAGE:archyaourt
MY_DOCKER_IMAGE: marcelhuberfoo/arch-yaourt
MY_DOCKER_FILE: Dockerfile
MY_DOCKER_CONTEXT: .
......@@ -13,13 +15,14 @@ stages:
before_script:
build:
image: docker:latest
stage: build
tags:
- docker
script:
- apk --no-cache --quiet add git
- ./build.sh
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $MY_BUILT_IMAGE
test:
stage: test
......@@ -36,10 +39,12 @@ deploy:
- tags
- triggers
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $MY_BUILT_IMAGE
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
- docker tag ${MY_BUILT_IMAGE} ${MY_DOCKER_IMAGE}:latest
- docker tag ${MY_BUILT_IMAGE} ${MY_DOCKER_IMAGE}:$(docker run --rm --entrypoint /bin/sh $MY_DOCKER_IMAGE -c 'echo -n ${BUILD_TAG}')
- docker push ${MY_DOCKER_IMAGE}:latest
- docker push ${MY_DOCKER_IMAGE}:$(docker run --rm --entrypoint /bin/sh $MY_DOCKER_IMAGE -c 'echo -n ${BUILD_TAG}')
- if [ -n "$MICROBADGER_UPDATE_HOOK" ]; then curl --silent --request POST $MICROBADGER_UPDATE_HOOK; fi
- docker rmi ${MY_BUILT_IMAGE}
- if [ -n "$TRIGGER_URL" ]; then curl --silent --request POST --form token=$TRIGGER_TOKEN --form ref=master $TRIGGER_URL; fi
......@@ -28,6 +28,8 @@ RUN cd /tmp && \
git clone https://aur.archlinux.org/yaourt.git && \
( cd yaourt && \
PKGEXT=.pkg.tar makepkg --syncdeps --install --noconfirm ) && \
echo -e "[xyne-x86_64]\nSigLevel=Required\nServer=http://xyne.archlinux.ca/repos/xyne\n" | cat /etc/pacman.conf - > /tmp/pacman.conf && \
sudo pacman --config /tmp/pacman.conf -Syy bauerbill && \
rm -rf /tmp/* && \
printf "y\\ny\\n" | sudo pacman -Scc
......
#!/bin/sh
_BUILD_TAG="$(git describe --abbrev=0 --tags 2>/dev/null)"
_VCS_URL="$(echo $CI_BUILD_REPO | sed 's|gitlab-ci-token[^@]*@||')"
_VCS_URL="$(echo $CI_REPOSITORY_URL | sed 's|gitlab-ci-token[^@]*@||')"
_CI_PROJECT_URL="${CI_PROJECT_URL:-https://gitlab.dev.ifs.hsr.ch/}"
if [ -n "$_BUILD_TAG" ]; then
_revs_ahead_tag=$(git rev-list --count ${_BUILD_TAG}..)
_commit_id_short=$(git log -1 --format=%h)
_VCS_REF="$(echo $_BUILD_TAG | sed -e 's/^[-_/a-zA-Z]\+//' -e 's/[-_+]/./g').${_revs_ahead_tag}.g${_commit_id_short}"
else
_VCS_REF="0.$(git rev-list --count ${CI_BUILD_REF_NAME:-master}).g$(git log -1 --format=%h)"
_VCS_REF="0.$(git rev-list --count ${CI_COMMIT_SHA_NAME:-master}).g$(git log -1 --format=%h)"
fi
set -e
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment