Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
ci(GITHUB): integrate cicd-tools (internal)
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Jun 29, 2023
1 parent e7759fe commit 8cecaf6
Show file tree
Hide file tree
Showing 46 changed files with 651 additions and 1,426 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-template-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_CONCURRENCY }}
PYTHON_VERSIONS: ${{ toJSON(fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_PYTHON_VERSIONS) }}
REMOTE_TEST_TAG: "0.1.0"
REMOTE_RELEASE_WORKFLOW: ""
REMOTE_RELEASE_WORKFLOW: "flower-generator-github-workflow-publish-to-galaxy"
SCENARIO_TRIGGER_BASE_BRANCH_PUSH: "0.toml_linting-0.workflow_linting"
SCENARIO_TRIGGER_DEV_BRANCH_PUSH: "1.toml_linting-1.workflow_linting"
SCENARIO_TRIGGER_TAG_PUSH: "0.toml_linting-0.workflow_linting"
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This [cookiecutter](https://cookiecutter.readthedocs.io/) template generates a d
- You'll need [Python](https://www.python.org/) **3.9** or later to use this template. ([Ansible](https://www.ansible.com/) now requires this.)

## Optional Requirements
- A container runtime environment such as [Docker](https://www.docker.com/) is recommended, to make use of the configured [pre-commit](https://pre-commit.com/) hooks.
- An account on [Ansible Galaxy](https://galaxy.ansible.com/) is recommended if you intend to publish your role.
- An account on [GitHub](https://github.com/) is recommended to make use of the [templated CI/CD]({{cookiecutter.project_slug}}/.github/workflows).
- A configured [Slack Webhook](https://api.slack.com/messaging/webhooks) is also recommended for keeping tabs on the CI/CD.
Expand Down Expand Up @@ -80,6 +81,9 @@ The template also presents the option to render a [pre-commit](https://pre-commi
- This is the most robust TOML formatter I'm aware of right now.
- However, it requires installing the binary on your local system.

This project makes use of the [CICD-Tools]() project, and leverages its utility container to provide this and other binaries. This simplifies and makes the experience mostly transparent to the end user.


If you'd like to install it and give it a try:
- You can download the latest binary [here](https://github.com/pelletier/go-toml/releases).
- Alternatively, your OS's package manager may support this tool.
Expand All @@ -93,7 +97,7 @@ A fundamental pillar of Ansible Workbench is the use of [Conventional Commits](h

#### 1. Why Conventional Commits?
- Following this standard has numerous advantages, but among the largest is its tight integration with [Semantic Versioning](https://semver.org/).
- For the Ansible Workbench CI/CD in particular, [changelog generation]({{cookiecutter.project_slug}}/.github/scripts/job-99-create-changelog.sh) and [release automation]({{cookiecutter.project_slug}}/.github/deactivated/workflow-publish-to-galaxy.yml) is made possible through adherence to this format.
- For the Ansible Workbench CI/CD in particular, changelog generation [release automation]({{cookiecutter.project_slug}}/.github/workflows/workflow-publish-to-galaxy.yml) is made possible through adherence to this format.
- Being able to read commits from different people that conform to common standard also makes [interactive rebasing](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History) relatively painless.

#### 2. Making A Conventional Commit With Commitizen
Expand Down Expand Up @@ -141,7 +145,7 @@ To add tests to your role, create new scenarios with Molecule:

#### iii. Add Your New Scenarios to CI/CD

If you are using the rendered [GitHub CI/CD]({{cookiecutter.project_slug}}/.github/deactivated/workflow-push.yml), make sure to add your new scenario to the list that are tested in the `molecule_test` step.
If you are using the rendered [GitHub CI/CD]({{cookiecutter.project_slug}}/.github/workflows/workflow-push.yml), make sure to add your new scenario to the list that are tested in the `molecule_test` step.

### 2. The Recommended Ansible Galaxy Settings

Expand Down Expand Up @@ -201,7 +205,7 @@ You'll need to create some [secrets](https://docs.github.com/en/actions/security

To make the most out of your [templated CI/CD]({{cookiecutter.project_slug}}/.github/workflows), create the following secrets:
- `SLACK_WEBHOOK`: This secret value can optionally be set to a [Slack Webhook](https://api.slack.com/messaging/webhooks) you can configure to get status updates on how your commit is proceeding through the CI/CD.
- The verbosity of this integration can be controlled by setting the `VERBOSE_NOTIFICATIONS` environment variable to 1 in [this]({{cookiecutter.project_slug}}/.github/deactivated/workflow-push.yml) workflow.
- The verbosity of this integration can be controlled by setting the `ci_verbose_notifications` setting in [this]({{cookiecutter.project_slug}}/.github/config/workflows/workflow-push.json) rendered json file.
- See this documentation on how to create a [Slack Webhook](https://api.slack.com/messaging/webhooks) for your team.
- `GALAXY_API_KEY`: This secret API key can be found on your [Ansible Galaxy](https://galaxy.ansible.com/) account page, and enables automated publishing to Galaxy.
- If you do not wish to publish your role, simply leave this secret unset.
Expand Down Expand Up @@ -269,7 +273,7 @@ Tag your release with [Semantic Versioning](https://semver.org/). (Avoid prefix

#### iv. Publishing Your Release to Ansible Galaxy
- If you have configured a [secret](#2-Setting-Up-Your-CICD) for Ansible Galaxy more automation will now begin **after** you've published your GitHub release.
- The [release workflow]({{cookiecutter.project_slug}}/.github/deactivated/workflow-publish-to-galaxy.yml) will be triggered, and will publish your release automatically to [Ansible Galaxy](https://galaxy.ansible.com/).
- The [release workflow]({{cookiecutter.project_slug}}/.github/workflows/workflow-publish-to-galaxy.yml) will be triggered, and will publish your release automatically to [Ansible Galaxy](https://galaxy.ansible.com/).

## License

Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ warn_list:
# - all

# Offline mode disables installation of requirements.yml and schema refreshing
offline: true
# offline: true

# Return success if number of violations compared with previous git
# commit has not increased. This feature works only in git
Expand Down
5 changes: 0 additions & 5 deletions {{cookiecutter.project_slug}}/.cicd-tools/configuration.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "0.1.0",
"description": "Ansible Workbench GitHub Ansible Galaxy Publish Workflow Schema",
"additionalProperties": false,
"required": [
"ci_python_version",
"ci_verbose_notifications"
],
"type": "object",
"uniqueItems": true,
"properties": {
"ci_python_version": {
"description": "This array contains the list of Python versions the workflow steps will execute on.",
"pattern": "^3\\.[0-9]$",
"type": "string"
},
"ci_verbose_notifications": {
"description": "This enables success notifications for each job in the GitHub workflows.",
"type": "boolean"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "0.1.0",
"description": "Ansible Workbench GitHub Push Workflow Schema",
"additionalProperties": false,
"required": [
"ci_commit_spelling_rev_range",
"ci_commitizen_rev_range",
"ci_concurrency_limit",
"ci_extra_release_content",
"ci_molecule_excluded_scenarios_regex",
"ci_molecule_test_platforms",
"ci_python_versions",
"ci_trufflehog_extra_scan_args",
"ci_verbose_notifications"
],
"type": "object",
"uniqueItems": true,
"properties": {
"ci_commit_spelling_rev_range": {
"description": "This is the fallback commit range for commit spelling checks. This should contain the id of the first correctly spelled commit in this repo, or HEAD for all commits.",
"type": "string"
},
"ci_commitizen_rev_range": {
"description": "This is the fallback commit range for commitizen to lint. This should contain the id of the first linted commit in this repo, or HEAD for all commits.",
"type": "string"
},
"ci_concurrency_limit": {
"description": "This controls the concurrency of each matrix instance in GitHub Actions.",
"type": "number"
},
"ci_extra_release_content": {
"description": "This controls the concurrency of each matrix instance in GitHub Actions.",
"type": "array",
"contains": {
"type": "string"
}
},
"ci_molecule_excluded_scenarios_regex": {
"description": "This regex controls which molecule scenarios are NOT scheduled to execute in CI.",
"type": "string"
},
"ci_molecule_test_platforms": {
"description": "This is the name of the GitHub Action platform the test scenarios will execute on. Please see https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners.",
"type": "array",
"contains": {
"type": "string"
}
},
"ci_python_versions": {
"description": "This array contains the list of Python versions the workflow steps will execute on.",
"type": "array",
"contains": {
"pattern": "^3\\.[0-9]$",
"type": "string"
}
},
"ci_trufflehog_extra_scan_args": {
"description": "This is a space separated list of extra arguments you can pass to the trufflehog binary.",
"type": "string"
},
"ci_verbose_notifications": {
"description": "This enables success notifications for each job in the GitHub workflows.",
"type": "boolean"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ci_python_version": "{{ cookiecutter._GITHUB_CI_DEFAULT_PYTHON_VERSIONS | first }}",
"ci_verbose_notifications": {{ cookiecutter._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS | tojson }}
"ci_verbose_notifications": true
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"ci_commitzen_rev_range": "HEAD",
"ci_commit_spelling_rev_range": "HEAD",
"ci_commitizen_rev_range": "HEAD",
"ci_concurrency_limit": 4,
"ci_extra_release_content": [
"## Customizable Text.",
"This message is appended to the changelog of your GitHub release."
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8cecaf6

Please sign in to comment.