-
-
Notifications
You must be signed in to change notification settings - Fork 2
183 lines (172 loc) · 6.72 KB
/
Copy pathgenerate_prs.yml
File metadata and controls
183 lines (172 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
name: Generate Downstream PRs
run-name: "Generate Downstream PRs (dry-run: ${{ inputs.dry-run }})"
on:
workflow_dispatch:
inputs:
message:
description: "Message to include in the generated commits:"
required: true
custom-pr-title:
description: "Optionally a custom PR title. If unset, default will be used"
dry-run:
description: "Dry Run (PRs are not generated)"
type: boolean
default: true
fail-fast:
description: "Fail fast (if one job fails, all other are cancelled)"
type: boolean
default: false
permissions: {}
jobs:
create-prs:
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:
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
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: cachix/install-nix-action@17fe5fb4a23ad6cbbe47d6b3f359611ad276644c # v31.4.0
- 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' }}
env:
REASON: ${{ github.event.inputs.message }}
AUTHOR: ${{ github.event.sender.login }}
run: |
echo "AUTHOR=$AUTHOR" >> "$GITHUB_ENV"
echo "REASON=$REASON" >> "$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 }}
env:
CUSTOM_PR_TITLE: ${{ inputs.custom-pr-title }}
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
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: ""