@ -1,15 +1,15 @@
|
|||||||
variables:
|
variables:
|
||||||
JOB_ROOT_DIR: '.'
|
JOB_ROOT_DIR: '.'
|
||||||
SECURE_LOG_LEVEL: debug
|
SECURE_LOG_LEVEL: debug
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
MY_PROJECT_ID: "28543717"
|
MY_PROJECT_ID: "28543717"
|
||||||
LICENSE_FINDER_CLI_OPTS: '--recursive'
|
LICENSE_FINDER_CLI_OPTS: '--recursive'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- validation
|
- validation
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- sync
|
- sync
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- local: $JOB_ROOT_DIR/yaml_lint/.gitlab-ci.yml
|
- local: $JOB_ROOT_DIR/yaml_lint/.gitlab-ci.yml
|
||||||
@ -95,37 +95,36 @@ yaml_lint Dependencies:
|
|||||||
|
|
||||||
|
|
||||||
PyLint:
|
PyLint:
|
||||||
extends:
|
extends:
|
||||||
- .PyLint
|
- .PyLint
|
||||||
image: python:3.6-slim
|
image: python:3.6-slim
|
||||||
|
|
||||||
|
|
||||||
gilab-ci.yml Lint (python 3.11):
|
gilab-ci.yml Lint (python 3.11):
|
||||||
variables:
|
variables:
|
||||||
YAML_LINT_PATH: ".gitlab-ci* ./**/.gitlab-ci*"
|
YAML_LINT_PATH: ".gitlab-ci* ./**/*gitlab-ci*"
|
||||||
YAML_LINT_EXTRA_ARGS: "{ extends: yaml_lint/.yamllint.yaml, ignore: [website-template/*] }"
|
YAML_LINT_EXTRA_ARGS: "{ extends: yaml_lint/.yamllint.yaml, ignore: [website-template/*] }"
|
||||||
extends:
|
extends:
|
||||||
- .yaml_lint_defaults
|
- .yaml_lint_defaults
|
||||||
image: python:3.11-slim
|
image: python:3.11-slim
|
||||||
|
|
||||||
|
|
||||||
Markdown Linting:
|
Markdown Linting:
|
||||||
variables:
|
variables:
|
||||||
MDLINT_EXCLUDE_PATHS: '!website_template !.gitlab CHANGELOG.md'
|
MDLINT_EXCLUDE_PATHS: '!website_template !.gitlab CHANGELOG.md'
|
||||||
|
|
||||||
extends:
|
extends:
|
||||||
- .Lint_Markdown
|
- .Lint_Markdown
|
||||||
|
|
||||||
|
|
||||||
Gitlab Release:
|
Gitlab Release:
|
||||||
variables:
|
variables:
|
||||||
MY_COMMAND: ./sub-folder_changlog.sh
|
MY_COMMAND: ./sub-folder_changlog.sh
|
||||||
extends:
|
extends:
|
||||||
- .gitlab_release
|
- .gitlab_release
|
||||||
|
|
||||||
|
|
||||||
Github (Push --mirror):
|
Github (Push --mirror):
|
||||||
variables:
|
variables:
|
||||||
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git"
|
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git"
|
||||||
extends:
|
extends:
|
||||||
- .git_push_mirror
|
- .git_push_mirror
|
||||||
|
|||||||
@ -1,76 +1,76 @@
|
|||||||
|
|
||||||
.conventional_commit:
|
.conventional_commit:
|
||||||
variables:
|
variables:
|
||||||
DEFAULT_ROOT_DIR: './gitlab-ci'
|
DEFAULT_ROOT_DIR: './gitlab-ci'
|
||||||
image: python:3.6-slim
|
image: python:3.6-slim
|
||||||
stage: validation
|
stage: validation
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"
|
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"
|
||||||
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests"
|
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests"
|
||||||
- if [ "0$MR_ACCESS_TOKEN" == "0" ]; then MR_ACCESS_TOKEN=$CI_JOB_TOKEN; fi
|
- if [ "0$MR_ACCESS_TOKEN" == "0" ]; then MR_ACCESS_TOKEN=$CI_JOB_TOKEN; fi
|
||||||
- echo "[DEBUG] MR_ACCESS_TOKEN[$MR_ACCESS_TOKEN]"
|
- echo "[DEBUG] MR_ACCESS_TOKEN[$MR_ACCESS_TOKEN]"
|
||||||
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi
|
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi
|
||||||
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
|
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
|
||||||
- if [ "0$MY_PROJECT_ID" == "0" ]; then PROJECT_ID=$CI_PROJECT_ID; else PROJECT_ID=$MY_PROJECT_ID ; fi
|
- if [ "0$MY_PROJECT_ID" == "0" ]; then PROJECT_ID=$CI_PROJECT_ID; else PROJECT_ID=$MY_PROJECT_ID ; fi
|
||||||
- echo "[DEBUG] PROJECT_ID[$PROJECT_ID]"
|
- echo "[DEBUG] PROJECT_ID[$PROJECT_ID]"
|
||||||
- export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'`
|
- export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'`
|
||||||
- apt update
|
- apt update
|
||||||
- apt install --no-install-recommends -y git
|
- apt install --no-install-recommends -y git
|
||||||
- python3 -m venv env
|
- python3 -m venv env
|
||||||
- . env/bin/activate
|
- . env/bin/activate
|
||||||
- pip install --upgrade pip
|
- pip install --upgrade pip
|
||||||
- pip install -r $ROOT_DIR/conventional_commits/requirements.txt
|
- pip install -r $ROOT_DIR/conventional_commits/requirements.txt
|
||||||
- echo "[DEBUG] CI_PROJECT_ID[$CI_PROJECT_ID]"
|
- echo "[DEBUG] CI_PROJECT_ID[$CI_PROJECT_ID]"
|
||||||
- echo "[DEBUG] CI_COMMIT_BRANCH[$CI_COMMIT_BRANCH]"
|
- echo "[DEBUG] CI_COMMIT_BRANCH[$CI_COMMIT_BRANCH]"
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
- git checkout --track origin/$CI_COMMIT_BRANCH
|
- git checkout --track origin/$CI_COMMIT_BRANCH
|
||||||
- git show-branch -a
|
- git show-branch -a
|
||||||
- target_branch=$(git show-branch -a | awk 'BEGIN { FS="\n\s+*" } { print $1 }' | awk '{print $2}' | grep '\[' | sed 's/.*\[origin\/\(.*\)\].*/\1/' | grep -v '\[' | grep -v $(git rev-parse --abbrev-ref HEAD) | grep -vi 'HEAD' | awk 'BEGIN{ RS = "" ; FS = "\n" }{print $1}')
|
- target_branch=$(git show-branch -a | awk 'BEGIN { FS="\n\s+*" } { print $1 }' | awk '{print $2}' | grep '\[' | sed 's/.*\[origin\/\(.*\)\].*/\1/' | grep -v '\[' | grep -v $(git rev-parse --abbrev-ref HEAD) | grep -vi 'HEAD' | awk 'BEGIN{ RS = "" ; FS = "\n" }{print $1}')
|
||||||
- echo "[DEBUG] Target Branch[$target_branch]"
|
- echo "[DEBUG] Target Branch[$target_branch]"
|
||||||
- if [ -d "gitlab-ci" ]; then ls -la gitlab-ci; fi
|
- if [ -d "gitlab-ci" ]; then ls -la gitlab-ci; fi
|
||||||
- first_sha1=$(git log origin/$target_branch..$CI_COMMIT_BRANCH --format=format:%H | tail -1)
|
- first_sha1=$(git log origin/$target_branch..$CI_COMMIT_BRANCH --format=format:%H | tail -1)
|
||||||
- echo "[DEBUG] First Commit SHA[$first_sha1]"
|
- echo "[DEBUG] First Commit SHA[$first_sha1]"
|
||||||
- echo "[DEBUG] artifacts directory [$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME]"
|
- echo "[DEBUG] artifacts directory [$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME]"
|
||||||
after_script:
|
after_script:
|
||||||
- ls -lR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE"
|
- ls -lR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE"
|
||||||
- cd ..
|
- cd ..
|
||||||
- rm -Rf check
|
- rm -Rf check
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 3 days
|
expire_in: 3 days
|
||||||
when: always
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- "$CI_PROJECT_DIR/artifacts/*"
|
- "$CI_PROJECT_DIR/artifacts/*"
|
||||||
reports:
|
reports:
|
||||||
junit:
|
junit:
|
||||||
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
|
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
|
||||||
rules:
|
rules:
|
||||||
- if: '$JOB_STOP_CONVENTIONAL_COMMITS'
|
- if: '$JOB_STOP_CONVENTIONAL_COMMITS'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG'
|
- if: '$CI_COMMIT_TAG'
|
||||||
when: always
|
when: always
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
when: always
|
when: always
|
||||||
- if: '$CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_BRANCH'
|
||||||
when: always
|
when: always
|
||||||
- when: never
|
- when: never
|
||||||
|
|
||||||
|
|
||||||
MR Title:
|
MR Title:
|
||||||
extends:
|
extends:
|
||||||
- .conventional_commit
|
- .conventional_commit
|
||||||
script:
|
script:
|
||||||
- MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH)
|
- MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH)
|
||||||
- echo "[DEBUG] MR_TITLE[$MR_TITLE]"
|
- echo "[DEBUG] MR_TITLE[$MR_TITLE]"
|
||||||
- cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?
|
- cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?
|
||||||
- . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml"
|
- . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml"
|
||||||
|
|
||||||
|
|
||||||
Commit Messages:
|
Commit Messages:
|
||||||
extends:
|
extends:
|
||||||
- .conventional_commit
|
- .conventional_commit
|
||||||
script:
|
script:
|
||||||
- if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -eq 0 ]; then echo "[DEBUG] Single Commit"; cz_exit=0 && cz check -m "$(git log HEAD --format=format:%B -1)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi
|
- if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -eq 0 ]; then echo "[DEBUG] Single Commit"; cz_exit=0 && cz check -m "$(git log HEAD --format=format:%B -1)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi
|
||||||
- if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -gt 0 ]; then echo "[DEBUG] Commit range"; cz_exit=0 && cz check --rev-range $first_sha1..HEAD > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi
|
- if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -gt 0 ]; then echo "[DEBUG] Commit range"; cz_exit=0 && cz check --rev-range $first_sha1..HEAD > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi
|
||||||
- . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml"
|
- . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml"
|
||||||
|
|||||||
@ -24,7 +24,6 @@ variables:
|
|||||||
# JOB_STOP_GITLAB_RELEASE: 'any value'
|
# JOB_STOP_GITLAB_RELEASE: 'any value'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.build_docker_container:
|
.build_docker_container:
|
||||||
stage: build
|
stage: build
|
||||||
image: nofusscomputing/docker-buildx-qemu:dev
|
image: nofusscomputing/docker-buildx-qemu:dev
|
||||||
@ -105,7 +104,6 @@ variables:
|
|||||||
- when: never
|
- when: never
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.publish-docker-hub:
|
.publish-docker-hub:
|
||||||
stage: publish
|
stage: publish
|
||||||
image: docker:23-dind
|
image: docker:23-dind
|
||||||
@ -206,8 +204,6 @@ variables:
|
|||||||
- when: never
|
- when: never
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Docker Container:
|
Docker Container:
|
||||||
extends: .build_docker_container
|
extends: .build_docker_container
|
||||||
|
|
||||||
@ -217,10 +213,10 @@ Docker Hub:
|
|||||||
|
|
||||||
|
|
||||||
Gitlab Release:
|
Gitlab Release:
|
||||||
extends:
|
extends:
|
||||||
- .gitlab_release
|
- .gitlab_release
|
||||||
|
|
||||||
|
|
||||||
Github (Push --mirror):
|
Github (Push --mirror):
|
||||||
extends:
|
extends:
|
||||||
- .git_push_mirror
|
- .git_push_mirror
|
||||||
Reference in New Issue
Block a user