Skip to content

Generate Downstream PRs #81

Generate Downstream PRs

Generate Downstream PRs #81

Workflow file for this run

---
name: Generate Downstream PRs
on:
workflow_dispatch:
inputs:
message:
description: "Message to include in the generated commits:"
required: true
dry-run:
description: "Dry Run (PRs are not generated)"
type: boolean
default: true
jobs:
create-prs:
runs-on: ubuntu-latest
strategy:
# If you add a new repository here, also add it to config/repositories.yaml
matrix:
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: edc-operator
pretty_string: EDC
product_string: edc
url: stackabletech/edc-operator.git
- name: hdfs-operator
pretty_string: Apache HDFS
product_string: hdfs
url: stackabletech/hdfs-operator.git
- name: hello-world-operator
pretty_string: Hello World
product_string: hello
url: stackabletech/hello-world-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: 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
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # tag=v26
- name: Install Ansible
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
# NOTE (@NickLarsenNZ): This could be removed in favor of nix-shell and rrbutani/use-nix-shell-action
- name: Install deps for operators
run: |
sudo apt-get install \
protobuf-compiler \
krb5-user \
libclang-dev \
libkrb5-dev \
liblzma-dev \
libssl-dev \
pkg-config
- name: Install jinja2
run: pip install -r requirements.txt
# Create commit message depending on whether this is run manually or due to a scheduled run
- name: Set commit message for manual dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "AUTHOR=${{ github.event.sender.login }}" >> "$GITHUB_ENV"
echo "REASON=${{ github.event.inputs.message }}" >> "$GITHUB_ENV"
- name: Set commit message for schedule
if: ${{ github.event_name == 'schedule' }}
run: |
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 }}
run: |
# Funnel via JSON to ensure that values are escaped properly
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
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json"
env:
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
# Do Not Generate PRs
- name: Run playbook (dry-run)
if: ${{ inputs.dry-run }}
run: ./test.sh
env:
GH_ACCESS_TOKEN: ""