use deb file from official sources

This commit is contained in:
Christopher 2020-11-24 17:07:19 +08:00
parent edb6cfab2d
commit 74fef2332d
3 changed files with 22 additions and 19 deletions

View File

@ -17,12 +17,7 @@ check:
- apk add --no-cache --upgrade openssh-client bash curl coreutils - 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 - 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/ - 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 - git fetch --tags && ./check-version.sh && ./create-tags.sh
# 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 - git push --tags https://${GITLAB_USER_LOGIN}:${PERSONAL_ACCESS_TOKEN}@git.yrzr.ocry.com/docker/gitlab-ce-arm64.git
build: build:
@ -40,23 +35,15 @@ build:
- docker info - docker info
script: script:
- apk add --no-cache --upgrade bash coreutils - apk add --no-cache --upgrade bash coreutils
- REMOTE_VERSION=$(echo $CI_COMMIT_TAG | sed "s/-/+/") && echo ${REMOTE_VERSION}
# fetch dockerfile # fetch dockerfile
- git clone -b ${REMOTE_VERSION} --depth=1 https://gitlab.com/gitlab-org/omnibus-gitlab.git - ./set-branch-name.sh && export BRANCH_NAME=$(cat branch_name) && echo ${BRANCH_NAME}
- git clone -b ${BRANCH_NAME}
- cd ./omnibus-gitlab/docker - cd ./omnibus-gitlab/docker
# write RELEASE # write RELEASE
- echo "PACKAGECLOUD_REPO=gitlab-ce" > RELEASE - echo "PACKAGECLOUD_REPO=gitlab-ce" > RELEASE && echo "RELEASE_PACKAGE=gitlab-ce" >> RELEASE && echo "RELEASE_VERSION=${CI_COMMIT_TAG}" >> RELEASE && echo "DOWNLOAD_URL=https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/focal/gitlab-ce_${CI_COMMIT_TAG}_arm64.deb/download.deb" >> RELEASE
- echo "RELEASE_PACKAGE=gitlab-ce" >> RELEASE - docker build -q -t ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG} -f ./Dockerfile ./
- echo "RELEASE_VERSION=${CI_COMMIT_TAG}" >> RELEASE
- echo "DOWNLOAD_URL=https://${PKG_SERVER_URL}/gitlab-ce_${CI_COMMIT_TAG}_arm64.deb" >> RELEASE
# use ubuntu 20.04 instead of 16.04
- sed -i 's/16.04/20.04/' ./Dockerfile
# gitlab-ce depends on libatomic1; however: Package libatomic1 is not installed
- sed -i 's/less/less libatomic1/' ./Dockerfile
- docker build -t ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG} -f ./Dockerfile ./
# latest tag # latest tag
- cd ../../ && git fetch --tags && LATEST=$(git tag | sort -rV | head -n 1) - cd ../../ && git fetch --tags && ./latest-tag.sh
- if [ "${LATEST}" == "${CI_COMMIT_TAG}" ]; then docker tag ${DOCKER_NS}/${BASENAME}:${CI_COMMIT_TAG} ${DOCKER_NS}/${BASENAME}:latest; fi
# docker push # docker push
- docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} - docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD}
- docker images && docker push ${DOCKER_NS}/${BASENAME} - docker images && docker push ${DOCKER_NS}/${BASENAME}

12
check-version.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
SEARCH_PAGES='1'
if [ -f ./version_list ]; then
rm version_list
fi
for i in $(seq 1 ${SEARCH_PAGES}); do
curl -s "https://packages.gitlab.com/gitlab/gitlab-ce?page=${i}" | grep "_arm64.deb" | grep -v '\-rc' | sed 's/.*>\(.*\)<.*/\1/' | sort -u | sed 's/gitlab-ce_\(.*\)_arm64.deb/\1/' >> version_list;
done
sort -rVu version_list -o version_list

4
set-branch-name.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
IFS='.' read -ra NUMS <<< ${CI_COMMIT_TAG}
echo "${NUMS[0]}-${NUMS[1]}-stable" > branch_name