Skip to content

Commit ddb2eb4

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 6dc804e + 8520964 commit ddb2eb4

7 files changed

Lines changed: 63 additions & 31 deletions

File tree

automated_packaging/common_functions.pm

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,31 @@ use JSON;
66

77
# Export subroutines
88
our @ISA = qw(Exporter);
9-
our @EXPORT = qw(get_and_verify_token get_sorted_prs create_release_changelog has_backport_label);
9+
our @EXPORT = qw(get_and_verify_token get_microsoft_email get_git_name get_sorted_prs create_release_changelog has_backport_label);
1010

1111
# untaint environment
1212
local $ENV{'PATH'} = '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin';
1313

14+
sub get_microsoft_email {
15+
unless (exists $ENV{MICROSOFT_EMAIL}) {
16+
die "You must have a MICROSOFT_EMAIL set";
17+
}
18+
19+
my $microsoft_email = $ENV{MICROSOFT_EMAIL};
20+
return $microsoft_email;
21+
}
22+
23+
sub get_git_name {
24+
my $git_name = `git config user.name`;
25+
# Strip trailing newline
26+
chomp $git_name;
27+
if ($git_name eq "") {
28+
die "You must set your git name using 'git config user.name \"Your name Here\"'";
29+
}
30+
return $git_name;
31+
}
32+
33+
1434
sub get_and_verify_token {
1535
unless (exists $ENV{GITHUB_TOKEN}) {
1636
die "You must have a GITHUB_TOKEN set";

automated_packaging/update_docker.pl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,3 @@
6161
`git commit -a -m "Bump to version $VERSION"`;
6262
`git push origin release-$VERSION-$curTime`;
6363
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump docker to $VERSION\", \"base\":\"master\", \"head\":\"release-$VERSION-$curTime\"}' https://api.github.com/repos/citusdata/docker/pulls`;
64-
65-
# Now push another and open a PR against develop
66-
`git checkout -b release-$VERSION-develop-$curTime`;
67-
`git push origin release-$VERSION-develop-$curTime`;
68-
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump docker to $VERSION\", \"base\":\"develop\", \"head\":\"release-$VERSION-develop-$curTime\"}' https://api.github.com/repos/citusdata/docker/pulls`;

automated_packaging/update_os_package.pl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
my $github_token = get_and_verify_token();
1818

19+
my $microsoft_email = get_microsoft_email();
20+
my $git_name = get_git_name();
21+
1922
# Debian branch has it's own changelog, we can get them through the CHANGELOG file of the code repo
2023
sub get_changelog_for_debian {
2124

2225
# Update project spec file
23-
@changelog_file = `curl --user "$github_token:x-oauth-basic" -H "Accept: application/vnd.github.v3.raw" -X GET 'https://api.github.com/repos/citusdata/$github_repo_name/contents/CHANGELOG.md' 2> /dev/null`;
26+
@changelog_file = `curl --user "$github_token:x-oauth-basic" -H "Accept: application/vnd.github.v3.raw" -X GET 'https://api.github.com/repos/citusdata/$github_repo_name/contents/CHANGELOG.md?ref=v$VERSION' 2> /dev/null`;
2427

2528
$first_version_has_seen = 0;
2629
my @changelog_items;
@@ -56,6 +59,8 @@ sub get_changelog_for_debian {
5659

5760
# Checkout the distro's branch
5861
`git checkout $DISTRO_VERSION-$PROJECT`;
62+
# Update distro's branch
63+
`git pull origin $DISTRO_VERSION-$PROJECT`;
5964

6065
# Create a new branch based on the distro's branch
6166
`git checkout -b $DISTRO_VERSION-$PROJECT-push-$curTime`;
@@ -64,12 +69,12 @@ sub get_changelog_for_debian {
6469
`sed -i 's/^pkglatest.*/pkglatest=$VERSION.citus-1/g' pkgvars`;
6570

6671
# Based on the repo, update the package related variables
67-
if ( $DISTRO_VERSION eq "redhat" ) {
72+
if ( $DISTRO_VERSION eq "redhat" || $DISTRO_VERSION eq "microsoft" || $DISTRO_VERSION eq "all") {
6873
`sed -i 's|^Version:.*|Version: $VERSION.citus|g' $github_repo_name.spec`;
69-
`sed -i 's|^Source0:.*|Source0: https:\/\/github.com\/citusdata\/$github_repo_name\/archive\/v$VERSION.tar.gz|g' $github_repo_name.spec`;
70-
`sed -i 's|^%changelog|%changelog\\n* $abbr_day[$wday] $abbr_mon[$mon] $mday $year - Burak Velioglu <velioglub\@citusdata.com> $VERSION.citus-1\\n- Update to $log_repo_name $VERSION\\n|g' $github_repo_name.spec`;
74+
`sed -i 's|^Source0:.*|Source0: https:\/\/github.com\/citusdata\/$github_repo_name\/archive\/v$VERSION.tar.gz|g' $github_repo_name.spec`;
75+
`sed -i 's|^%changelog|%changelog\\n* $abbr_day[$wday] $abbr_mon[$mon] $mday $year - $git_name <$microsoft_email> $VERSION.citus-1\\n- Update to $log_repo_name $VERSION\\n|g' $github_repo_name.spec`;
7176
}
72-
elsif ( $DISTRO_VERSION eq "debian" ) {
77+
if ( $DISTRO_VERSION eq "debian" || $DISTRO_VERSION eq "microsoft" || $DISTRO_VERSION eq "all") {
7378
open( DEB_CLOG_FILE, "<./debian/changelog" ) || die "Debian changelog file not found";
7479
my @lines = <DEB_CLOG_FILE>;
7580
close(DEB_CLOG_FILE);
@@ -82,12 +87,12 @@ sub get_changelog_for_debian {
8287
open( DEB_CLOG_FILE, ">./debian/changelog" ) || die "Debian changelog file not found";
8388
print DEB_CLOG_FILE "$github_repo_name ($VERSION.citus-1) stable; urgency=low\n";
8489
print DEB_CLOG_FILE @changelog_print;
85-
print DEB_CLOG_FILE " -- Burak Velioglu <velioglub\@citusdata.com> $abbr_day[$wday], $mday $abbr_mon[$mon] $year $print_hour:$min:$sec +0000\n\n";
90+
print DEB_CLOG_FILE " -- $git_name <$microsoft_email> $abbr_day[$wday], $mday $abbr_mon[$mon] $year $print_hour:$min:$sec +0000\n\n";
8691
print DEB_CLOG_FILE @lines;
8792
close(DEB_CLOG_FILE);
8893
}
8994

9095
# Commit, push changes and open a pull request
9196
`git commit -a -m "Bump $DISTRO_VERSION $log_repo_name $VERSION"`;
9297
`git push origin $DISTRO_VERSION-$PROJECT-push-$curTime`;
93-
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump $PROJECT $DISTRO_VERSION Version\", \"head\":\"$DISTRO_VERSION-$PROJECT-push-$curTime\", \"base\":\"$DISTRO_VERSION-$PROJECT\"}' https://api.github.com/repos/citusdata/packaging/pulls`;
98+
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump $PROJECT $DISTRO_VERSION version to $VERSION\", \"head\":\"$DISTRO_VERSION-$PROJECT-push-$curTime\", \"base\":\"$DISTRO_VERSION-$PROJECT\"}' https://api.github.com/repos/citusdata/packaging/pulls`;

packaging/citus_package

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ foreach my $platform (@platforms) {
371371
"GITHUB_TOKEN",
372372
'-e',
373373
"PACKAGE_ENCRYPTION_KEY",
374+
'-e',
375+
"UNENCRYPTED_PACKAGE",
374376
"citus/packaging:$docker_platform-$pg",
375377
$build_type
376378
);

travis/build_new_nightly

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ stderr=2
99
badusage=64
1010

1111
latestpg="10"
12-
pkgflavor="${TRAVIS_BRANCH%%-*}"
12+
if [ "${TARGET_PLATFORM:-}" = "" ]; then
13+
echo TARGET_PLATFORM must be set
14+
exit $badusage
15+
fi
16+
17+
PLATFORM_TYPE="${TARGET_PLATFORM%%/*}"
1318
pkgauth="${PACKAGECLOUD_API_TOKEN}:"
1419
hubauth="Authorization: token ${GITHUB_TOKEN}"
1520

@@ -24,13 +29,13 @@ releasepg="${releasepg:-9.6,10}"
2429
nightlypg="${nightlypg:-${releasepg}}"
2530
latestpg=$(echo "${nightlypg}" | tr ',' '\n' | sort -t. -k1,1n -k2,2n | tail -n1)
2631

27-
case "${pkgflavor}" in
28-
debian)
32+
case "${PLATFORM_TYPE}" in
33+
debian|ubuntu)
2934
pkgflavor='deb'
3035
pkgfull="postgresql-${latestpg}-${pkgname}"
3136
pkgarch="amd64"
3237
;;
33-
redhat)
38+
el|ol)
3439
pkgflavor='rpm'
3540
pkgfull="${pkgname}_${latestpg//./}"
3641
pkgarch="x86_64"

travis/build_new_release

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ stderr=2
99
badusage=64
1010
noservice=69
1111

12-
pkgflavor="${TRAVIS_BRANCH%%-*}"
12+
if [ "${TARGET_PLATFORM:-}" = "" ]; then
13+
echo TARGET_PLATFORM must be set
14+
exit $badusage
15+
fi
16+
17+
PLATFORM_TYPE="${TARGET_PLATFORM%%/*}"
1318
pkgauth="${PACKAGECLOUD_API_TOKEN}:"
1419

1520
# populate variables from packaging metadata file
@@ -21,12 +26,12 @@ declare pkglatest # to make shellcheck happy
2126
hubproj="${hubproj:-${pkgname}}"
2227
nightlyref="${nightlyref:-master}"
2328
releasepg="${releasepg:-9.6,10}"
24-
nightlypg="${nightlypg:-${releasepg}}"
29+
nightlypg="${nightlypg:-}"
2530
latestpg=$(echo "${releasepg}" | tr ',' '\n' | sort -t. -k1,1n -k2,2n | tail -n1)
2631
versioning="${versioning:-simple}"
2732

28-
case "${pkgflavor}" in
29-
debian)
33+
case "${PLATFORM_TYPE}" in
34+
debian|ubuntu)
3035
pkgflavor='deb'
3136
pkgfull="postgresql-${latestpg}-${pkgname}"
3237

@@ -39,7 +44,7 @@ case "${pkgflavor}" in
3944
pkgarch="amd64"
4045
jqfilter='map(.version + "-" + .release)'
4146
;;
42-
redhat)
47+
el|ol)
4348
pkgflavor='rpm'
4449

4550
# add minor/major version to package name if using fancy versioning

travis/install_uncrustify

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22

3-
set -eux
3+
set -euxo pipefail
44

5-
uncrustifypkgs="$HOME/.cache/uncrustify_pkgs"
6-
uncrustifyversion="0.63"
7-
uncrustifydownload="uncrustify_${uncrustifyversion}-1_amd64.deb"
8-
uncrustifyurl="https://s3.amazonaws.com/packages.citusdata.com/travis/${uncrustifydownload}"
9-
10-
# install travis uncrustify package
11-
wget -N -P "${uncrustifypkgs}" "${uncrustifyurl}"
12-
sudo dpkg --force-confdef --force-confold --install "${uncrustifypkgs}/${uncrustifydownload}"
5+
curl -L https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz | tar xz
6+
cd uncrustify-uncrustify-0.68.1/
7+
mkdir build
8+
cd build
9+
cmake ..
10+
make -j5
11+
sudo make install
12+
cd ../..

0 commit comments

Comments
 (0)