7
.cz.yaml
Normal file
7
.cz.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
commitizen:
|
||||||
|
bump_message: "build(version): bump version $current_version \u2192 $new_version"
|
||||||
|
changelog_incremental: false
|
||||||
|
name: cz_conventional_commits
|
||||||
|
tag_format: $major.$minor.$patch$prerelease
|
||||||
|
update_changelog_on_bump: true
|
||||||
|
version: 0.0.1
|
157
.gitlab-ci.yml
157
.gitlab-ci.yml
@ -1,36 +1,139 @@
|
|||||||
stages:
|
stages:
|
||||||
- validation
|
- validation
|
||||||
|
- build
|
||||||
|
- prepare
|
||||||
|
- test
|
||||||
|
- release
|
||||||
- sync
|
- sync
|
||||||
|
- publish
|
||||||
|
|
||||||
|
include:
|
||||||
|
- project: nofusscomputing/projects/gitlab-ci
|
||||||
|
ref: 36ce0b0b76e6769c7a2e0d4ea0f3fcd2cc2d6bb1
|
||||||
|
file:
|
||||||
|
- conventional_commits/.gitlab-ci.yml
|
||||||
|
- gitlab_release/.gitlab-ci.yml
|
||||||
|
- git_push_mirror/.gitlab-ci.yml
|
||||||
|
|
||||||
|
|
||||||
|
Docker Container:
|
||||||
|
stage: build
|
||||||
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
#- docker:19.03.12-dind
|
||||||
|
- docker:latest-dind
|
||||||
|
variables:
|
||||||
|
IMAGE_NAME: ansible-ee
|
||||||
|
before_script:
|
||||||
|
- docker info
|
||||||
|
# - docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
- apk update
|
||||||
|
- apk add --update --no-cache python3 git && ln -sf python3 /usr/bin/python
|
||||||
|
- python3 -m ensurepip
|
||||||
|
- pip3 install -r gitlab-ci/gitlab_release/requirements.txt
|
||||||
|
- pip3 install gitlab-ci/gitlab_release/python-module/cz_nfc/.
|
||||||
|
script: |
|
||||||
|
docker build . \
|
||||||
|
--label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
||||||
|
--label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
||||||
|
--label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
||||||
|
--label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \
|
||||||
|
--label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \
|
||||||
|
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
||||||
|
--no-cache \
|
||||||
|
--tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA;
|
||||||
|
|
||||||
|
docker image inspect $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA;
|
||||||
|
|
||||||
|
docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA;
|
||||||
|
|
||||||
|
#allow_failure: true
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
when: never
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: on_success
|
||||||
|
# - if: '$CI_COMMIT_BRANCH == "development" && $CI_COMMIT_TITLE =~ /Merge branch.*/'
|
||||||
|
# when: on_success
|
||||||
|
- if: '$CI_COMMIT_BRANCH != "master"'
|
||||||
|
allow_failure: true
|
||||||
|
when: manual
|
||||||
|
- when: never
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Docker Hub:
|
||||||
|
stage: publish
|
||||||
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
#- docker:19.03.12-dind
|
||||||
|
- docker:latest-dind
|
||||||
|
variables:
|
||||||
|
IMAGE_NAME: ansible-ee
|
||||||
|
before_script:
|
||||||
|
- export
|
||||||
|
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
|
||||||
|
- docker pull $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA
|
||||||
|
- docker logout $CI_REGISTRY
|
||||||
|
script:
|
||||||
|
# - Release_TAG=$(cat $CI_PROJECT_DIR/dist/version)
|
||||||
|
- docker login docker.io -u $NFC_DOCKERHUB_USERNAME -p $NFC_DOCKERHUB_TOKEN
|
||||||
|
# - if [ "m$(echo $CI_BUILD_REF_NAME | grep rc)" == "m$CI_BUILD_REF_NAME" ]; then Branch_TAG=dev; else Branch_TAG=stable; fi
|
||||||
|
- echo Branch tag is $Branch_TAG
|
||||||
|
- docker image ls
|
||||||
|
- |
|
||||||
|
if [ "0$CI_COMMIT_BRANCH" == "0development" ]; then
|
||||||
|
|
||||||
|
DH_LATEST_TAG=dev
|
||||||
|
|
||||||
|
elif [ "0$CI_COMMIT_TAG" != "0" ] ; then
|
||||||
|
|
||||||
|
if [ "0$CI_COMMIT_TAG" == *"rc"* ]; then
|
||||||
|
|
||||||
|
DH_LATEST_TAG=dev
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
DH_LATEST_TAG=latest
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker image tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA nofusscomputing/$IMAGE_NAME:$CI_COMMIT_TAG;
|
||||||
|
|
||||||
|
docker image ls;
|
||||||
|
|
||||||
|
docker push nofusscomputing/$IMAGE_NAME:$CI_COMMIT_TAG;
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "0$DH_LATEST_TAG" != "0" ]; then
|
||||||
|
|
||||||
|
docker image tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA nofusscomputing/$IMAGE_NAME:$DH_LATEST_TAG;
|
||||||
|
|
||||||
|
docker image ls;
|
||||||
|
|
||||||
|
docker push nofusscomputing/$IMAGE_NAME:$DH_LATEST_TAG;
|
||||||
|
|
||||||
|
fi
|
||||||
|
needs: [ "Docker Container" ]
|
||||||
|
environment:
|
||||||
|
name: DockerHub
|
||||||
|
url: https://hub.docker.com/r/nofusscomputing/docker-mail
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
when: never
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: on_success
|
||||||
|
# - if: '$CI_COMMIT_BRANCH == "development" && $CI_COMMIT_TITLE =~ /Merge branch.*/'
|
||||||
|
# when: on_success
|
||||||
|
- if: '$CI_COMMIT_BRANCH != "master"'
|
||||||
|
allow_failure: true
|
||||||
|
when: manual
|
||||||
|
- when: never
|
||||||
|
|
||||||
dummy:
|
|
||||||
image: alpine:latest
|
|
||||||
stage: validation
|
|
||||||
script:
|
|
||||||
- echo dummy job
|
|
||||||
rules:
|
|
||||||
- if: "$CI_COMMIT_BRANCH"
|
|
||||||
when: always
|
|
||||||
- when: never
|
|
||||||
|
|
||||||
|
|
||||||
.git_push_mirror:
|
|
||||||
image: alpine:latest
|
|
||||||
stage: sync
|
|
||||||
before_script:
|
|
||||||
- apk update
|
|
||||||
- apk add git
|
|
||||||
script:
|
|
||||||
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME
|
|
||||||
- cd $CI_PROJECT_NAME
|
|
||||||
- git remote add destination $GIT_SYNC_URL
|
|
||||||
- echo "https://gitlab.com/ $CI_PROJECT_PATH / $CI_PROJECT_NAME .git"
|
|
||||||
- git push destination --mirror
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 day
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
|
||||||
when: always
|
|
||||||
|
|
||||||
|
|
||||||
Github (Push --mirror):
|
Github (Push --mirror):
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "gitlab-ci"]
|
||||||
|
path = gitlab-ci
|
||||||
|
url = https://gitlab.com/nofusscomputing/projects/gitlab-ci.git
|
1
gitlab-ci
Submodule
1
gitlab-ci
Submodule
Submodule gitlab-ci added at 36ce0b0b76
Reference in New Issue
Block a user