-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Speed Up Publish OSS Artifacts for Cloud Workflow #19696
Changes from 11 commits
431639f
fae20da
a4a1297
92f2fd6
4d7912b
6b283a5
800b747
5c015df
fc0c421
8efd8a0
38d9d4d
4b33b82
edced9d
89db68a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: 'Prepare Runner for Building' | ||
description: 'Prepare Runner for Building project' | ||
inputs: | ||
install_java: | ||
description: '' | ||
required: false | ||
default: 'true' | ||
install_node: | ||
description: '' | ||
required: false | ||
default: 'true' | ||
install_python: | ||
description: '' | ||
required: false | ||
default: 'true' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- if: inputs.install_java == 'true' | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
|
||
- if: inputs.install_node == 'true' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/gallium" | ||
|
||
- if: inputs.install_python == 'true' | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- if: inputs.install_java == 'true' | ||
name: Set up CI Gradle Properties | ||
run: | | ||
mkdir -p ~/.gradle/ | ||
cat > ~/.gradle/gradle.properties <<EOF | ||
org.gradle.jvmargs=-Xmx8g -Xss4m --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED | ||
org.gradle.vfs.watch=false | ||
EOF | ||
shell: bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: Publish OSS Artifacts for Cloud | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ inputs.oss_ref || github.sha }} | ||
|
||
env: | ||
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} | ||
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} | ||
davinchia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -64,6 +66,12 @@ jobs: | |
cat $GITHUB_OUTPUT || true # for the sake of investigation | ||
|
||
oss-branch-build: | ||
concurrency: | ||
# only allow one workflow run at a time for a given SHA | ||
# to prevent multiple runs from pushing artifacts for the same SHA at the same time | ||
# note: using inputs in the group expression only works when specifying concurrency at the job level | ||
group: ${{ github.workflow }}-${{ inputs.oss_ref || github.sha }} | ||
cancel-in-progress: false | ||
name: "Gradle Build and Publish" | ||
needs: | ||
- start-runner | ||
|
@@ -80,6 +88,7 @@ jobs: | |
uses: ./.github/actions/build-branch | ||
with: | ||
branch_version_tag: ${{ needs.generate-tags.outputs.dev_tag }} | ||
build_docker_images: 'false' | ||
|
||
- name: Publish Dev Jars | ||
env: | ||
|
@@ -97,6 +106,12 @@ jobs: | |
shell: bash | ||
|
||
docker-push: | ||
concurrency: | ||
# only allow one workflow run at a time for a given SHA | ||
# to prevent multiple runs from pushing artifacts for the same SHA at the same time | ||
# note: using inputs in the group expression only works when specifying concurrency at the job level | ||
group: ${{ github.workflow }}-${{ inputs.oss_ref || github.sha }} | ||
cancel-in-progress: false | ||
name: "Push Docker Images" | ||
needs: | ||
- start-runner | ||
|
@@ -123,6 +138,15 @@ jobs: | |
echo "GIT_REVISION=${GIT_REVISION}" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Prepare Runner for Building | ||
uses: ./.github/actions/runner-prepare-for-build | ||
|
||
# Put tars/artifacts in the correct build directories so docker buildx can find the artifacts it needs when building docker images | ||
- name: Prepare Docker context | ||
run: VERSION=${{ needs.generate-tags.outputs.dev_tag }} SUB_BUILD=PLATFORM ./gradlew copyGeneratedTar airbyte-db:db-lib:copyInitSql | ||
davinchia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
shell: bash | ||
|
||
# Build docker images using docker buildx (for multi platform) | ||
- name: Push Docker Images | ||
env: | ||
VERSION: ${{ needs.generate-tags.outputs.dev_tag }} | ||
|
@@ -133,3 +157,37 @@ jobs: | |
- name: Cleanup Docker buildx | ||
run: docker buildx rm oss-buildx | ||
shell: bash | ||
|
||
stop-runner: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh did we previously not stop runners? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, seems like a bug that went unnoticed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yikes - good catch |
||
name: "Stop Build EC2 Runner" | ||
timeout-minutes: 10 | ||
needs: | ||
- start-runner # required to get output from the start-runner job | ||
- docker-push # wait until all publish steps are done | ||
runs-on: ubuntu-latest | ||
# Always is required to stop the runner even if the previous job has errors. However always() runs even if the previous step is skipped. | ||
# Thus, we check for skipped here. | ||
if: ${{ always() && needs.start-runner.result != 'skipped'}} | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
- name: Checkout Airbyte | ||
uses: actions/checkout@v3 | ||
- name: Check PAT rate limits | ||
run: | | ||
./tools/bin/find_non_rate_limited_PAT \ | ||
${{ secrets.AIRBYTEIO_PAT }} \ | ||
${{ secrets.OSS_BUILD_RUNNER_GITHUB_PAT }} \ | ||
${{ secrets.SUPERTOPHER_PAT }} \ | ||
${{ secrets.DAVINCHIA_PAT }} | ||
- name: Stop EC2 runner | ||
uses: airbytehq/ec2-github-runner@base64v1.1.0 | ||
with: | ||
mode: stop | ||
github-token: ${{ env.PAT }} | ||
label: ${{ needs.start-runner.outputs.label }} | ||
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment is nice here that says something along the lines of
//these environment variables are necessary for gradle cache task