Skip to content

🐛 octavia-cli: specific release job for octavia #11517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bb938fe
specific release step for octavia
alafanechere Mar 29, 2022
fb85af0
specific release step for octavia
alafanechere Mar 29, 2022
f940207
specific release step for octavia
alafanechere Mar 29, 2022
88120ec
fix typo
alafanechere Mar 29, 2022
80fb22f
clean venv
alafanechere Mar 30, 2022
7d81669
Merge branch 'master' into augustin/octavia-cli/fix-release
alafanechere Mar 30, 2022
b409a5b
disable push
alafanechere Mar 30, 2022
f56b478
Merge branch 'augustin/octavia-cli/fix-release' of https://github.com…
alafanechere Mar 30, 2022
2c2fabc
check if plaftorm build pollutes octavia build
alafanechere Mar 30, 2022
2ebc4e3
separte job for octavia release
alafanechere Mar 30, 2022
43f347a
custom bumpversion for octavia
alafanechere Mar 30, 2022
bf04b8e
clean workflox
alafanechere Mar 30, 2022
7741b77
clean release_version_octavia.sh
alafanechere Mar 30, 2022
6beccda
get new version from bumpversion output
alafanechere Mar 30, 2022
63b2d0c
custom pr body
alafanechere Mar 30, 2022
426987a
fix PR body
alafanechere Mar 30, 2022
f015272
fix markdown
alafanechere Mar 30, 2022
1283821
re-enable platform build
alafanechere Mar 30, 2022
e1f4664
Merge branch 'master' into augustin/octavia-cli/fix-release
alafanechere Mar 30, 2022
edd8357
clean
alafanechere Mar 30, 2022
749a2a0
rework to make a single bump PR
alafanechere Mar 30, 2022
633d80a
fix
alafanechere Mar 30, 2022
4b11f1e
fix
alafanechere Mar 30, 2022
14e0e2a
fix .bumpversion.cfg
alafanechere Mar 30, 2022
eabec42
re-enable build + publish for octavia
alafanechere Mar 30, 2022
6218f67
source bump_version.sh
alafanechere Mar 30, 2022
a8c0be0
source bump_version.sh
alafanechere Mar 30, 2022
28629ff
readd login
alafanechere Mar 30, 2022
4661a36
re-enable build and publish of platform
alafanechere Mar 30, 2022
a8feb00
Update tools/bin/release_version_octavia.sh
alafanechere Mar 30, 2022
afd97ab
Update tools/bin/release_version_octavia.sh
alafanechere Mar 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

@supertopher supertopher Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: these grep lines can get scary as the env file changes in the future

Suggested change
NEW_VERSION=$(grep -w VERSION .env | cut -d"=" -f2)
# source and . are the same command
source .env
new_version=$VERSION

by POSIX convention that is largely unfollowed ALL_CAPS variables are for use outside of the file, and lower case variables are for internal use... no one follows this though so ¯\(ツ)

my suggestion will annoy set -u as .env has alot of unset things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can retrieve the new version from the bumpversion execution, but I wanted to use the same grep that we use for PREV_VERSION for consistency. Thanks for the suggestion! Do you think the grep regex should be more strict for safety?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greps are fine, I've just been bitten in the past.

They are brittle to future changes and it's not usually clear when a break happens caused by changes to something like ENV variable naming


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
29 changes: 8 additions & 21 deletions tools/bin/release_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,11 @@ 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..."

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..."
source ./tools/bin/bump_version.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source seems a little confusing here, are we simply intending to execute bump version, or is there something I am missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to make the NEW_VERSION, PREV_VERSION and GIT_REVISION variable available in this script, these are defined in ./tools/bin/bump_version.sh this why I sourced the script

Copy link
Contributor

@supertopher supertopher Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-03-30 at 11 59 31 AM

you will get those variables. However you will also execute all the code. I made a screenshot example. Just like most import statements you get the variables and you execute the code

Shell in it's heart wants executables to be TINY so you can put them all together and do cool stuff. If you want half a script it's probably too large, break it up and call it from both places if it works better


# TESTING: DISABLE BUILD AND PUBLISH FOR ITERATIONS ON CI
# 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 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 [[ -z "${DOCKER_PASSWORD}" ]]; then
echo 'DOCKER_PASSWORD for airbytebot not set.';
exit 1;
fi

docker login -u airbytebot -p "${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..."