gitlab-ce-arm64/.gitlab-ci.yml

62 lines
2.3 KiB
YAML
Raw Normal View History

2020-07-22 22:47:20 +08:00
variables:
BASENAME: gitlab-ce-arm64v8
DOCKER_TLS_CERTDIR: ""
stages:
- check
- build
check:
image: docker:stable-git
stage: check
tags:
- docker
only:
- branches
script:
- apk add --no-cache --upgrade openssh-client bash curl coreutils
- git config --global user.email $GIT_USER_EMAIL && git config --global user.name $GIT_USER_NAME
- mkdir -p ~/.ssh && echo "$GITLAB_SSH_PRIV_KEY" > ~/.ssh/id_rsa && ssh-keyscan -H git.yrzr.ocry.com > ~/.ssh/known_hosts && chmod -R 0600 ~/.ssh/
- git fetch --tags
# check version
- if [ -f ./version_list ]; then rm version_list; fi
2020-07-22 22:56:00 +08:00
- curl -s "https://pkg.yrzr.ocry.com" | grep "gitlab-ce_" | sed 's/.*gitlab-ce_\(.*\)-ce.*/\1/' | sort -rV >> version_list
2020-07-22 22:47:20 +08:00
# create tags
- ./create-tags.sh
- git push --tags https://${GITLAB_USER_LOGIN}:${PERSONAL_ACCESS_TOKEN}@git.yrzr.ocry.com/docker/gitlab-ce-arm64.git
build:
image: arm64v8/docker:stable-git
stage: build
services:
- name: arm64v8/docker:stable-dind
alias: docker
tags:
- aarch64
- docker
only:
- tags
before_script:
- docker info
script:
- apk add --no-cache --upgrade bash coreutils
2020-07-22 22:56:00 +08:00
- RELEASE_VERSION="${CI_COMMIT_TAG}-ce.0" && echo ${RELEASE_VERSION}
- REMOTE_VERSION="${CI_COMMIT_TAG}+ce.0" && echo ${REMOTE_VERSION}
2020-07-22 22:47:20 +08:00
# fetch dockerfile
- git clone -b ${REMOTE_VERSION} --depth=1 https://gitlab.com/gitlab-org/omnibus-gitlab.git
- cd ./omnibus-gitlab/docker
# write RELEASE
- echo "PACKAGECLOUD_REPO=gitlab-ce" > RELEASE
- echo "RELEASE_PACKAGE=gitlab-ce" >> RELEASE
2020-07-22 22:56:00 +08:00
- echo "RELEASE_VERSION=${RELEASE_VERSION}" >> RELEASE
- echo "DOWNLOAD_URL=https://${PKG_SERVER_URL}/gitlab-ce_${CI_COMMIT_TAG}-ce.0_arm64.deb" >> RELEASE
2020-07-22 22:47:20 +08:00
# missing package libatomic1 after version 13
- sed -i 's/less/less libatomic1/' ./Dockerfile
2020-07-22 22:56:00 +08:00
- docker build -q -t ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG}-ce.0 -f ./Dockerfile ./
2020-07-22 22:47:20 +08:00
# latest tag
2020-07-23 08:58:29 +08:00
- cd ../ && git fetch --tags && LATEST=$(git tag | sort -rV | head -n 1)
- if [ "${LATEST}" == "${CI_COMMIT_TAG}" ]; then docker tag ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG}-ce.0 ${DOCKER_NS}/${BASENAME}:latest; fi
2020-07-22 22:47:20 +08:00
# docker push
- docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD}
- docker images && docker push ${DOCKER_NS}/${BASENAME}