UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit a519b846 authored by Zachariah Dzielinski's avatar Zachariah Dzielinski
Browse files

feat: added commitlint ci job and documentation

parent 983e6fe6
No related branches found
No related tags found
1 merge request!141Add commitlint job
Pipeline #129187 waiting for manual action
......@@ -35,6 +35,15 @@ variables:
# Pre Stage Jobs
#
commitlint:
image: registry.dsop.io/platform-one/big-bang/pipeline-templates/pipeline-templates/pre-envs:ubi8.3
stage: .pre
script:
- dnf module install -y nodejs
- npm install --only=dev
- git fetch --all
- ./scripts/commitlint.sh
pre vars:
image: registry.dsop.io/platform-one/big-bang/pipeline-templates/pipeline-templates/pre-envs:ubi8.3
stage: .pre
......@@ -101,9 +110,8 @@ clean install:
upgrade:
stage: smoke tests
needs:
- job: pre vars
artifacts: true
dependencies:
- pre vars
extends:
- .k3d
rules:
......
......@@ -11,6 +11,7 @@ Table of Contents:
- [Local Setup](#local-setup)
- [Prereqs](#prereqs)
- [Steps](#steps)
- [Combining Multiple Commits](#combining-multiple-commits)
- [Iron Bank Images](#iron-bank-images)
- [Local Kubernetes cluster](#local-kubernetes-cluster)
- [Deploying Big Bang (Quick Start)](#deploying-big-bang-quick-start)
......@@ -57,6 +58,10 @@ npm install --only=dev
This will download `husky` and `commitlint` to your local repo and modify your `.git/hooks` to allow husky to run pre-commit hooks. Once installed it will enforce the usage of convential-commits.
#### Combining Multiple Commits
If you have pushed commits that do not conform to the conventional-commit guide lines, you can combine all of the incorrectly formatted commit messages by using `git rebase`. A more expansive guide of how this is done can be found [here](https://www.w3docs.com/snippets/git/how-to-combine-multiple-commits-into-one-with-3-steps.html).
## Iron Bank Images
Per the [charter](https://repo1.dsop.io/platform-one/big-bang/charter), all Big Bang packages will leverage container images from [IronBank](https://ironbank.dsop.io/). In order to pull these images, ImagePullSecrets must be provided to BigBang. To obtain access to these images, follow the guides below. These steps should NOT be used for production since the API keys for a user are only valid when the user is logged into [Registry1](https://registry1.dsop.io)
......
#!/usr/bin/env bash
# store failure
failure=false
# debug output
echo "Linting all commits between $CI_DEFAULT_BRANCH and $CI_COMMIT_REF_NAME"
echo "--------------------------------------------------------"
# loop over commit sha's for commits that exist in this branch but not the default branch
for sha in $(git log origin/$CI_DEFAULT_BRANCH..origin/$CI_COMMIT_REF_NAME --format=format:%H); do
# get the commit message from the sha
message=$(git log --format=format:%s -n 1 $sha)
# debug output sha and message
echo "Linting commit: $sha - $message"
# lint message and store possible failure
if ! echo "$message" | npx commitlint; then failure=true; fi
done
# if we have a failure
if $failure; then
# guide developer to resolution
echo "--------------------------------------------------------"
echo "You have commits that have failed linting because their content does not follow conventional standards"
echo "You must rebase, squash, or amend; and implement conventional standards on all commits for this branch"
echo "Commit standards guide - https://www.conventionalcommits.org/"
echo "--------------------------------------------------------"
echo "Quick tip - Squash commits for $CI_COMMIT_REF_NAME"
echo "> git checkout $CI_COMMIT_REF_NAME"
echo "> git reset \$(git merge-base $CI_DEFAULT_BRANCH \$(git rev-parse --abbrev-ref HEAD))"
echo "> git add -A"
echo "> git commit -m \"feat: example conventional commit\""
echo "> git push --force"
exit 1
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment