Skip to content

Commit

Permalink
🐛 octavia-cli: specific release job for octavia (#11517)
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere authored Mar 30, 2022
1 parent d21fcbb commit 2d8f66f
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 30 deletions.
68 changes: 56 additions & 12 deletions .github/workflows/release-airbyte-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,10 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: "16.13.0"

# necessary to install pip
- uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Save Old Version
id: old_version
run: |
echo ::set-output name=OLD_VERSION::$(grep -w VERSION .env | cut -d"=" -f2)
- name: Release Airbyte
id: release_airbyte
env:
Expand All @@ -81,14 +76,63 @@ jobs:
CLOUDREPO_PASSWORD: ${{ secrets.CLOUDREPO_PASSWORD }}
run: |
./tools/bin/release_version.sh
- name: Save New Version
id: new_version
run: |
echo ::set-output name=NEW_VERSION::$(grep -w VERSION .env | cut -d"=" -f2)
# We are releasing octavia from a separate job because:
# - The self hosted runner used in releaseAirbyte does not have the docker buildx command to build multi-arch images
# - Plaform build requires Python 3.7, Octavia Build requires 3.8
releaseOctavia:
runs-on: ubuntu-latest
environment: more-secrets
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: "17"

- uses: actions/setup-node@v1
with:
node-version: "16.13.0"
# octavia-cli build requires Python 3.8.
# We use 3.8 in this project because 3.7 is not supported on Apple M1.
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Release Octavia
id: release_octavia
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PART_TO_BUMP: ${{ github.event.inputs.partToBump }}
run: ./tools/bin/release_version_octavia.sh

createPullRequest:
needs:
- releaseAirbyte
- releaseOctavia
runs-on: ubuntu-latest
environment: more-secrets
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# necessary to install pip
- uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Bump version
id: bump_version
env:
PART_TO_BUMP: ${{ github.event.inputs.partToBump }}
run: ./tools/bin/bump_version.sh
- name: Get PR Body
id: pr_body
env:
PREV_VERSION: ${{ steps.old_version.outputs.OLD_VERSION }}
PREV_VERSION: ${{ steps.bump_version.outputs.PREV_VERSION }}
NEW_VERSION: ${{ steps.bump_version.outputs.NEW_VERSION }}
GIT_REVISION: ${{ steps.bump_version.outputs.GIT_REVISION }}
run: |
chmod +x tools/bin/pr_body.sh
body=$(./tools/bin/pr_body.sh)
Expand All @@ -102,9 +146,9 @@ jobs:
branch: bump-version
branch-suffix: random
delete-branch: true
title: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }}
title: Bump Airbyte version from ${{ steps.bump_version.outputs.PREV_VERSION }} to ${{ steps.bump_version.outputs.NEW_VERSION }}
body: ${{ steps.pr_body.outputs.PR_BODY }}
commit-message: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }}
commit-message: Bump Airbyte version from ${{ steps.bump_version.outputs.PREV_VERSION }} to ${{ steps.bump_version.outputs.NEW_VERSION }}
- name: PR Details
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
Expand Down
14 changes: 14 additions & 0 deletions tools/bin/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eu
PREV_VERSION=$(grep -w VERSION .env | cut -d"=" -f2)
GIT_REVISION=$(git rev-parse HEAD)

pip install bumpversion
bumpversion "$PART_TO_BUMP"

NEW_VERSION=$(grep -w VERSION .env | cut -d"=" -f2)

echo "Bumped version from ${PREV_VERSION} to ${NEW_VERSION}"
echo ::set-output name=PREV_VERSION::${PREV_VERSION}
echo ::set-output name=NEW_VERSION::${NEW_VERSION}
echo ::set-output name=GIT_REVISION::${GIT_REVISION}
1 change: 0 additions & 1 deletion tools/bin/pr_body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e

. tools/lib/lib.sh

GIT_REVISION=$(git rev-parse HEAD)
[[ -z "$GIT_REVISION" ]] && echo "Couldn't get the git revision..." && exit 1

echo "*IMPORTANT: Only merge if the platform build is passing!*"
Expand Down
20 changes: 3 additions & 17 deletions tools/bin/release_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,10 @@ fi

docker login -u airbytebot -p "${DOCKER_PASSWORD}"

PREV_VERSION=$(grep -w VERSION .env | cut -d"=" -f2)

[[ -z "$PART_TO_BUMP" ]] && echo "Usage ./tools/bin/release_version.sh (major|minor|patch)" && exit 1

# uses .bumpversion.cfg to find files to bump
# requires no git diffs to run
# commits the bumped versions code to your branch
pip install bumpversion
bumpversion "$PART_TO_BUMP"

NEW_VERSION=$(grep -w VERSION .env | cut -d"=" -f2)
GIT_REVISION=$(git rev-parse HEAD)
[[ -z "$GIT_REVISION" ]] && echo "Couldn't get the git revision..." && exit 1

echo "Bumped version from ${PREV_VERSION} to ${NEW_VERSION}"
echo "Building and publishing version $NEW_VERSION for git revision $GIT_REVISION..."
source ./tools/bin/bump_version.sh

echo "Building and publishing PLATFORM version $NEW_VERSION for git revision $GIT_REVISION..."
VERSION=$NEW_VERSION SUB_BUILD=PLATFORM ./gradlew clean build
SUB_BUILD=PLATFORM ./gradlew publish
VERSION=$NEW_VERSION GIT_REVISION=$GIT_REVISION docker-compose -f docker-compose.build.yaml push
echo "Completed building and publishing..."
echo "Completed building and publishing PLATFORM..."
19 changes: 19 additions & 0 deletions tools/bin/release_version_octavia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

. tools/lib/lib.sh

if test -z "${DOCKER_PASSWORD}"; then
echo 'DOCKER_PASSWORD for airbytebot not set.';
exit 1;
fi

docker login --username airbytebot --password "${DOCKER_PASSWORD}"

source ./tools/bin/bump_version.sh

echo "Building and publishing OCTAVIA version ${NEW_VERSION} for git revision ${GIT_REVISION}..."
VERSION=$NEW_VERSION SUB_BUILD=OCTAVIA_CLI ./gradlew clean build
./octavia-cli/publish.sh ${NEW_VERSION} ${GIT_REVISION}
echo "Completed building and publishing OCTAVIA..."

0 comments on commit 2d8f66f

Please sign in to comment.