From 30c25aa15927a36eb24a4f85474671abab894810 Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 07:21:34 +0100 Subject: [PATCH 1/6] chore: add .envrc to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 71b2557..b1e4865 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .cache/ .venv/ +.envrc From 0bace863cfa7025fa9dd70940e09313724281a6c Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 07:25:21 +0100 Subject: [PATCH 2/6] docs(readme): add xebis-ansible-collection as an usage example --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b0be48e..5032dd5 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,7 @@ For usage examples, you might take a look at: - [GitHub - xebis/shellib: Simple Bash scripting library.](https://github.com/xebis/shellib) - example of version bumping and creating deb package - [GitHub - xebis/infrastructure-template: Template for automated GitOps and IaC in a cloud. GitLab CI handles static and dynamic environments. Environments are created, updated, and destroyed by Terraform, then configured by cloud-init and Ansible.](https://github.com/xebis/infrastructure-template) - example of GitOps (IaC + MRs + CI/CD) and multiple environments orchestration +- [GitHub - xebis/xebis-ansible-collection: A collection of Xebis shared Ansible roles.](https://github.com/xebis/xebis-ansible-collection) ## Contributing From 27bfbaa8c875eae38f9258875b934165afd9101c Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 07:59:08 +0100 Subject: [PATCH 3/6] fix: gitlab ci linter fails on missing project argument --- .gitlab-ci.yml | 5 ++--- .pre-commit-config.yaml | 1 + README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e61dba..27b1d50 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,8 +18,7 @@ variables: PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip PRE_COMMIT_HOME: $CI_PROJECT_DIR/.cache/pre-commit # Skip protect-first-parent pre-commit hook until `[ERROR] caught error 1 on line 69 of ...: FIRST_PARENT="$(git show-ref -s "${BASE}")"` is fixed - # Skip gitlab-ci-linter pre-commit hook until `urllib.error.HTTPError: HTTP Error 404: Not Found` is fixed - SKIP: check-hooks-apply,protect-first-parent,gitlab-ci-linter + SKIP: check-hooks-apply,protect-first-parent before_script: - *default_before_script - apk --no-cache add bash git go grep npm py-pip python3-dev shellcheck shfmt @@ -52,7 +51,7 @@ variables: lint: extends: [.lint] variables: - SKIP: check-hooks-apply,protect-first-parent,gitlab-ci-linter,anti-todo + SKIP: check-hooks-apply,protect-first-parent,anti-todo rules: - if: $CI_PIPELINE_SOURCE != 'merge_request_event' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e42749..51aa1c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,6 +63,7 @@ repos: rev: v1.0.6 hooks: - id: gitlab-ci-linter + args: [--project, xebis/repository-template] - repo: local hooks: - id: anti-todo diff --git a/README.md b/README.md index 5032dd5..7baa027 100644 --- a/README.md +++ b/README.md @@ -271,7 +271,7 @@ Set up the GitLab scheduled pipeline: ## Usage -Simply fork the repository at [GitLab](https://gitlab.com/xebis/repository-template/-/forks/new) or [GitHub](https://github.com/xebis/repository-template/fork), **delete** all git tags, and **tag** the last commit to the desired starting version, e.g. `v0.0.0`. Clone the repository with `--recursive` option, run `sudo scripts/bootstrap`, `scripts/setup`, `scripts/update`, and enjoy! +Simply fork the repository at [GitLab](https://gitlab.com/xebis/repository-template/-/forks/new) or [GitHub](https://github.com/xebis/repository-template/fork), **delete** all git tags, and **tag** the last commit to the desired starting version, e.g. `v0.0.0`. Clone the repository with `--recursive` option, run `sudo scripts/bootstrap`, `scripts/setup`, `scripts/update`, at [`.pre-commit-config.yaml`](.pre-commit-config.yaml) replace `gitlab-ci-linter` project with _your project_, and enjoy! - `git commit`, or `git merge` runs checks on changed files and runs [fast test set](tests/fast.set) - `git push` runs checks on all files and runs [reduced test set](tests/reduced.set) From 2571b4ac01b6f0e8947cdeca0a496dc9bde69884 Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 08:34:50 +0100 Subject: [PATCH 4/6] docs(readme): adjust and extend testing section --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7baa027..e95fa5a 100644 --- a/README.md +++ b/README.md @@ -313,11 +313,13 @@ Please read [CONTRIBUTING](CONTRIBUTING.md) for details on our code of conduct, - [ ] `git push` runs [`scripts/pre-push`](scripts/pre-push) - [ ] `pre-commit run -a --hook-stage manual` runs all hooks and `check-hooks-apply` hook fails on `check-symlinks` and `forbid-binary` - GitLab CI - - [ ] Commit in _non_-`main` branch runs `validate:lint` and `validate:test-full` - - [ ] Merge to `main` branch runs `validate:lint`, `validate:test-full`, and `release:release` - - [ ] With a new `feat` or `fix` commit releases a new version + - [ ] Commit in _non_-`main` branch runs `validate:lint` and `validate:test-*-full` + - [ ] Merge to `main` branch runs `validate:lint`, `validate:test-*-full`, and `release:release` + - [ ] With a new `feat` or `fix` commit releases a new version in GitHub and GitLab + - [ ] [GitHub - xebis/repository-template ∙ Releases](https://github.com/xebis/repository-template/releases) + - [ ] [GitLab - xebis/repository-template ∙ Releases](https://gitlab.com/xebis/repository-template/-/releases) - [ ] Without a new feature or fix commit does not release a new version - - [ ] Scheduled (nightly) pipeline runs `validate:lint` and `validate:test-nightly` + - [ ] Scheduled (nightly) pipeline runs `validate:lint` and `validate:test-*-nightly` #### Test at Docker Container From 53fecc3b1cc87d5593eebad505573ff98709da98 Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 08:42:50 +0100 Subject: [PATCH 5/6] ci: fix ci fails on missing token for gitlab ci linter --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27b1d50..81371ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ variables: variables: PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip PRE_COMMIT_HOME: $CI_PROJECT_DIR/.cache/pre-commit + GITLAB_PRIVATE_TOKEN: $GL_TOKEN # Skip protect-first-parent pre-commit hook until `[ERROR] caught error 1 on line 69 of ...: FIRST_PARENT="$(git show-ref -s "${BASE}")"` is fixed SKIP: check-hooks-apply,protect-first-parent before_script: From 28b73adf5501975d62c0fe1893a3004ab7a4286b Mon Sep 17 00:00:00 2001 From: Martin Bruzina Date: Mon, 1 Jan 2024 08:55:41 +0100 Subject: [PATCH 6/6] chore(update): update pre-commit and shellib --- .pre-commit-config.yaml | 4 ++-- README.md | 1 - scripts/shellib | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51aa1c3..662699a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: hooks: - id: codespell - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.37.0 + rev: v0.38.0 hooks: - id: markdownlint - repo: https://github.com/adrienverge/yamllint.git @@ -88,6 +88,6 @@ repos: language: system types: [shell] - repo: https://github.com/gitleaks/gitleaks - rev: v8.17.0 + rev: v8.18.1 hooks: - id: gitleaks diff --git a/README.md b/README.md index e95fa5a..534901a 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,6 @@ bats tests ## To-Do list -- [ ] Fix workaround for pre-commit `jumanjihouse/pre-commit-hooks` hook `script-must-have-extension` - `*.bats` shouldn't be excluded - [ ] Fix workaround for pre-commit `local` hook `shellcheck` - shellcheck has duplicated parameters from `.shellcheckrc`, because these are not taken into account ## Roadmap diff --git a/scripts/shellib b/scripts/shellib index e99c5a3..5c2122d 160000 --- a/scripts/shellib +++ b/scripts/shellib @@ -1 +1 @@ -Subproject commit e99c5a39e22503963bd7b9be56115b384415cdbd +Subproject commit 5c2122d7ea0d6fb30bb3e5f477d7a6890f1d0aa6