-
Notifications
You must be signed in to change notification settings - Fork 456
159 lines (140 loc) · 5.18 KB
/
cloud-regress.yml
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
name: Cloud Regression Test
on:
workflow_dispatch: # adds ability to run this manually
inputs:
project-id:
description: Project ID
required: true
type: string
pg-version:
description: PostgreSQL version
required: false
default: 16
type: string
defaults:
run:
shell: bash -euxo pipefail {0}
concurrency:
# Allow only one workflow
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
regress:
env:
POSTGRES_DISTRIB_DIR: /tmp/neon/pg_install
TEST_OUTPUT: /tmp/test_output
BUILD_TYPE: remote
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY_DEV }}
runs-on: us-east-2
container:
image: neondatabase/build-tools:pinned-bookworm
options: --init
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Patch the test
env:
PG_VERSION: ${{inputs.pg-version}}
run: |
cd "vendor/postgres-v${PG_VERSION}"
patch -p1 < "../../compute/patches/cloud_regress_pg${PG_VERSION}.patch"
- name: Generate a random password
id: pwgen
run: |
set +x
DBPASS=$(dd if=/dev/random bs=48 count=1 2>/dev/null | base64)
echo "::add-mask::${DBPASS//\//}"
echo DBPASS="${DBPASS//\//}" >> "${GITHUB_OUTPUT}"
- name: Change tests according to the generated password
env:
DBPASS: ${{ steps.pwgen.outputs.DBPASS }}
PG_VERSION: ${{inputs.pg-version}}
run: |
cd vendor/postgres-v"${PG_VERSION}"/src/test/regress
for fname in sql/*.sql expected/*.out; do
sed -i.bak s/NEON_PASSWORD_PLACEHOLDER/"'${DBPASS}'"/ "${fname}"
done
for ph in $(grep NEON_MD5_PLACEHOLDER expected/password.out | awk '{print $3;}' | sort | uniq); do
USER=$(echo "${ph}" | cut -c 22-)
MD5=md5$(echo -n "${DBPASS}${USER}" | md5sum | awk '{print $1;}')
sed -i.bak "s/${ph}/${MD5}/" expected/password.out
done
- name: Download Neon artifact
uses: ./.github/actions/download
with:
name: neon-${{ runner.os }}-${{ runner.arch }}-release-artifact
path: /tmp/neon/
prefix: latest
- name: Get endpoint ID
id: endpoint-id
uses: ./.github/actions/neon-get-endpoint
with:
api_key: ${{ secrets.NEON_STAGING_API_KEY }}
project_id: ${{inputs.project-id}}
- name: Create a new branch
id: create-branch
uses: ./.github/actions/neon-branch-create
with:
api_key: ${{ secrets.NEON_STAGING_API_KEY }}
project_id: ${{inputs.project-id}}
add_endpoint: false
- name: Attach the endpoint to the new branch
env:
PROJECT_ID: ${{inputs.project_id}}
ENDPOINT_ID: ${{steps.endpoint-id.outputs.id}}
BRANCH_ID: ${{steps.create-branch.outputs.id}}
API_HOST: console-stage.neon.build
API_KEY: ${{ secrets.NEON_STAGING_API_KEY }}
run: |
for i in ${1 10}; do
data=$(jq -nc "{endpoint:{branch_id: \"${BRANCH_ID}\"}}")
endpoint_id=$(curl -X PATCH \
"https://${API_HOST}/api/v2/projects/${PROJECT_ID}/endpoints/${ENDPOINT_ID}" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${API_KEY}"
--data ${data} | \
jq '.endpoint.id')
if [ -z "${endpoint_id}" ] || [ "${endpoint_id}" == "null" ]; then
sleep 1
continue
fi
break
done
if [ -z "${endpoint_id}" ] || [ "${endpoint_id}" == "null" ]; then
echo Cannot bind endpoint id to branch
exit 1
fi
- name: Get the connection URI
id: connect-uri
uses: ./.github/actions/neon-get-connection-uri
with:
api_key: ${{ secrets.NEON_STAGING_API_KEY }}
project_id: ${{inputs.project-id}}
endpoint_id: ${{steps.endpoint-id.id}}
- name: Run the regression tests
uses: ./.github/actions/run-python-test-set
with:
build_type: ${{ env.BUILD_TYPE }}
test_selection: cloud_regress
pg_version: ${{ inputs.pg-version }}
extra_params: -m remote_cluster
env:
BENCHMARK_CONNSTR: ${{steps.connect-uri.outputs.uri}}
- name: Create Allure report
id: create-allure-report
if: ${{ !cancelled() }}
uses: ./.github/actions/allure-report-generate
- name: Post to a Slack channel
if: false
uses: slackapi/slack-github-action@v1
with:
channel-id: "C033QLM5P7D" # on-call-staging-stream
slack-message: |
Periodic pg_regress on staging: ${{ job.status }}
<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub Run>
<${{ steps.create-allure-report.outputs.report-url }}|Allure report>
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}