Skip to content

Commit

Permalink
🤖 Automated promotion
Browse files Browse the repository at this point in the history
* release/v0.6.45:
  🥚 🐔
  Ensure new release version is numeric, optional leading 'v'
  Increase specificity of old release detection
  Formatting
  Use default curl parameters to download googleSDK
  Pin gitflow version to 1.11.0. Circumvent breaking change in latest version: petervanderdoes/gitflow-avh#394
  Verbose notification for API builds
  • Loading branch information
CircleCI Bot committed Jan 25, 2019
2 parents 567b451 + 6bba104 commit 7cbe7ef
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defaults: &defaults
environment:
GOOGLE_PROJECT_ID: planet-4-151612
docker:
- image: gcr.io/planet-4-151612/circleci-base:latest
- image: gcr.io/planet-4-151612/circleci-base:develop
working_directory: /home/circleci/app

version: 2
Expand Down
12 changes: 6 additions & 6 deletions src/circleci-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Planet 4 CircleCI build image
# Branch: master
# Commit: 74ddf4d1f2b5fa47fe5f0bf9e1e24a69008a78a0
# Build: https://circleci.com/gh/greenpeace/planet4-circleci/1203
# Branch: develop
# Commit: f1f9cbf5f73c66abf7cd162be2c0a7d7d3019afd
# Build: (local)
# ------------------------------------------------------------------------
# DO NOT MAKE CHANGES HERE
# This file is built automatically from ./templates/Dockerfile.in
Expand Down Expand Up @@ -37,8 +37,8 @@ RUN git clone https://github.com/sstephenson/bats.git && \
export "DESIRED_VERSION=v2.12.3" && \
curl -sS https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash - && \
wget --no-check-certificate -q https://raw.githubusercontent.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh && \
bash gitflow-installer.sh install stable && \
rm gitflow-installer.sh && \
bash gitflow-installer.sh install version 1.11.0 && \
rm -fr git-flow gitflow-installer.sh && \
curl -s https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 > /usr/local/bin/cloud_sql_proxy && \
chmod 0755 /usr/local/bin/cloud_sql_proxy && \
apt-get install -y --no-install-recommends \
Expand All @@ -63,7 +63,7 @@ RUN git clone https://github.com/sstephenson/bats.git && \

USER circleci

RUN curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 60 -L "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-231.0.0-linux-x86_64.tar.gz" | tar xz && \
RUN curl "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-231.0.0-linux-x86_64.tar.gz" | tar xz && \
CLOUDSDK_CORE_DISABLE_PROMPTS=1 ./google-cloud-sdk/install.sh \
--usage-reporting false \
--bash-completion false \
Expand Down
42 changes: 24 additions & 18 deletions src/circleci-base/scripts/release-prepare-nro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,73 @@ set -euo pipefail
old_release=${1:-$(git-current-tag.sh)}
new_release=${2:-$(increment-version.sh "$old_release")}

echo "--0.1 The old release is $old_release"
echo "--0.2 The new release is $new_release"
# Check for numeric value of new release version
# Permits optional leading 'v' character
[[ ${new_release#v} =~ ^[0-9] ]] || {
echo "ERROR: release is not numeric: '${new_release#v}'"
exit 1
}

echo "-- 0.1 The old release is $old_release"
echo "-- 0.2 The new release is $new_release"

merged=false

mkdir -p /tmp/workspace

echo "--1.0 Before the first if"
echo "-- 1.0 Before the first if"
if release-start.sh "$new_release"
then
echo "--1.1 New release branch created: release/$new_release"
echo "-- 1.1 New release branch created: release/$new_release"
merged=true
else
echo "--1.1 Release branch release/$new_release already exists"
echo "-- 1.1 Release branch release/$new_release already exists"
# Release branch already exists
git checkout "release/$new_release"

# If there are any changes from develop
# Merge changes from develop to release
git merge -Xtheirs --no-edit --log -m ":robot: release/$new_release Merge develop" develop | tee /tmp/workspace/merge.log

grep -q "Already up-to-date." /tmp/workspace/merge.log || {
echo "--1.2 We merged changes from develop into release/$new_release"
echo "-- 1.2 We merged changes from develop into release/$new_release"
merged=true;
}
fi

# Perform NRO develop to release manipulations
echo
echo "---2. Performing automated release modifications ..."
echo "-- 2.0 Performing automated release modifications ..."
pin-composer-versions.sh

# If there are any local changes
if ! git diff --exit-code
then
echo "---2.1 Staging modifications"
echo "-- 2.1 Staging modifications"
# Stage changes
git add .

if [[ "$merged" = "true" ]]
then
echo "---2.1.1 Since we've merged changes from develop, let's amend that commit"
git commit --amend --no-edit --allow-empty
echo "-- 2.1.1 Since we've merged changes from develop, let's amend that commit"
git commit --amend --no-edit
else
echo "---2.1.2 Create new commit with automated modifications"
git commit -m ":robot: release/$new_release Automated modifications "
echo "-- 2.1.2 Create new commit with automated modifications"
git commit -m ":robot: release/$new_release Automated modifications"
merged=true
fi
fi

echo "--3.0 Before the final if"
if [[ "$merged" = "false" ]]
then
# No local changes
repo=$(git remote get-url origin | cut -d'/' -f 2 | cut -d'.' -f1)
echo "---3.1 No changes to merge. Triggering $repo@release/$new_release via API"
echo "-- 3.1 No changes to merge. Triggering $repo@release/$new_release via API"
trigger-build-api.sh "$repo" "release/$new_release"
else
echo "---3.2 Local changes have been merged, pushing changes to remote"
echo "-- 3.2 Local changes have been merged, pushing changes to remote"

echo "---3.2.1 Remove all the build trigger notifications from the latest commit message"
echo "-- 3.2.1 Remove all the build trigger notifications from the latest commit message"
# Remove all the build trigger notifications from the latest commit message
message=$(git show --format=%B | grep -v ":robot: Build trigger")
git commit --amend -m "$message"
Expand All @@ -83,7 +89,7 @@ else
git push -u origin "release/$new_release"

echo "---3.2.3 Check if old release branch still exists"
gitlsremote=$(git ls-remote)
gitlsremote=$(git ls-remote | grep release | grep -v "release/$new_release")
if [[ $gitlsremote =~ release/$old_release ]]
then
# Delete the old release branch
Expand Down
1 change: 1 addition & 0 deletions src/circleci-base/scripts/trigger-build-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ json=$(jq -n \
"branch": $VAL
}')

echo "Build: ${user}/${repo}@${branch}"

curl \
--header "Content-Type: application/json" \
Expand Down
6 changes: 3 additions & 3 deletions src/circleci-base/templates/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ RUN git clone https://github.com/sstephenson/bats.git && \
export "DESIRED_VERSION=v${HELM_VERSION}" && \
curl -sS https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash - && \
wget --no-check-certificate -q https://raw.githubusercontent.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh && \
bash gitflow-installer.sh install stable && \
rm gitflow-installer.sh && \
bash gitflow-installer.sh install version 1.11.0 && \
rm -fr git-flow gitflow-installer.sh && \
curl -s https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 > /usr/local/bin/cloud_sql_proxy && \
chmod 0755 /usr/local/bin/cloud_sql_proxy && \
apt-get install -y --no-install-recommends \
Expand All @@ -54,7 +54,7 @@ RUN git clone https://github.com/sstephenson/bats.git && \

USER ${CIRCLECI_USER}

RUN curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 60 -L "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz" | tar xz && \
RUN curl "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz" | tar xz && \
CLOUDSDK_CORE_DISABLE_PROMPTS=1 ./google-cloud-sdk/install.sh \
--usage-reporting false \
--bash-completion false \
Expand Down

0 comments on commit 7cbe7ef

Please sign in to comment.