Skip to content

Commit 5cfd556

Browse files
authored
Merge pull request #1169 from citusdata/pgxn-citus-old
Pgxn citus old
2 parents 2d23cdf + b3305e7 commit 5cfd556

8 files changed

Lines changed: 255 additions & 23 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release on PGXN
2+
on:
3+
push:
4+
branches:
5+
- "**"
6+
jobs:
7+
release_check:
8+
if: github.ref != 'refs/heads/pgxn-citus'
9+
name: Release check
10+
runs-on: ubuntu-latest
11+
container: pgxn/pgxn-tools
12+
steps:
13+
- name: Check out the repo
14+
uses: actions/checkout@v3
15+
- name: Bundle the Release
16+
run: pgxn-bundle
17+
release_pgxn:
18+
if: github.ref == 'refs/heads/pgxn-citus'
19+
name: Actual Release on PGXN
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out the repo
23+
uses: actions/checkout@v3
24+
- name: Release package
25+
env:
26+
MAIN_BRANCH: pgxn-citus
27+
PGXN_USERNAME: ${{ secrets.PGXN_USER_NAME }}
28+
PGXN_PASSWORD: ${{ secrets.PGXN_PASSWORD }}
29+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
30+
shell: bash
31+
run: |
32+
sudo apt install -y zip
33+
source pkgvars
34+
pkg_path=$(pwd)/"citus-${pkglatest}.zip"
35+
./scripts/fetch_and_build_pgxn release
36+
./scripts/release_pgxn $pkg_path
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update Version on PGXN Config Files
2+
3+
env:
4+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
project_version:
10+
description: "Version number to be released e.g 10.0.3"
11+
required: true
12+
microsoft_email:
13+
description: "Email to be written on changelogs"
14+
default: "gindibay@microsoft.com"
15+
required: false
16+
name:
17+
description: "Name to be written on changelogs"
18+
default: "Gurkan Indibay"
19+
required: false
20+
21+
jobs:
22+
update_pgxn:
23+
name: Update pgxn configuration
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
with:
29+
token: ${{ secrets.GH_TOKEN }}
30+
31+
- name: Install dependencies
32+
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev python3-testresources
33+
34+
- name: Clone Tools branch
35+
run: git clone --depth 1 --branch v0.8.24 https://github.com/citusdata/tools.git
36+
37+
- name: Install Python requirements
38+
run: python -m pip install -r tools/packaging_automation/requirements.txt
39+
40+
- name: Set git name and email
41+
run: |
42+
git config --global user.email "${{ github.event.inputs.microsoft_email }}" && \
43+
git config --global user.name "${{ github.event.inputs.name }}"
44+
45+
- name: Update pgxn files
46+
run: |
47+
python -m tools.packaging_automation.update_pgxn \
48+
--prj_ver ${{ github.event.inputs.project_version }} \
49+
--gh_token "${GH_TOKEN}" \
50+
--pipeline \
51+
--exec_path "$(pwd)"

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

META.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
"name": "citus",
33
"abstract": "Scalable PostgreSQL for real-time workloads",
44
"description": "Citus horizontally scales PostgreSQL across commodity servers using sharding and replication. Its query engine parallelizes incoming SQL queries across these servers to enable real-time responses on large datasets.",
5-
"version": "7.5.0",
5+
"version": "12.1.6",
66
"maintainer": "\"Citus Data\" <packaging@citusdata.com>",
77
"license": "agpl_3",
88
"provides": {
99
"citus": {
1010
"abstract": "Citus Distributed Database",
11-
"file": "src/backend/distributed/citus--7.5-7.sql",
11+
"file": "citus.so",
1212
"docfile": "README.md",
13-
"version": "7.5.0"
13+
"version": "12.1.6"
1414
}
1515
},
1616
"prereqs": {
1717
"runtime": {
1818
"requires": {
19-
"PostgreSQL": "9.6.6"
19+
"PostgreSQL": "14.0.0"
2020
}
2121
},
2222
"test": {

pkgvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
pkgname=citus
22
pkgdesc='Citus (Open-Source)'
3-
pkglatest=7.5.0
4-
releasepg=9.6,10
3+
pkglatest=12.1.6

postgres-matrix.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Postgres Version Matrix
2+
project_name: citus
3+
4+
version_matrix:
5+
- 8.0:
6+
postgres_versions: [10, 11]
7+
- 9.0:
8+
postgres_versions: [11, 12]
9+
- 9.5:
10+
postgres_versions: [11, 12, 13]
11+
- 10.1:
12+
postgres_versions: [12, 13]
13+
- 10.2:
14+
postgres_versions: [12, 13, 14]
15+
- 11.0:
16+
postgres_versions: [13, 14]
17+
- 11.1:
18+
postgres_versions: [ 13, 14, 15 ]
19+
- 12.0:
20+
postgres_versions: [ 14, 15 ]
21+
- 12.1:
22+
postgres_versions: [ 14, 15, 16 ]

scripts/fetch_and_build_pgxn

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/bash
2+
3+
# make bash behave
4+
set -euo pipefail
5+
IFS=$'\n\t'
6+
7+
# constants
8+
stdout=1
9+
stderr=2
10+
success=0
11+
failure=1
12+
badusage=64
13+
noinput=66
14+
15+
builddir=$(pwd)
16+
17+
# outputs usage message on specified device before exiting with provided status
18+
usage() {
19+
cat << 'E_O_USAGE' >&"$1"
20+
usage: fetch_and_build_pgxn build_type
21+
22+
build_type: 'release'
23+
24+
fetch_and_build_pgxn builds a PGXN package using local build files. The build
25+
type 'release' builds the latest release tag. At present, the only supported
26+
build is a 'release' build of the 'citus' project.
27+
E_O_USAGE
28+
29+
exit "${2}";
30+
}
31+
32+
if [ "$#" -ne 1 ]; then
33+
usage $stderr $badusage
34+
fi
35+
36+
if [ "${1}" = '-h' ]; then
37+
usage $stdout $success
38+
fi
39+
40+
# populate variables from packaging metadata file
41+
# shellcheck source=/dev/null
42+
43+
parent_path=$(dirname "$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )")
44+
source "${parent_path}/pkgvars"
45+
46+
# set default values for certain packaging variables
47+
declare pkglatest # to make shellcheck happy
48+
hubproj="${hubproj:-${pkgname}}"
49+
50+
if [ -z "${pkglatest}" ]; then
51+
echo "$0: pkgvars file must specify a value for pkglatest" >&2
52+
exit $noinput
53+
fi
54+
55+
echo "header=\"Authorization: token ${GITHUB_TOKEN}\"" > ~/.curlrc
56+
57+
repopath="citusdata/${hubproj}"
58+
59+
case "${1}" in
60+
release)
61+
packageversion=${pkglatest%-*}
62+
releasetag="v${packageversion/'~'/-}"
63+
64+
gitsha=$(curl -s "https://api.github.com/repos/${repopath}/git/refs/tags/${releasetag}" | \
65+
jq -r '.object.sha')
66+
if [ "${gitsha}" == 'null' ]; then
67+
echo "$0: could not determine commit for git tag ${releasetag}" >&2
68+
exit $failure
69+
fi
70+
71+
verified=$(curl -sH 'Accept:application/vnd.github.cryptographer-preview+sha' \
72+
"https://api.github.com/repos/${repopath}/git/tags/${gitsha}" | \
73+
jq -r '.verification.verified')
74+
if [ "${verified}" != 'true' ]; then
75+
echo "$0: could not verify signature for git tag ${releasetag}" >&2
76+
exit $failure
77+
fi
78+
;;
79+
*)
80+
echo "$0: unknown build_type -- ${1}" >&2
81+
usage $stderr $badusage
82+
;;
83+
esac
84+
85+
tarballpath="${builddir}/${pkgname}_${packageversion}.orig.tar.gz"
86+
packagepath="${builddir}/${pkgname}-${packageversion}"
87+
finalpath="${packagepath}.zip"
88+
89+
curl -sL "https://api.github.com/repos/${repopath}/tarball/${gitsha}" \
90+
-o "${tarballpath}"
91+
92+
mkdir -p "${packagepath}"
93+
tar xf "${tarballpath}" -C "${packagepath}" --strip-components 1
94+
95+
cp "${builddir}/META.json" "${packagepath}/META.json"
96+
97+
# remove extraneous slashes: zip doesn't like them
98+
zip -qr "${finalpath//\/\//\/}" "${packagepath//\/\//\/}"
99+
100+
rm ~/.curlrc
101+

scripts/release_pgxn

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# make bash behave
4+
set -euo pipefail
5+
IFS=$'\n\t'
6+
7+
# constants
8+
success=0
9+
failure=1
10+
badinput=65
11+
12+
pgxnuser='citusdata'
13+
pgxnurl='https://manager.pgxn.org/upload'
14+
15+
# shellcheck disable=SC2012
16+
archive=$1
17+
18+
19+
echo "Password: ${PGXN_PASSWORD}"
20+
echo "User: ${pgxnuser}"
21+
22+
# TODO: use pgxnclient in Travis to only release on new versions
23+
httpcode=$(curl -sL -u "${pgxnuser}:${PGXN_PASSWORD}" \
24+
-F "archive=@${archive};type=application/zip" \
25+
-o /dev/null -w '%{http_code}' "${pgxnurl}")
26+
27+
if [ "${httpcode}" -eq 200 ]; then
28+
echo "Successfully uploaded ${archive} to PGXN!" >&2
29+
exit $success
30+
elif [ "${httpcode}" -eq 409 ]; then
31+
echo "PGXN already contains ${archive}!" >&2
32+
exit $success
33+
elif [ "${httpcode}" -eq 401 ]; then
34+
echo "PGXN rejected our credentials" >&2
35+
exit $badinput
36+
else
37+
echo "Encountered an unknown error" >&2
38+
echo "HTTP Code: ${httpcode}" >&2
39+
exit $failure
40+
fi

0 commit comments

Comments
 (0)