Skip to content

Commit ece238e

Browse files
author
Martin Jackson
committed
Add 'common/' from commit '4d0774c9ae9a76b13f0c51135bb625a26389cd99'
git-subtree-dir: common git-subtree-mainline: f0abca4 git-subtree-split: 4d0774c
2 parents f0abca4 + 4d0774c commit ece238e

File tree

288 files changed

+74105
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+74105
-0
lines changed

common/.ansible-lint

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Vim filetype=yaml
2+
---
3+
offline: false
4+
skip_list:
5+
- name[template] # Allow Jinja templating inside task and play names
6+
- template-instead-of-copy # Templated files should use template instead of copy
7+
- yaml[line-length] # too long lines
8+
- yaml[indentation] # Forcing lists to be always indented by 2 chars is silly IMO
9+
- var-naming[no-role-prefix] # This would be too much churn for very little gain
10+
- no-changed-when
11+
- var-naming[no-role-prefix] # There are too many changes now and it would be too risky
12+
13+
# ansible-lint gh workflow cannot find ansible.cfg hence fails to import vault_utils role
14+
exclude_paths:
15+
- ./ansible/playbooks/vault/vault.yaml
16+
- ./ansible/playbooks/iib-ci/iib-ci.yaml
17+
- ./ansible/playbooks/k8s_secrets/k8s_secrets.yml
18+
- ./ansible/playbooks/process_secrets/process_secrets.yml
19+
- ./ansible/playbooks/process_secrets/display_secrets_info.yml
20+
- ./ansible/roles/vault_utils/tests/test.yml

common/.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
version: 2
3+
updates:
4+
# Check for updates to GitHub Actions every week
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+

common/.github/linters/.gitleaks.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[whitelist]
2+
# As of v4, gitleaks only matches against filename, not path in the
3+
# files directive. Leaving content for backwards compatibility.
4+
files = [
5+
"ansible/plugins/modules/*.py",
6+
"ansible/tests/unit/test_*.py",
7+
"ansible/tests/unit/v1/*.yaml",
8+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"default": true,
3+
"MD003": false,
4+
"MD013": false,
5+
"MD033": false
6+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Ansible Lint # feel free to pick your own name
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
# Important: This sets up your GITHUB_WORKSPACE environment variable
11+
- uses: actions/checkout@v4
12+
13+
- name: Lint Ansible Playbook
14+
uses: ansible/ansible-lint-action@v6
15+
# Let's point it to the path
16+
with:
17+
path: "ansible/"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Ansible unit tests
3+
4+
#
5+
# Documentation:
6+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
7+
#
8+
9+
#############################
10+
# Start the job on all push #
11+
#############################
12+
on: [push, pull_request]
13+
14+
###############
15+
# Set the Job #
16+
###############
17+
jobs:
18+
ansible_unittests:
19+
# Name the Job
20+
name: Ansible unit tests
21+
strategy:
22+
matrix:
23+
python-version: [3.11.3]
24+
# Set the agent to run on
25+
runs-on: ubuntu-latest
26+
27+
##################
28+
# Load all steps #
29+
##################
30+
steps:
31+
##########################
32+
# Checkout the code base #
33+
##########################
34+
- name: Checkout Code
35+
uses: actions/checkout@v4
36+
with:
37+
# Full git history is needed to get a proper list of changed files within `super-linter`
38+
fetch-depth: 0
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install pytest ansible
49+
50+
- name: Run make ansible-unittest
51+
run: |
52+
make ansible-unittest
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
name: Create per-chart branches
3+
4+
# We only run this job on the charts that will be later moved to full blown charts
5+
# We also want to run the subtree comand only for the charts that have been actually changed
6+
# because git subtree split is a bit of an expensive operation
7+
# github actions do not support yaml anchors so there is more duplication than usual
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- 'acm/**'
14+
- 'golang-external-secrets/**'
15+
- 'hashicorp-vault/**'
16+
- 'letsencrypt/**'
17+
- 'clustergroup/**'
18+
19+
jobs:
20+
changes:
21+
name: Figure out per-chart changes
22+
if: github.repository == 'validatedpatterns/common'
23+
runs-on: ubuntu-latest
24+
permissions: read-all
25+
outputs:
26+
acm: ${{ steps.filter.outputs.acm }}
27+
golang-external-secrets: ${{ steps.filter.outputs.golang-external-secrets }}
28+
hashicorp-vault: ${{ steps.filter.outputs.hashicorp-vault }}
29+
letsencrypt: ${{ steps.filter.outputs.letsencrypt }}
30+
clustergroup: ${{ steps.filter.outputs.clustergroup }}
31+
steps:
32+
- name: Checkout Code
33+
uses: actions/checkout@v4
34+
35+
- uses: dorny/paths-filter@v3
36+
id: filter
37+
with:
38+
filters: |
39+
acm:
40+
- 'acm/**'
41+
golang-external-secrets:
42+
- 'golang-external-secrets/**'
43+
hashicorp-vault:
44+
- 'hashicorp-vault/**'
45+
letsencrypt:
46+
- 'letsencrypt/**'
47+
clustergroup:
48+
- 'clustergroup/**'
49+
50+
acm:
51+
needs: changes
52+
if: |
53+
${{ needs.changes.outputs.acm == 'true' }} &&
54+
github.repository == 'validatedpatterns/common'
55+
uses: validatedpatterns/common/.github/workflows/chart-split.yml@main
56+
permissions:
57+
actions: write
58+
contents: write
59+
with:
60+
chart_name: acm
61+
target_repository: validatedpatterns/acm-chart
62+
secrets: inherit
63+
64+
golang-external-secrets:
65+
needs: changes
66+
if: |
67+
${{ needs.changes.outputs.golang-external-secrets == 'true' }} &&
68+
github.repository == 'validatedpatterns/common'
69+
uses: validatedpatterns/common/.github/workflows/chart-split.yml@main
70+
permissions:
71+
actions: write
72+
contents: write
73+
with:
74+
chart_name: golang-external-secrets
75+
target_repository: validatedpatterns/golang-external-secrets-chart
76+
secrets: inherit
77+
78+
hashicorp-vault:
79+
needs: changes
80+
if: |
81+
${{ needs.changes.outputs.hashicorp-vault == 'true' }} &&
82+
github.repository == 'validatedpatterns/common'
83+
uses: validatedpatterns/common/.github/workflows/chart-split.yml@main
84+
permissions:
85+
actions: write
86+
contents: write
87+
with:
88+
chart_name: hashicorp-vault
89+
target_repository: validatedpatterns/hashicorp-vault-chart
90+
secrets: inherit
91+
92+
letsencrypt:
93+
needs: changes
94+
if: |
95+
${{ needs.changes.outputs.letsencrypt == 'true' }} &&
96+
github.repository == 'validatedpatterns/common'
97+
uses: validatedpatterns/common/.github/workflows/chart-split.yml@main
98+
permissions:
99+
actions: write
100+
contents: write
101+
with:
102+
chart_name: letsencrypt
103+
target_repository: validatedpatterns/letsencrypt-chart
104+
secrets: inherit
105+
106+
clustergroup:
107+
needs: changes
108+
if: |
109+
${{ needs.changes.outputs.clustergroup == 'true' }} &&
110+
github.repository == 'validatedpatterns/common'
111+
uses: validatedpatterns/common/.github/workflows/chart-split.yml@main
112+
permissions:
113+
actions: write
114+
contents: write
115+
with:
116+
chart_name: clustergroup
117+
target_repository: validatedpatterns/clustergroup-chart
118+
secrets: inherit
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Split into chart repo branches
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
chart_name:
8+
required: true
9+
type: string
10+
target_repository:
11+
required: true
12+
type: string
13+
14+
jobs:
15+
split_chart:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
actions: write
19+
contents: write
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.CHARTS_REPOS_TOKEN }}
26+
27+
- name: Run git subtree split and push
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.CHARTS_REPOS_TOKEN }}
30+
run: |
31+
set -e
32+
N="${{ inputs.chart_name }}"
33+
B="${N}-main-single-chart"
34+
git push origin -d "${B}" || /bin/true
35+
git subtree split -P "${N}" -b "${B}"
36+
git push -f -u origin "${B}"
37+
#git clone https://validatedpatterns:${GITHUB_TOKEN}@github.com/validatedpatterns/common.git -b "acm-main-single-chart" --single-branch
38+
git push --force https://validatedpatterns:"${GITHUB_TOKEN}"@github.com/${{ inputs.target_repository }}.git "${B}:main"
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Verify json schema
3+
4+
#
5+
# Documentation:
6+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
7+
#
8+
9+
#############################
10+
# Start the job on all push #
11+
#############################
12+
on: [push, pull_request]
13+
14+
###############
15+
# Set the Job #
16+
###############
17+
jobs:
18+
jsonschema_tests:
19+
# Name the Job
20+
name: Json Schema tests
21+
strategy:
22+
matrix:
23+
python-version: [3.11.3]
24+
# Set the agent to run on
25+
runs-on: ubuntu-latest
26+
27+
##################
28+
# Load all steps #
29+
##################
30+
steps:
31+
##########################
32+
# Checkout the code base #
33+
##########################
34+
- name: Checkout Code
35+
uses: actions/checkout@v4
36+
with:
37+
# Full git history is needed to get a proper list of changed files within `super-linter`
38+
fetch-depth: 0
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install check-jsonschema
49+
50+
- name: Verify secrets json schema
51+
run: |
52+
check-jsonschema --schemafile ./ansible/roles/vault_utils/values-secrets.v1.schema.json examples/secrets/values-secret.v1.yaml
53+
check-jsonschema --schemafile ./ansible/roles/vault_utils/values-secrets.v2.schema.json examples/secrets/values-secret.v2.yaml
54+
55+
- name: Verify ClusterGroup values.schema.json
56+
run: |
57+
set -e; for i in examples/*yaml; do echo "$i"; check-jsonschema --schemafile ./clustergroup/values.schema.json "$i"; done

0 commit comments

Comments
 (0)