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
  • EOLE/infra/ci-tools
  • daniel.dehennin/ci-tools
2 results
Show changes
Commits on Source (5)
.check update:
stage: check
image: bitnami/git:latest
script:
- git clone "${upstream_repo}"
- cd ${upstream_dir}
- MASTER=$(git branch -r | grep /HEAD | sed 's#.*-> origin/##' )
- cd ..
- git clone -b $MASTER "${local_repo}"
- rm -rf ${local_dir}/.git
- rm -rf ${upstream_dir}/.git
- x=$(diff -r ${local_dir} ${upstream_dir}) || true
- echo $x
- |
if [ "$x" != "" ]
then
echo "Updates was found"
true
else
echo "No updates requisite"
exit 1
fi
.synchro:
stage: synchro
image: bitnami/git:latest
rules:
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-tag]
- !reference [.rules-map, on-branch]
- !reference [.rules-map, not-on-stable]
- !reference [.rules-map, not-on-semantic-release-commit]
script:
- echo "Looking for new updates for $project"
- echo ${GITLAB_TOKEN}
- url=$(sed -r "s|https:\/\/|https://oauth2:${GITLAB_TOKEN}@|" <<< "${local_repo}")
- echo $url
- |
git clone "${upstream_repo}"
cd ${upstream_dir}
echo "* update Depot $project"
git config --global --add safe.directory .
- |
echo "* pushToMimLibre"
git config user.email "$email"
git config user.name "$username"
echo "synchro TODO"
#url=$(sed -r 's|https:\/\/|https://Access_token:glpat-nzcJzx3TsQmt8fcfQYak@|' <<< "${local_repo}")
url=$(sed -r "s|https:\/\/|https://oauth2:${GITLAB_TOKEN}@|" <<< "${local_repo}")
git remote add mimlibre ${url}
git push --set-upstream mimlibre --all --force
git push --set-upstream mimlibre --tags --force
.check:version:
stage: check-version
image: bitnami/git:latest
rules:
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-tag]
- !reference [.rules-map, on-branch]
- !reference [.rules-map, not-on-stable]
- !reference [.rules-map, not-on-semantic-release-commit]
script:
- |
git clone "${upstream_repo}"
cd ${upstream_dir}
VERSION=$(git describe --tags --abbrev=0)
echo "export APPVERSION=$VERSION" > ../results
cat ../results
cd ..
- |
git clone ${local_repo}
cd ${local_dir}
VERSION=$(git tag | tail -n 1)
echo "export LASTVERSION=$VERSION" >> ../results
cat ../results
cd ..
artifacts:
name: "Extract lates tag"
paths:
- results
.build:
stage: build
rules:
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-tag]
- !reference [.rules-map, on-branch]
- !reference [.rules-map, not-on-stable]
- !reference [.rules-map, not-on-semantic-release-commit]
image:
name: "${KANIKO_IMAGE}"
entrypoint: [""]
variables:
KANIKO_IMAGE: gcr.io/kaniko-project/executor:debug
KANIKO_ARGS: ''
script:
- echo -e "\e[0Ksection_start:`date +%s`:docker-image-build-config[collapsed=true]\r\e[0KPrepare environment to build docker image"
- export IMAGE_NAME=${IMAGE_NAME:-${CI_JOB_NAME%-docker-build*}}
- source ./results
- echo "${APPVERSION}"
- source ./results
- echo "${LASTVERSION}"
- version=${LASTVERSION%-*}
- |
if [[ "${APPVERSION}" =~ ${version} ]]
then
LAST_INDEX="${LASTVERSION##*.}"
IMAGE_TAG="${LASTVERSION%.*}.$(( LAST_INDEX + 1))"
else
IMAGE_TAG=${APPVERSION}-eole3.0
fi
- echo "export TAG=$IMAGE_TAG" > ./TAG
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- echo -e "\e[0Ksection_end:`date +%s`:docker-image-build-config\r\e[0K"
- echo -e "\e[0Ksection_start:`date +%s`:docker-image-build-kaniko\r\e[0KBuild docker image '${IMAGE_NAME}:${IMAGE_TAG}' using Dockerfile '${DOCKERFILE}' and push to '${CI_REGISTRY_IMAGE}'"
- /kaniko/executor ${KANIKO_ARGS} --context ${context} --context-sub-path ${sub_path} --dockerfile ${dockerfile} --destination ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${IMAGE_TAG}
- echo -e "\e[0Ksection_end:`date +%s`:docker-image-build-kaniko\r\e[0K"
artifacts:
name: "Extract tag"
paths:
- TAG
.git:tag:
rules:
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-semantic-release-commit]
- !reference [.rules-map, on-branch]
- !reference [.rules-map, not-on-stable]
stage: release
image: "${GIT_IMAGE}"
variables:
GIT_IMAGE: 'bitnami/git:latest'
script:
- echo -e "\e[0Ksection_start:$(date +%s):Create tag"
- |
export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-${CI_COMMIT_AUTHOR% <*}}"
export TEMP_MAIL_PREFIX="${CI_COMMIT_AUTHOR#*<}"
export GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL:-${TEMP_MAIL_PREFIX%>}}"
export GIT_COMMITTER_NAME="${GIT_COMMITTER_NAME:-${GIT_AUTHOR_NAME}}"
export GIT_COMMITTER_EMAIL="${GIT_COMMITTER_EMAIL:-${GIT_AUTHOR_EMAIL}}"
echo -e "\e[0Ksection_end:$(date +%s):git-tag-create-configure\r\e[0K"
- source ./TAG
- echo "${TAG}"
- NEW_TAG=${TAG}
- echo -e "\e[0Ksection_start:$(date +%s):git-tag-create-new-tag[collapsed=true]\r\e[0KCreate new git tag '${NEW_TAG}' pointing to '${CI_COMMIT_SHORT_SHA}'"
- |
url=$(sed -r 's|https:\/\/|https://gitlab-ci-token:${CI_JOB_TOKEN}@|' <<< "${local_repo}")
git clone $url
cd "${local_dir}"
git checkout $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
git pull
git tag -m "New image release ${NEW_TAG#release/}" ${NEW_TAG}
git push origin ${NEW_TAG}