Skip to content

Restore repository indexing #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 32 additions & 107 deletions .github/workflows/generate_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,83 +27,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: ${{ inputs.fail-fast }}
# If you add a new repository here, also add it to config/repositories.yaml
matrix:
# This should be the list of repository names from config/repositories.yaml:
# yq '.repositories | map(.name)' config/repositories.yaml
repository:
- name: airflow-operator
pretty_string: Apache Airflow
product_string: airflow
url: stackabletech/airflow-operator.git
- name: commons-operator
include_productconfig: false
has_product: false
pretty_string: Stackable Commons
product_string: commons
url: stackabletech/commons-operator.git
- name: druid-operator
pretty_string: Apache Druid
product_string: druid
url: stackabletech/druid-operator.git
- name: hbase-operator
pretty_string: Apache HBase
product_string: hbase
url: stackabletech/hbase-operator.git
- name: hdfs-operator
pretty_string: Apache HDFS
product_string: hdfs
url: stackabletech/hdfs-operator.git
- name: hive-operator
pretty_string: Apache Hive
product_string: hive
url: stackabletech/hive-operator.git
- name: kafka-operator
pretty_string: Apache Kafka
product_string: kafka
url: stackabletech/kafka-operator.git
- name: nifi-operator
pretty_string: Apache NiFi
product_string: nifi
url: stackabletech/nifi-operator.git
- name: listener-operator
include_productconfig: false
has_product: false
pretty_string: Stackable Listener Operator
product_string: listener-operator
run_as: custom
url: stackabletech/listener-operator.git
- name: opa-operator
extra_crates:
- stackable-opa-bundle-builder
pretty_string: OpenPolicyAgent
product_string: opa
url: stackabletech/opa-operator.git
- name: opensearch-operator
pretty_string: OpenSearch
product_string: opensearch
url: stackabletech/opensearch-operator.git
- name: secret-operator
include_productconfig: false
has_product: false
pretty_string: Stackable Secret Operator
product_string: secret-operator
run_as: custom
url: stackabletech/secret-operator.git
- name: spark-k8s-operator
pretty_string: Apache Spark-on-Kubernetes
product_string: spark-k8s
url: stackabletech/spark-k8s-operator.git
- name: superset-operator
pretty_string: Apache Superset
product_string: superset
url: stackabletech/superset-operator.git
- name: trino-operator
pretty_string: Trino
product_string: trino
url: stackabletech/trino-operator.git
- name: zookeeper-operator
pretty_string: Apache ZooKeeper
product_string: zookeeper
url: stackabletech/zookeeper-operator.git
- airflow-operator
- commons-operator
- druid-operator
- hbase-operator
- hdfs-operator
- hive-operator
- kafka-operator
- nifi-operator
- listener-operator
- opa-operator
- opensearch-operator
- secret-operator
- spark-k8s-operator
- superset-operator
- trino-operator
- zookeeper-operator
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand All @@ -113,10 +56,10 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update && \
sudo apt install -y software-properties-common && \
sudo apt-add-repository ppa:ansible/ansible -y && \
sudo apt install -y ansible
sudo apt update && \
sudo apt install -y software-properties-common && \
sudo apt-add-repository ppa:ansible/ansible -y && \
sudo apt install -y ansible

# NOTE (@NickLarsenNZ): This could be removed in favor of nix-shell and rrbutani/use-nix-shell-action
- name: Install deps for operators
Expand Down Expand Up @@ -148,36 +91,18 @@ jobs:
echo "AUTHOR=stackabletech/developers"
echo "REASON=Daily run triggered" >> "$GITHUB_ENV"

- name: Overwrite repositories.yaml for ${{ matrix.repository.name }}
run: |
cat >config/repositories.yaml <<CONFIG
---
repositories:
- ${{ toJSON(matrix.repository) }}
CONFIG

# For debugging
cat config/repositories.yaml

# Generate PRs
- name: Run playbook
if: ${{ !inputs.dry-run }}
env:
CUSTOM_PR_TITLE: ${{ inputs.custom-pr-title }}
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
REPOSITORY: ${{ matrix.repository }}
# tags local excludes all actions that actually generate PRs
DRY_RUN_FLAGS: ${{ inputs.dry-run && '--tags=local' || '' }}
# shellsheck disable=SC2086
run: |
# Funnel via JSON to ensure that values are escaped properly
# Check if custom PR title is set. If so, insert it into the extra vars
if [ -n "$CUSTOM_PR_TITLE" ]; then
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}' --arg pwd "$(pwd)" > vars.json
else
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
fi
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json"

# Do Not Generate PRs
- name: Run playbook (dry-run)
if: ${{ inputs.dry-run }}
run: ./test.sh
env:
GH_ACCESS_TOKEN: ""
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
# $DRY_RUN_FLAGS is intentionally not quoted, since we need to avoid
# passing an argument if we're not in dry mode.
# This is safe, since it always has one of two hard-coded values.
# shellcheck disable=SC2086
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json" $DRY_RUN_FLAGS
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Consult the section above to learn more about the structure of the template.

=== Test changes locally

1. Run the `test.sh` script.
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).
It will automatically delete and recreate a `work` directory.
2. The changes can be examined with `git status`.
When the pull request is later merged into the `main` branch then pull requests with these changes will be created automatically.
Expand Down
6 changes: 2 additions & 4 deletions config/repositories.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# This file exists just for the purpose of running test.sh locally.
# The GH workflow generate_prs.yml will overwrite it with the contents if the
# matrix run.
# If you add a new repository here, you also need to add it to that workflow file.
# If you add a new repository here, you also need to add it to the list of
# repositories in ../.github/workflows/generate_prs.yml.
---
repositories:
- name: airflow-operator
Expand Down
1 change: 1 addition & 0 deletions playbook/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

- name: Update repositories from templates
include_tasks: "update_repo.yaml"
when: shard_repositories is undefined or operator.name in shard_repositories
with_items: "{{ repositories }}"
loop_control:
loop_var: operator
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

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