Skip to content

Commit 6cb110d

Browse files
committed
chore: Merge branch 'main' into ci/template-publish-to-quay.io
2 parents b738ac0 + fccd8bc commit 6cb110d

15 files changed

Lines changed: 121 additions & 94 deletions

File tree

.github/workflows/pr_pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
persist-credentials: false
2020
fetch-depth: 0
21-
- uses: stackabletech/actions/run-pre-commit@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
21+
- uses: stackabletech/actions/run-pre-commit@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
2222
with:
2323
python-version: ${{ env.PYTHON_VERSION }}
2424
hadolint: ${{ env.HADOLINT_VERSION }}
Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
= Templates for Common Files in Operator Repositories
1+
# Templates for Common Files in Operator Repositories
22

33
Stackable develops and maintains a growing number of operators for open source software.
44

55
The high level structure of the repository is consistent across all repositories, which in the past has led to repetitive maintenance tasks in many repositories even for small changes.
66

77
This repository is intended to help with these changes by keeping common files as templates and offering tooling to roll these out to all repositories that are under management by this tool.
88

9-
== Structure of this repository
9+
## Structure of this repository
1010

11-
=== GitHub Actions
11+
### GitHub Actions
1212

1313
The definition files for GitHub actions that in turn execute the playbooks doing the actual work are kept in `.github`
1414

15-
=== Playbook
15+
### Playbook
1616

1717
`playbook` contains the ansible playbook which is executed to perform the needed changes.
1818

19-
=== Templates
19+
### Templates
2020

2121
Everything under the top level folder `template` is replicated to the target repositories.
2222
The folder and file structure under `template` is considered as source structure which will be synchronized across all repositories in the following manner:
2323

24-
* Regular files and folders are simply copied
25-
* Files with an extension of `.j2` will be processed as jinja2 templates and copied to the target repositories with the `.j2` extension removed. The default jinja2 variable delimiter has been replaced with `{[ }]` since a lot of the template files contain `{{ }}` and caused issues.
26-
* File and directory names which contain `\[[product]]` will have this substituted for the value of the `product_string` variable. For example: "stackable-\[[product]]-operator.service" would become `stackable-kafka-operator.service`.
24+
- Regular files and folders are simply copied
25+
- Files with an extension of `.j2` will be processed as jinja2 templates and copied to the target repositories with the `.j2` extension removed. The default jinja2 variable delimiter has been replaced with `{[ }]` since a lot of the template files contain `{{ }}` and caused issues.
26+
- File and directory names which contain `\[[product]]` will have this substituted for the value of the `product_string` variable. For example: "stackable-\[[product]]-operator.service" would become `stackable-kafka-operator.service`.
2727

2828
To remove files or directories that already exist in the target repositories these need to be configured in `repositories.yaml` under the `retired_files` key.
2929

3030
Anything that is listed here will be deleted from the target repositories.
3131

32-
NOTE: Deletion is the last step that is performed, so if there is an overlap between files existing in the template folder and this setting, the files would not be rolled out, since they'd get deleted before creating the pull request.
32+
> [!NOTE]
33+
> Deletion is the last step that is performed, so if there is an overlap between files existing in the template folder and this setting, the files would not be rolled out, since they'd get deleted before creating the pull request.
3334
34-
=== Configuration
35+
### Configuration
3536

3637
All user-facing configuration is kept in `repositories.yaml`.
3738

@@ -41,62 +42,51 @@ So in principle it is as simple as pushing any commit to `main` which will trigg
4142

4243
Target repositories are configured in `repositories.yaml` in the following form:
4344

44-
----
45+
```yaml
4546
- name: kafka-operator
4647
url: stackabletech/kafka-operator.git
4748
product_string: kafka
4849
pretty_string: Kafka
49-
----
50-
51-
|===
52-
|Field |Description
53-
54-
|name
55-
|This is only used internally to name working directories and the like.
56-
57-
|url
58-
|The github repository for this operator. Need to be in the form of `<org>/<repo>.git`
59-
60-
|product_string
61-
| A lower case string to use in config files, file names and the like. Should not contain whitespaces. This can sometimes be a shortened version of the full name, for example for Open Policy Agent this would be "opa"
62-
63-
|pretty_string
64-
| The actual name of the product, including whitespaces and proper capitalization. This is intended to be used in doc or man files or similar things.
65-
66-
|include_productconfig
67-
| Whether to include files from the `deploy/config-spec` folder into the os package.
68-
69-
*Default*: true
70-
|===
71-
50+
```
51+
52+
| Field | Description |
53+
| ----- | ----------- |
54+
| `name` | This is only used internally to name working directories and the like. |
55+
| `url` | The github repository for this operator. Need to be in the form of `<org>/<repo>.git`. |
56+
| `product_string` | A lower case string to use in config files, file names and the like. Should not contain whitespaces. This can sometimes be a shortened version of the full name, for example for Open Policy Agent this would be "opa" |
57+
| `pretty_string` | The actual name of the product, including whitespaces and proper capitalization. This is intended to be used in doc or man files or similar things. |
58+
| `config.include_productconfig` | Whether to include files from the `deploy/config-spec` folder into the os package. *Default*: true |
59+
| `config.has_product` | Indicates that the operator manages a product. This is particularly useful to differentiate between core and product operators. *Default*: true |
60+
| `config.run_as` | Whether to run the operator as a default Deployment, or something custom. |
7261

7362
These are the only variables currently being used on the playbooks, but can be extended easily as more are needed.
7463

75-
NOTE: If a new variable is introduced, it needs to be added to all repository objects!
64+
> [!NOTE]
65+
> If a new variable is introduced, it needs to be added to all repository objects!
7666

7767
Additional settings can be found in `playbook/group_vars/all`, but these are not intended to be freely changed and should be treated with care.
7868

79-
80-
== Making changes to the template
69+
## Making changes to the template
8170

8271
If you want to make a change that should be rolled out to all operators, make the change in the `template` directory.
8372
Consult the section above to learn more about the structure of the template.
8473

85-
=== Test changes locally
74+
### Test changes locally
8675

87-
1. Run the `test.sh` script. To limit the run to a single operator, add `--extra-vars "shard_repositories=['nifi-operator']"` (or your choice of operator).
76+
1. Run the `test.sh` script. To limit the run to a single operator, add `--extra-vars "shard_repositories#['nifi-operator']"` (or your choice of operator).
8877
It will automatically delete and recreate a `work` directory.
8978
2. The changes can be examined with `git status`.
9079
When the pull request is later merged into the `main` branch then pull requests with these changes will be created automatically.
9180
3. Depending on the change, it makes sense to run the integration tests for all changed operators.
9281
If the tests are not run in this stage and if there is even just one integration test failing in the subsequential generated pull requests then the operator-templating must be adapted which creates again pull requests for all operators.
9382
Changes in the GitHub workflow actions cannot be tested until finally merged.
9483

95-
== Deploying changes
84+
## Deploying changes
9685

9786
Changes are rolled out via GitHub actions.
9887

99-
=== Authentication
88+
### Authentication
89+
10090
Since this tool needs to authenticate itself in order to push commits it needs credentials of a user.
10191
This is currently solved via a personal access token that needs to be provided as a repository (or org) secret with the name `GH_ACCESS_TOKEN`.
10292

@@ -106,9 +96,11 @@ The personal access token needs to have the following permissions for this to wo
10696
- org:read
10797
- workflow
10898

109-
== Limitations
99+
## Limitations
100+
110101
There is currently no synchronization with existing PRs on the target repositories whatsoever. A new pull request will be created for every commit made to this repository.
111102

112103
To update a PR that was created via this tool, it will have to be closed and necessary changes pushed here, which will result in a new PR.
113104

114-
WARNING: The Helm Chart files that are rolled out by the templates in their current form do not include a ClusterRole object which may be needed for this to work with RBAC.
105+
> [!WARNING]
106+
> The Helm Chart files that are rolled out by the templates in their current form do not include a ClusterRole object which may be needed for this to work with RBAC.

config/repositories.yaml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,72 +6,91 @@ repositories:
66
pretty_string: Apache Airflow
77
product_string: airflow
88
url: stackabletech/airflow-operator.git
9+
910
- name: commons-operator
10-
include_productconfig: false
11-
has_product: false
1211
pretty_string: Stackable Commons
1312
product_string: commons
1413
url: stackabletech/commons-operator.git
14+
config:
15+
include_productconfig: false
16+
has_product: false
17+
1518
- name: druid-operator
1619
pretty_string: Apache Druid
1720
product_string: druid
1821
url: stackabletech/druid-operator.git
22+
1923
- name: hbase-operator
2024
pretty_string: Apache HBase
2125
product_string: hbase
2226
url: stackabletech/hbase-operator.git
27+
2328
- name: hdfs-operator
2429
pretty_string: Apache HDFS
2530
product_string: hdfs
2631
url: stackabletech/hdfs-operator.git
32+
2733
- name: hive-operator
2834
pretty_string: Apache Hive
2935
product_string: hive
3036
url: stackabletech/hive-operator.git
37+
3138
- name: kafka-operator
3239
pretty_string: Apache Kafka
3340
product_string: kafka
3441
url: stackabletech/kafka-operator.git
42+
3543
- name: nifi-operator
3644
pretty_string: Apache NiFi
3745
product_string: nifi
3846
url: stackabletech/nifi-operator.git
47+
3948
- name: listener-operator
40-
include_productconfig: false
41-
has_product: false
4249
pretty_string: Stackable Listener Operator
4350
product_string: listener-operator
44-
run_as: custom
4551
url: stackabletech/listener-operator.git
52+
config:
53+
include_productconfig: false
54+
has_product: false
55+
run_as: custom
56+
4657
- name: opa-operator
47-
extra_crates:
48-
- stackable-opa-bundle-builder
4958
pretty_string: OpenPolicyAgent
5059
product_string: opa
5160
url: stackabletech/opa-operator.git
61+
config:
62+
extra_crates:
63+
- stackable-opa-bundle-builder
64+
5265
- name: opensearch-operator
5366
pretty_string: OpenSearch
5467
product_string: opensearch
5568
url: stackabletech/opensearch-operator.git
69+
5670
- name: secret-operator
57-
include_productconfig: false
58-
has_product: false
5971
pretty_string: Stackable Secret Operator
6072
product_string: secret-operator
61-
run_as: custom
6273
url: stackabletech/secret-operator.git
74+
config:
75+
include_productconfig: false
76+
has_product: false
77+
run_as: custom
78+
6379
- name: spark-k8s-operator
6480
pretty_string: Apache Spark-on-Kubernetes
6581
product_string: spark-k8s
6682
url: stackabletech/spark-k8s-operator.git
83+
6784
- name: superset-operator
6885
pretty_string: Apache Superset
6986
product_string: superset
7087
url: stackabletech/superset-operator.git
88+
7189
- name: trino-operator
7290
pretty_string: Trino
7391
product_string: trino
7492
url: stackabletech/trino-operator.git
93+
7594
- name: zookeeper-operator
7695
pretty_string: Apache ZooKeeper
7796
product_string: zookeeper

playbook/group_vars/all/vars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author_mail: "github@stackable.de"
55
# Defines which subdirectory to check the target repos out in
66
work_dir: "{{ base_dir }}/work"
77

8-
# Directory containinng the template structure to roll out
8+
# Directory containing the template structure to roll out
99
template_dir: "{{ base_dir }}/template"
1010

1111
# The name for the branch that will be created and from which the pr will be initialized

template/.github/ISSUE_TEMPLATE/02-bug_report.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
label: Affected Stackable version
1313
description: Which version of the Stackable Operator do you see this bug in?
1414

15-
# {[%- if operator.has_product | default(true) +%}]
15+
# {[%- if operator.config.has_product | default(true) +%}]
1616
- type: input
1717
attributes:
1818
label: Affected {[ operator.pretty_string }] version

template/.github/workflows/build.yaml.j2

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Check for changed files
5050
id: check
51-
uses: stackabletech/actions/detect-changes@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
51+
uses: stackabletech/actions/detect-changes@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
5252
with:
5353
patterns: |
5454
- '.github/workflows/build.yaml'
@@ -166,7 +166,7 @@ jobs:
166166

167167
- name: Build Container Image
168168
id: build
169-
uses: stackabletech/actions/build-container-image@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
169+
uses: stackabletech/actions/build-container-image@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
170170
with:
171171
image-name: ${{ env.OPERATOR_NAME }}
172172
image-index-manifest-tag: ${{ steps.version.outputs.OPERATOR_VERSION }}
@@ -175,7 +175,7 @@ jobs:
175175

176176
- name: Publish Container Image (oci.stackable.tech)
177177
if: ${{ !github.event.pull_request.head.repo.fork }}
178-
uses: stackabletech/actions/publish-image@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
178+
uses: stackabletech/actions/publish-image@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
179179
with:
180180
image-registry-uri: oci.stackable.tech
181181
image-registry-username: robot$sdp+github-action-build
@@ -186,7 +186,7 @@ jobs:
186186

187187
- name: Publish Container Image (quay.io)
188188
if: ${{ !github.event.pull_request.head.repo.fork }}
189-
uses: stackabletech/actions/publish-image@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
189+
uses: stackabletech/actions/publish-image@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
190190
with:
191191
image-registry-uri: quay.io
192192
image-registry-username: stackable+robot_sdp_github_action_build # Doesn't exist yet
@@ -214,7 +214,7 @@ jobs:
214214
persist-credentials: false
215215

216216
- name: Publish and Sign Image Index (oci.stackable.tech)
217-
uses: stackabletech/actions/publish-image-index-manifest@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
217+
uses: stackabletech/actions/publish-image-index-manifest@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
218218
with:
219219
image-registry-uri: oci.stackable.tech
220220
image-registry-username: robot$sdp+github-action-build
@@ -223,7 +223,7 @@ jobs:
223223
image-index-manifest-tag: ${{ needs.build-container-image.outputs.operator-version }}
224224

225225
- name: Publish and Sign Image Index (quay.io)
226-
uses: stackabletech/actions/publish-image-index-manifest@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
226+
uses: stackabletech/actions/publish-image-index-manifest@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
227227
with:
228228
image-registry-uri: quay.io
229229
image-registry-username: stackable+robot_sdp_github_action_build # Doesn't exist yet
@@ -250,7 +250,7 @@ jobs:
250250
submodules: recursive
251251

252252
- name: Package, Publish, and Sign Helm Chart (coi.stackable.tech)
253-
uses: stackabletech/actions/publish-helm-chart@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
253+
uses: stackabletech/actions/publish-helm-chart@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
254254
with:
255255
chart-registry-uri: oci.stackable.tech
256256
chart-registry-username: robot$sdp-charts+github-action-build
@@ -262,7 +262,7 @@ jobs:
262262
publish-and-sign: ${{ !github.event.pull_request.head.repo.fork }}
263263

264264
- name: Package, Publish, and Sign Helm Chart (quay.io)
265-
uses: stackabletech/actions/publish-helm-chart@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
265+
uses: stackabletech/actions/publish-helm-chart@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
266266
with:
267267
chart-registry-uri: quay.io
268268
chart-registry-username: stackable+robot_sdp_charts_github_action_build # Doesn't exist yet
@@ -292,13 +292,13 @@ jobs:
292292
runs-on: ubuntu-latest
293293
steps:
294294
- name: Run OpenShift Preflight Check (oci.stackable.tech)
295-
uses: stackabletech/actions/run-openshift-preflight@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
295+
uses: stackabletech/actions/run-openshift-preflight@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
296296
with:
297297
image-index-uri: oci.stackable.tech/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
298298
image-architecture: ${{ matrix.arch }}
299299

300300
- name: Run OpenShift Preflight Check (quay.io)
301-
uses: stackabletech/actions/run-openshift-preflight@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
301+
uses: stackabletech/actions/run-openshift-preflight@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
302302
with:
303303
image-index-uri: quay.io/stackable/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
304304
image-architecture: ${{ matrix.arch }}
@@ -338,7 +338,7 @@ jobs:
338338
persist-credentials: false
339339

340340
- name: Send Notification
341-
uses: stackabletech/actions/send-slack-notification@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
341+
uses: stackabletech/actions/send-slack-notification@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
342342
with:
343343
publish-helm-chart-result: ${{ needs.publish-helm-chart.result }}
344344
publish-manifests-result: ${{ needs.publish-index-manifest.result }}

template/.github/workflows/integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# TODO: Enable the scheduled runs which hard-code what profile to use
4242
- name: Run Integration Test
4343
id: test
44-
uses: stackabletech/actions/run-integration-test@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
44+
uses: stackabletech/actions/run-integration-test@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
4545
with:
4646
replicated-api-token: ${{ secrets.REPLICATED_API_TOKEN }}
4747
test-mode-input: ${{ inputs.test-mode-input }}
@@ -51,7 +51,7 @@ jobs:
5151

5252
- name: Send Notification
5353
if: ${{ failure() || github.run_attempt > 1 }}
54-
uses: stackabletech/actions/send-slack-notification@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
54+
uses: stackabletech/actions/send-slack-notification@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
5555
with:
5656
slack-token: ${{ secrets.SLACK_INTEGRATION_TEST_TOKEN }}
5757
failed-tests: ${{ steps.test.outputs.failed-tests }}

template/.github/workflows/pr_pre-commit.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
persist-credentials: false
2828
submodules: recursive
2929
fetch-depth: 0
30-
- uses: stackabletech/actions/run-pre-commit@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
30+
- uses: stackabletech/actions/run-pre-commit@6a84fcfccf4ee37d85217407bc6a94742afbb45f # v0.14.2
3131
with:
3232
python-version: ${{ env.PYTHON_VERSION }}
3333
rust: ${{ env.RUST_TOOLCHAIN_VERSION }}

0 commit comments

Comments
 (0)