Skip to content
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

Isolate our build so that the feedback loop is faster #23411

Merged
merged 7 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
63 changes: 62 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.filter.outputs.build }}
cdk: ${{ steps.filter.outputs.cdk }}
cli: ${{ steps.filter.outputs.cli }}
connectors: ${{ steps.filter.outputs.connectors }}
db: ${{ steps.filter.outputs.db }}
Expand All @@ -65,11 +66,12 @@ jobs:
- '*.gradle'
- 'deps.toml'
- 'airbyte-config/**'
cdk:
- 'airbyte-cdk/**'
cli:
- 'airbyte-api/**'
- 'octavia-cli/**'
connectors:
- 'airbyte-cdk/**'
- 'airbyte-integrations/**'
- 'airbyte-commons-worker/**'
db:
Expand Down Expand Up @@ -150,6 +152,65 @@ jobs:
attempt_limit: 3
attempt_delay: 5000 # in ms

cdk-build:
needs: changes
runs-on: ubuntu-latest
# Because scheduled builds on master require us to skip the changes job. Use always() to force this to run on master.
if: needs.changes.outputs.cdk == 'true' || needs.changes.outputs.build == 'true' || (always() && github.ref == 'refs/heads/master')
name: "Airbyte CDK: Build"
timeout-minutes: 90
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3

- name: Cache Build Artifacts
uses: ./.github/actions/cache-build-artifacts
with:
cache-key: ${{ secrets.CACHE_VERSION }}

- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"

- uses: actions/setup-python@v4
with:
python-version: "3.9"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Connectors Base: Build" was adding "Install Pyenv" (introduced here) but it's not so clear to me why we would need this

- 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.workers.max=8
org.gradle.vfs.watch=false
EOF

- name: Format
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CDK ./gradlew format --scan --info --stacktrace
attempt_limit: 3
attempt_delay: 5000 # in ms

- name: Ensure no file change
run: ./tools/bin/check_for_file_changes

- name: Build
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CDK ./gradlew build --scan
attempt_limit: 3
attempt_delay: 5000 # in ms

- name: Ensure no file change from code formatting
run: git --no-pager diff && test -z "$(git --no-pager diff)"

maxi297 marked this conversation as resolved.
Show resolved Hide resolved
# Connectors Base
# In case of self-hosted EC2 errors, remove this block.
start-connectors-base-build-runner:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pip install -e ".[dev]" # [dev] installs development-only dependencies
##### Autogenerated files
If the iteration you are working on includes changes to the models, you might want to regenerate them. In order to do that, you can run:
```commandline
SUB_BUILD=CONNECTORS_BASE ./gradlew format --scan --info --stacktrace
SUB_BUILD=CDK ./gradlew format
```
This will generate the files based on the schemas, add the license information and format the code. If you want to only do the former and rely on
pre-commit to the others, you can run the appropriate generation command i.e. `./gradlew generateComponentManifestClassFiles`.
Expand Down
44 changes: 26 additions & 18 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,36 @@ if (!System.getenv().containsKey("SUB_BUILD")) {
} else {
def subBuild = System.getenv().get("SUB_BUILD")
println("Building Airbyte Sub Build: " + subBuild)
if (subBuild != "CONNECTORS_BASE" && subBuild != "ALL_CONNECTORS" && subBuild != "OCTAVIA_CLI") {
if (subBuild != "CONNECTORS_BASE" && subBuild != "ALL_CONNECTORS" && subBuild != "OCTAVIA_CLI" && subBuild != "CDK") {
throw new IllegalArgumentException(String.format("%s is invalid. Must be unset or CONNECTORS_BASE, ALL_CONNECTORS or OCTAVIA_CLI", subBuild))
}
}

// shared
include ':airbyte-commons'
include ':airbyte-api'
include ':airbyte-commons-cli'
include ':airbyte-commons-protocol'
include ':airbyte-config:specs'
include ':airbyte-config:init'
include ':airbyte-config:config-models' // reused by acceptance tests in connector base.
include ':airbyte-db:db-lib' // reused by acceptance tests in connector base.
include ':airbyte-json-validation'
include ':airbyte-test-utils'

// airbyte-workers has a lot of dependencies.
include ':airbyte-commons-worker'
include ':airbyte-config:config-persistence' // transitively used by airbyte-workers.
include ':airbyte-db:jooq' // transitively used by airbyte-workers.
include ':airbyte-persistence:job-persistence' // transitively used by airbyte-workers.
if (!System.getenv().containsKey("SUB_BUILD") || System.getenv().get("SUB_BUILD") == "CDK" || System.getenv().get("SUB_BUILD") == "ALL_CONNECTORS") {
include ':airbyte-commons' // this wouldn't be necessary if it wasn't from https://github.com/airbytehq/airbyte/blob/645558b74aab0b91fda1b4628b37b7095d92b4cc/build.gradle
Copy link
Contributor Author

@maxi297 maxi297 Feb 23, 2023

Choose a reason for hiding this comment

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

This seems very odd but I didn't want to investigate this since the build is still somewhat fast compared to before. Note that this seems like another improvement we could do though

include ':tools:code-generator:airbyteDocker'
include ':airbyte-cdk:python'
}

if (!System.getenv().containsKey("SUB_BUILD") || (System.getenv().containsKey("SUB_BUILD") && System.getenv().get("SUB_BUILD") != "CDK")) {
// shared
include ':airbyte-commons'
include ':airbyte-api'
include ':airbyte-commons-cli'
include ':airbyte-commons-protocol'
include ':airbyte-config:specs'
include ':airbyte-config:init'
include ':airbyte-config:config-models' // reused by acceptance tests in connector base.
include ':airbyte-db:db-lib' // reused by acceptance tests in connector base.
include ':airbyte-json-validation'
include ':airbyte-test-utils'

// airbyte-workers has a lot of dependencies.
include ':airbyte-commons-worker'
include ':airbyte-config:config-persistence' // transitively used by airbyte-workers.
include ':airbyte-db:jooq' // transitively used by airbyte-workers.
include ':airbyte-persistence:job-persistence' // transitively used by airbyte-workers.
}

// connectors base
if (!System.getenv().containsKey("SUB_BUILD") || System.getenv().get("SUB_BUILD") == "CONNECTORS_BASE" || System.getenv().get("SUB_BUILD") == "ALL_CONNECTORS") {
Expand Down