Skip to content

Commit 47070e4

Browse files
committed
Let Ansible handle repository filtering
This fixes repository indexing (fixes #411), and makes config/repositories.yaml authoritative (again) on the operator configuration.
1 parent de76d11 commit 47070e4

File tree

4 files changed

+25
-93
lines changed

4 files changed

+25
-93
lines changed

.github/workflows/generate_prs.yml

Lines changed: 21 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -27,83 +27,26 @@ jobs:
2727
runs-on: ubuntu-latest
2828
strategy:
2929
fail-fast: ${{ inputs.fail-fast }}
30-
# If you add a new repository here, also add it to config/repositories.yaml
3130
matrix:
31+
# This should be the list of repository names from config/repositories.yaml:
32+
# yq '.repositories | map(.name)' config/repositories.yaml
3233
repository:
33-
- name: airflow-operator
34-
pretty_string: Apache Airflow
35-
product_string: airflow
36-
url: stackabletech/airflow-operator.git
37-
- name: commons-operator
38-
include_productconfig: false
39-
has_product: false
40-
pretty_string: Stackable Commons
41-
product_string: commons
42-
url: stackabletech/commons-operator.git
43-
- name: druid-operator
44-
pretty_string: Apache Druid
45-
product_string: druid
46-
url: stackabletech/druid-operator.git
47-
- name: hbase-operator
48-
pretty_string: Apache HBase
49-
product_string: hbase
50-
url: stackabletech/hbase-operator.git
51-
- name: hdfs-operator
52-
pretty_string: Apache HDFS
53-
product_string: hdfs
54-
url: stackabletech/hdfs-operator.git
55-
- name: hive-operator
56-
pretty_string: Apache Hive
57-
product_string: hive
58-
url: stackabletech/hive-operator.git
59-
- name: kafka-operator
60-
pretty_string: Apache Kafka
61-
product_string: kafka
62-
url: stackabletech/kafka-operator.git
63-
- name: nifi-operator
64-
pretty_string: Apache NiFi
65-
product_string: nifi
66-
url: stackabletech/nifi-operator.git
67-
- name: listener-operator
68-
include_productconfig: false
69-
has_product: false
70-
pretty_string: Stackable Listener Operator
71-
product_string: listener-operator
72-
run_as: custom
73-
url: stackabletech/listener-operator.git
74-
- name: opa-operator
75-
extra_crates:
76-
- stackable-opa-bundle-builder
77-
pretty_string: OpenPolicyAgent
78-
product_string: opa
79-
url: stackabletech/opa-operator.git
80-
- name: opensearch-operator
81-
pretty_string: OpenSearch
82-
product_string: opensearch
83-
url: stackabletech/opensearch-operator.git
84-
- name: secret-operator
85-
include_productconfig: false
86-
has_product: false
87-
pretty_string: Stackable Secret Operator
88-
product_string: secret-operator
89-
run_as: custom
90-
url: stackabletech/secret-operator.git
91-
- name: spark-k8s-operator
92-
pretty_string: Apache Spark-on-Kubernetes
93-
product_string: spark-k8s
94-
url: stackabletech/spark-k8s-operator.git
95-
- name: superset-operator
96-
pretty_string: Apache Superset
97-
product_string: superset
98-
url: stackabletech/superset-operator.git
99-
- name: trino-operator
100-
pretty_string: Trino
101-
product_string: trino
102-
url: stackabletech/trino-operator.git
103-
- name: zookeeper-operator
104-
pretty_string: Apache ZooKeeper
105-
product_string: zookeeper
106-
url: stackabletech/zookeeper-operator.git
34+
- airflow-operator
35+
- commons-operator
36+
- druid-operator
37+
- hbase-operator
38+
- hdfs-operator
39+
- hive-operator
40+
- kafka-operator
41+
- nifi-operator
42+
- listener-operator
43+
- opa-operator
44+
- opensearch-operator
45+
- secret-operator
46+
- spark-k8s-operator
47+
- superset-operator
48+
- trino-operator
49+
- zookeeper-operator
10750
steps:
10851
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
10952
with:
@@ -148,24 +91,14 @@ jobs:
14891
echo "AUTHOR=stackabletech/developers"
14992
echo "REASON=Daily run triggered" >> "$GITHUB_ENV"
15093
151-
- name: Overwrite repositories.yaml for ${{ matrix.repository.name }}
152-
run: |
153-
cat >config/repositories.yaml <<CONFIG
154-
---
155-
repositories:
156-
- ${{ toJSON(matrix.repository) }}
157-
CONFIG
158-
159-
# For debugging
160-
cat config/repositories.yaml
161-
16294
- name: Run playbook
16395
env:
16496
CUSTOM_PR_TITLE: ${{ inputs.custom-pr-title }}
16597
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
166-
# --tags local excludes all actions that actually generate PRs
98+
REPOSITORY: ${{ matrix.repository }}
99+
# tags local excludes all actions that actually generate PRs
167100
DRY_RUN_FLAGS: ${{ inputs.dry-run && "--tags local" || "" }}
168101
run: |
169102
# Funnel via JSON to ensure that values are escaped properly
170-
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, custom_pr_title: $ENV.CUSTOM_PR_TITLE, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN} | with_entries(select(.value != null and .value != ""))' --arg pwd "$(pwd)" > vars.json
103+
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, custom_pr_title: $ENV.CUSTOM_PR_TITLE, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN, shard_repositories: [$ENV.REPOSITORY]} | with_entries(select(.value != null and .value != ""))' --arg pwd "$(pwd)" > vars.json
171104
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json" $DRY_RUN_FLAGS

config/repositories.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# This file exists just for the purpose of running test.sh locally.
2-
# The GH workflow generate_prs.yml will overwrite it with the contents if the
3-
# matrix run.
4-
# If you add a new repository here, you also need to add it to that workflow file.
1+
# If you add a new repository here, you also need to add it to the list of
2+
# repositories in ../.github/workflows/generate_prs.yaml.
53
---
64
repositories:
75
- name: airflow-operator

playbook/playbook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
- name: Update repositories from templates
2626
include_tasks: "update_repo.yaml"
27+
when: shard_repositories is undefined or operator.name in shard_repositories
2728
with_items: "{{ repositories }}"
2829
loop_control:
2930
loop_var: operator

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
rm -fr work || true
44
mkdir -p work
5-
ansible-playbook playbook/playbook.yaml --tags "local" --extra-vars "gh_access_token=unneeded base_dir=$(pwd) commit_hash=12345 reason='original message'"
5+
ansible-playbook playbook/playbook.yaml --tags "local" --extra-vars "gh_access_token=unneeded base_dir=$(pwd) commit_hash=12345 reason='original message'" "$@"

0 commit comments

Comments
 (0)