Skip to content

Commit 7c43a79

Browse files
committed
refactor: Added per-playbook subdirs and automation for linting and releasing
Added linting CI jobs to process all .yml files within the ./playbooks/<item name>/ subdirectories BREAKING CHANGE: All playbook files migrated from root dir to per-playbook subdirs
1 parent 6090488 commit 7c43a79

14 files changed

Lines changed: 7038 additions & 66 deletions

File tree

.ansible-lint-ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
playbooks/jupytherhub-flavour/jupytherhub-flavour.yml var-naming[no-role-prefix]
2+
playbooks/ecmwf-data-flavour/ecmwf-data-flavour.yml var-naming[no-role-prefix]

.github/workflows/lint.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Ansible Lint
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.yml'
7+
pull_request:
8+
paths:
9+
- '**/*.yml'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
lint:
17+
name: Lint
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
strategy:
22+
matrix:
23+
python-version: ['3.9']
24+
env:
25+
ANSIBLE_PATH: ./playbooks
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Install dependencies
36+
run: pip install ansible~=8.7 ansible-lint~=6.22
37+
38+
- name: Run ansible-lint
39+
run: ansible-lint --offline ${{ env.ANSIBLE_PATH }}

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Semantic Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Ansible Lint"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
name: Release
16+
runs-on: ubuntu-latest
17+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "lts/*"
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Verify dependency signatures
33+
run: npm audit signatures || echo "Some dependency signatures could not be verified!"
34+
35+
- name: Run semantic-release
36+
run: npx semantic-release
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Create and push release branch
41+
if: env.VERSION != ''
42+
run: |
43+
git checkout main
44+
git pull origin main
45+
git checkout -b release/${{ env.VERSION }}
46+
git push origin release/${{ env.VERSION }}
47+
echo "Created and pushed release branch: release/${{ env.VERSION }}"

.releaserc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"tagFormat": "${version}",
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "angular"
11+
}
12+
],
13+
[
14+
"@semantic-release/release-notes-generator",
15+
{
16+
"preset": "angular"
17+
}
18+
],
19+
[
20+
"@semantic-release/changelog",
21+
{
22+
"changelogTitle": "# Changelog\n\nAll notable changes to this project are documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
23+
}
24+
],
25+
[
26+
"@semantic-release/exec",
27+
{
28+
"successCmd": "echo 'VERSION=${nextRelease.version}' >> $GITHUB_ENV"
29+
}
30+
],
31+
[
32+
"@semantic-release/git",
33+
{
34+
"assets": ["CHANGELOG.md"],
35+
"message": "chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
36+
}
37+
]
38+
]
39+
}

CONTRIBUTING.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# How to Contribute
2+
3+
This project is [licensed](./LICENSE) and accepts contributions via GitHub pull
4+
requests. In this document, we outline some of the conventions on development
5+
workflow, commit message formatting, contact points and other resources to make
6+
it easier to get your contribution accepted.
7+
8+
## Getting Started
9+
10+
* Fork the repository.
11+
* Read the [README.md](./README.md) for usage/test instructions.
12+
* Play with the project, submit bugs or patches.
13+
14+
### Contribution Flow
15+
16+
>💡 This repository uses [GitHub Actions](.github/workflows)
17+
for automation. Changes merged into the main branch trigger the creation of
18+
new tag, an auto-generated [CHANGELOG.md](./CHANGELOG.md) and a new release
19+
branch.
20+
21+
On the contributors' side:
22+
1. Create a topic branch from the main brach to base your work on.
23+
2. Make commits of logical units.
24+
3. Push changes to a topic branch in your GitHub fork of this
25+
repository.
26+
4. Make sure to validate changes by running tests on a
27+
EWC environment.
28+
5. Submit a pull request to this repository, including details on
29+
the steps necessary to reproduce your tests; assign maintainers for
30+
review/approval.
31+
32+
On the maintainers' side:
33+
34+
1. Review, validate/test internally, and provide feedback prior to approving the
35+
pull request.
36+
2. Upon approval, squash-merge the changes, making sure to provide a relevant
37+
conventional commit message title (checkout
38+
[commit guidelines](#commit-guidelines) below).
39+
3. Verify the CI automation updates the [CHANGELOG.md](./CHANGELOG.md),
40+
creates a new `git tag` on the main branch and a release branch.
41+
42+
43+
### Commit Guidelines
44+
45+
This repository enforces
46+
[conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
47+
to mark breaking, major and minor code changes in accordance with the
48+
[Semantic Versioning](https://semver.org/) standard:
49+
- Commits that land on to the main branch should always be prefixed by a
50+
specific keyword (i.e. `docs`, `style`, `feat`, `fix`, `refactor`, `ci`,
51+
`chore` or `test`)
52+
- Value is communicated to the end-users by three of the prefixes:
53+
- `fix:` Patches a bug in your codebase.
54+
- `feat:` Introduces a new feature to the codebase.
55+
- `BREAKING CHANGE:` Introduces a breaking API change. A
56+
`BREAKING CHANGE` can be part of commits of any type.
57+
58+
## Reporting Security Vulnerabilities
59+
60+
Due to their public nature, GitHub and RocketChat are not appropriate places
61+
for reporting vulnerabilities. If you suspect you have found a security
62+
vulnerability, please do not file a GitHub issue, but instead email
63+
[support@europeanweather.cloud](mailto:support@europeanweather.cloud) with the
64+
full details, including steps to reproduce the issue.

README.md

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,27 @@
11
EWC Automation of EWC Instance Flavours
22
=======================================
33

4-
This repository contains Ansible playbooks for customising EWC instances with specific software stacks:
54

6-
- **ECMWF data flavour**: includes the basic ECMWF software stack, with MARS client and an environment with ecCodes, Metview, Earthkit and Aviso.
7-
- **Jupyterhub flavour**: installs and run jupyterhub on your instance, offering a convenient way to access it through the web.
5+
This repository contains Ansible playbooks for customizing EWC instances with specific software stacks:
6+
7+
1. [ECMWF data flavour](./playbooks/ecmwf-data-flavour/): includes the basic ECMWF software stack, with MARS client and an environment with ecCodes, Metview, Earthkit and Aviso.
8+
2. [Jupyterhub flavour](./playbooks/jupyterhub-flavour/): installs and run JupyterHub on your instance, offering a convenient way to access it through the web.
89

910
Getting started
1011
---------------
1112

1213
- Install ansible and other dependencies. You may want to do it in its own virtual environment (`pip install -r requirements.txt`)
1314
- Fetch the external requirements
14-
15-
```bash
16-
ansible-galaxy role install -r requirements.yml roles/
17-
```
18-
19-
- Define your inventory in `inventory`
20-
- Run the apropriate playbook:
21-
22-
```bash
23-
ansible-playbook -i inventory playbookname.yml
24-
```
25-
26-
Available Playbooks
27-
-------------------
28-
29-
- **ECMWF data flavour**. You may use the following ansible variables to customise this playbook:
30-
- `reboot_if_required`: Boolean to reboot the instance if required after an update. Default: true
31-
- `ecmwf_toolbox_env_wipe`: Boolean to decide whether to wipe the environment if exists prior to a reinstallation. Default: no
32-
- `ecmwf_toolbox_env_name`: Name of the environment containing the ECMWF toolbox. Default: ecmwf-toolbox
33-
- `ecmwf_toolbox_create_ipykernel`: Boolean to create a system-wide kernel available. Default: yes
34-
- `conda_prefix`: Prefix where conda is installed. Default: `/opt/conda`
35-
- `conda_user`: User owning the conda installation. Default: `root`
36-
37-
Example usage:
3815

3916
```bash
40-
ansible-playbook -i inventory ecmwf-data-flavour.yml
17+
ansible-galaxy role install -r requirements.yml -p roles/
4118
```
42-
43-
- **Jupyterhub flavour**. You may use the following ansible variables to customise this playbook:
44-
- `jupyterhub_local_cert_email`: If ran outside Morpheus, **pass this variable explicitly when running the ansible playbook.**
45-
- `dns_domain`: **Pass this variable explicitly when running the ansible playbook**. If not present, will try to guess from instance configured hostname in /etc/hostname.
46-
- `jupyterhub_local_env_wipe`: Boolean to decide whether to wipe the environment if exists prior to a reinstallation. Default: no
47-
- `jupyterhub_local_env_name`: Name of the environment containing the Jupyerhub. Default: jupyterhub-local
48-
- `jupyterhub_local_test_cert`: Use Lets encrypt test certificate. Default: false
49-
- `jupyterhub_local_with_otp`: Use OTP authentication for Jupyterhub. It requires manual run of `google-authenticator` by the user to configure your TOTP device after running this playbook Default: false
50-
- `conda_prefix`: Prefix where conda is installed. Default: `/opt/conda`
51-
- `conda_user`: User owning the conda installation. Default: `root`
5219

53-
Example Usage for an instance with Fully Qualified Domain name `jupyterhub.mytenancy.f.ewcloud.host` and registered to the email address `myemail@myorg.com`:
20+
- Define your inventory in `inventory`
21+
- Run the appropriate playbook:
5422

5523
```bash
56-
ansible-playbook -e jupyterhub_local_cert_email=myemail@myorg.com -e dns_domain=jupyterhub.mytenancy.f.ewcloud.host -i inventory jupyterhub-flavour.yml
24+
ansible-playbook -i inventory path/to/playbook/filename
5725
```
5826

5927
License

jupyterhub-flavour.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)