Loading pipelines/project-automation.yml +8 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,14 @@ include: - local: project-automation/semantic-release.yml - local: project-automation/generic.yaml - local: project-automation/tbump.yml - local: project-automation/update-check.yml update:check:ci-templates: extends: .update-check variables: UPDATE_CHECK_CURRENT_VERSION: v6.27.3 UPDATE_CHECK_REPOSITORY: https://gitlab.com/just-ci/templates.git UPDATE_CHECK_NAME: Just CI templates tbump: extends: Loading project-automation/readme.md +20 −0 Original line number Diff line number Diff line # Project Automation ## External Repository Update Check Include the following job in a template which you include elsewhere. This allows to automatically check if the included template has been updated externally. ```yaml include: - remote: https://jobs.just-ci.dev/v6.27.3/project-automation/update-check.yml update-check:your-repo-name: extends: .update-check variables: UPDATE_CHECK_CURRENT_VERSION: v1.2.3 UPDATE_CHECK_REPOSITORY: https://optional:authentication@gitlab.example.com/your/template/repo.git UPDATE_CHECK_NAME: Your optional repository name ``` > Make sure the variable `UPDATE_CHECK_CURRENT_VERSION` is updated whenever your > template is updated ## Pipeline Scheduler Add multiple variables using a multiline variable. Loading project-automation/update-check.yml 0 → 100644 +22 −0 Original line number Diff line number Diff line --- .update-check: stage: .post image: docker:git variables: GIT_STRATEGY: none script: - echo "Checking latest version of ${UPDATE_CHECK_REPOSITORY}" - LATEST_VERSION=$(git ls-remote --tags ${UPDATE_CHECK_REPOSITORY} | cut -d/ -f3 | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1) - | printf "Your ${UPDATE_CHECK_NAME:-repository} version ${UPDATE_CHECK_CURRENT_VERSION} is " if [ "${UPDATE_CHECK_CURRENT_VERSION}" == "${LATEST_VERSION}" ]; then echo "up to date." else echo "different than the latest ${LATEST_VERSION}." exit 1 fi rules: - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH allow_failure: true needs: [] tbump.toml +5 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ src = "README.md" [[file]] src = "container/readme.md" [[file]] src = "project-automation/readme.md" [[file]] src = "project-automation/find-next-release.yml" search = '-/raw/v{current_version}/project-automation' [[file]] Loading @@ -21,3 +23,6 @@ src = "project-automation/semantic-release.yml" [[file]] src = "project-automation/gitlab/recommended.yml" search = '-/raw/v{current_version}/project-automation' [[file]] src = "pipelines/project-automation.yml" search = "UPDATE_CHECK_CURRENT_VERSION: v{current_version}" Loading
pipelines/project-automation.yml +8 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,14 @@ include: - local: project-automation/semantic-release.yml - local: project-automation/generic.yaml - local: project-automation/tbump.yml - local: project-automation/update-check.yml update:check:ci-templates: extends: .update-check variables: UPDATE_CHECK_CURRENT_VERSION: v6.27.3 UPDATE_CHECK_REPOSITORY: https://gitlab.com/just-ci/templates.git UPDATE_CHECK_NAME: Just CI templates tbump: extends: Loading
project-automation/readme.md +20 −0 Original line number Diff line number Diff line # Project Automation ## External Repository Update Check Include the following job in a template which you include elsewhere. This allows to automatically check if the included template has been updated externally. ```yaml include: - remote: https://jobs.just-ci.dev/v6.27.3/project-automation/update-check.yml update-check:your-repo-name: extends: .update-check variables: UPDATE_CHECK_CURRENT_VERSION: v1.2.3 UPDATE_CHECK_REPOSITORY: https://optional:authentication@gitlab.example.com/your/template/repo.git UPDATE_CHECK_NAME: Your optional repository name ``` > Make sure the variable `UPDATE_CHECK_CURRENT_VERSION` is updated whenever your > template is updated ## Pipeline Scheduler Add multiple variables using a multiline variable. Loading
project-automation/update-check.yml 0 → 100644 +22 −0 Original line number Diff line number Diff line --- .update-check: stage: .post image: docker:git variables: GIT_STRATEGY: none script: - echo "Checking latest version of ${UPDATE_CHECK_REPOSITORY}" - LATEST_VERSION=$(git ls-remote --tags ${UPDATE_CHECK_REPOSITORY} | cut -d/ -f3 | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1) - | printf "Your ${UPDATE_CHECK_NAME:-repository} version ${UPDATE_CHECK_CURRENT_VERSION} is " if [ "${UPDATE_CHECK_CURRENT_VERSION}" == "${LATEST_VERSION}" ]; then echo "up to date." else echo "different than the latest ${LATEST_VERSION}." exit 1 fi rules: - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH allow_failure: true needs: []
tbump.toml +5 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ src = "README.md" [[file]] src = "container/readme.md" [[file]] src = "project-automation/readme.md" [[file]] src = "project-automation/find-next-release.yml" search = '-/raw/v{current_version}/project-automation' [[file]] Loading @@ -21,3 +23,6 @@ src = "project-automation/semantic-release.yml" [[file]] src = "project-automation/gitlab/recommended.yml" search = '-/raw/v{current_version}/project-automation' [[file]] src = "pipelines/project-automation.yml" search = "UPDATE_CHECK_CURRENT_VERSION: v{current_version}"