From 6f33ea771cf536cc6823c27a820c315888c64c3c Mon Sep 17 00:00:00 2001 From: yrzr Date: Wed, 22 Jul 2020 22:47:20 +0800 Subject: [PATCH] add files --- .gitlab-ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 8 +++++-- create-tags.sh | 14 ++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 create-tags.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c84af43 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,59 @@ +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 + - curl -s "https://pkg.yrzr.ocry.com" | grep "gitlab-ce_" | sed 's/.*gitlab-ce_\(.*\)_arm64.*/\1/' | sort -rV >> version_list + # 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 + - REMOTE_VERSION=$(sed "s/-/+/" <<< ${CI_COMMIT_TAG}) && echo ${REMOTE_VERSION} + # 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 + - echo "RELEASE_VERSION=${CI_COMMIT_TAG}" >> RELEASE + - echo "DOWNLOAD_URL=https://${PKG_SERVER_URL}/gitlab-ce_${CI_COMMIT_TAG}_arm64.deb" >> RELEASE + # missing package libatomic1 after version 13 + - sed -i 's/less/less libatomic1/' ./Dockerfile + - docker build -q -t ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG} -f ./Dockerfile ./ + # latest tag + - cd ../../ && git fetch --tags && ./latest-tag.sh + # docker push + - docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} + - docker images && docker push ${DOCKER_NS}/${BASENAME} diff --git a/README.md b/README.md index c5385b5..4075ebc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ -# gitlab-ce-arm64 +# GitLab Community Edition docker image builder for arm64v8 -gitlab-ce docker image builder for arm64v8 \ No newline at end of file +Compatible with arm64v8 architectural. + +Source build code: https://gitlab.com/gitlab-org/omnibus-gitlab + +docker hub: https://hub.docker.com/r/yrzr/gitlab-ce-arm64v8 \ No newline at end of file diff --git a/create-tags.sh b/create-tags.sh new file mode 100755 index 0000000..0abac8e --- /dev/null +++ b/create-tags.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cat version_list | while read version; do + echo ${version} + HAVE_TAG=false + for tag in $(git tag); do + if [ "${version}" == "${tag}" ]; then + HAVE_TAG=true + fi + done + if ! ${HAVE_TAG}; then + git tag ${version} + fi +done