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

🐙 Bootstrap octavia-cli project #9070

Merged
merged 27 commits into from
Jan 5, 2022

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Dec 22, 2021

What

The first step of the octavia execution plan is to bootstrap a friendly project directory to welcome future iterations.

How

  • Get inspired by what already exists for other python projects in the repo airbyte-cdk
  • Create an octavia-cli folder
  • Initialize a python project with a setup.py, unit_tests etc.
  • Implement "not implemented" commands and test them.
  • Package the application into a Docker image.
  • Edit the README: Add information about the project, install and usage instructions, and contributions guidelines.
  • Add this project to the platform build.

Recommended reading order

  1. The README: ./octavia-cli/README.md
  2. Python project structure: ./octavia-cli/setup.py, ./octavia-cli/octavia_cli/entrypoint.py, ./octavia-cli/octavia_cli/unit_tests/entrypoint.py etc..
  3. ./octavia-cli/Dockerfile
  4. ./octavia-cli/build.gradle
  5. ./settings.gradle

🚨 User Impact 🚨

The octavia-cli is under development; is it a problem to have a non-working project on the master branch?

❔ Open questions ❔

I am not familiar with Gradle and our platform build process.

  • Is it ok to add this project to the platform build? Even if it's WIP?
  • I'm not sure the ./gradlew format command catches the project files; how do I ensure they are?

The platform build is failing in the CI (but works locally), an error related to pip not being installed... 🤔

@alafanechere alafanechere temporarily deployed to more-secrets December 22, 2021 21:49 Inactive
@alafanechere alafanechere marked this pull request as ready for review December 22, 2021 22:01
Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

@alafanechere alafanechere temporarily deployed to more-secrets December 23, 2021 15:00 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 23, 2021 19:10 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 23, 2021 19:13 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 23, 2021 19:24 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 23, 2021 19:29 Inactive
@alafanechere
Copy link
Contributor Author

alafanechere commented Dec 23, 2021

The platform build runs flawlessly locally, and I don't get why the checkPython step fails with the following error:

Execution failed for task ':octavia-cli:checkPython'.
Caused by: org.gradle.api.GradleException: Pip is not installed. Please install it (https://pip.pypa.io/en/stable/installing/).

It's not very clear to me how we install Python/pip on the EC2 running the CI. I understood we're using 3.8.5 in the CI. I tried to change my .python-version to 3.7.9 to check if it was due to the use of 3.10.0, but it made no difference.

Python execution time: 0.034s
	 3.8.5
	 /usr
	 /usr/bin/python3
Using python 3.8.5 from /usr (python3)

@davinchia davinchia temporarily deployed to more-secrets December 30, 2021 08:38 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 30, 2021 08:48 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 30, 2021 08:56 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets December 30, 2021 09:08 Inactive


@octavia.command(name="list", help="List existing resources on the Airbyte instance.")
def _list():
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity, why do you use _ for list and import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

list and import are reserved Python keywords. I use the _ prefix is to disambiguate the function names.

settings.gradle Outdated
@@ -25,32 +25,38 @@ if (!System.getenv().containsKey("SUB_BUILD")) {
} else {
def subBuild = System.getenv().get("SUB_BUILD")
println("Building Airbyte Sub Build: " + subBuild)
if (subBuild != "PLATFORM" && subBuild != "CONNECTORS_BASE") {
if (subBuild != "PLATFORM" && subBuild != "CONNECTORS_BASE" && subBuild != "OCTAVIA_CLI") {
throw new IllegalArgumentException(String.format("%s is invalid. Must be unset or PLATFORM or CONNECTORS_BASE", subBuild))
Copy link
Contributor

Choose a reason for hiding this comment

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

update error

@davinchia davinchia temporarily deployed to more-secrets December 31, 2021 10:33 Inactive
@davinchia davinchia temporarily deployed to more-secrets December 31, 2021 10:43 Inactive
@davinchia davinchia temporarily deployed to more-secrets December 31, 2021 10:51 Inactive
@davinchia davinchia temporarily deployed to more-secrets December 31, 2021 11:04 Inactive
Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

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

@alafanechere take a look at this. I started reviewing and realised it was faster to clean it up than go through another rounds of comments.

SLACK_TITLE: "Build Success"
SLACK_FOOTER: ""
octavia-cli-build:
# In case of self-hosted EC2 errors, remove the next two lines and uncomment the currently commented out `runs-on` line.
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove this comment


Copyright (c) 2021 Airbyte, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
Copy link
Contributor

Choose a reason for hiding this comment

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

how did you generate this?

Copy link
Contributor

Choose a reason for hiding this comment

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

what license should this use? should it be the same at the platform (not MIT)?

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 was not sure of this too, I was under the impression that what is external to the platform could be MIT, but I suggest we default to the repo license for the moment.

settings.gradle Outdated

// shared by CONNECTORS_BASE and PLATFORM sub builds
//if (!System.getenv().containsKey("SUB_BUILD") == "CONNECTORS_BASE" || System.getenv().get("SUB_BUILD") == "PLATFORM") {
include ':airbyte-api'
Copy link
Contributor

Choose a reason for hiding this comment

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

I realised we can't remove the common modules as this will break Intellij imports due to the way we have it set up currently, which is intellij attempts to import all the platform modules by default.

What we can do it import all of them, but only build the octavia cli module in the build. This will incur some configuration penalty, as Gradle has to look over the configuration for the rest of the modules. Should be minimal so not worried.

Copy link
Contributor

Choose a reason for hiding this comment

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

@alafanechere most of my changes are around this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright! I'm using vs-code for this project so I did not face this problem.

Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

Requesting changes because I'm not sure if the license is right. Otherwise lgtm!


Copyright (c) 2021 Airbyte, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
Copy link
Contributor

Choose a reason for hiding this comment

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

what license should this use? should it be the same at the platform (not MIT)?

SLACK_USERNAME: Buildbot
SLACK_TITLE: "Build Success"
SLACK_FOOTER: ""
octavia-cli-build:
Copy link
Contributor

Choose a reason for hiding this comment

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

@davinchia should these run on aws instances like the other builds?

Copy link
Contributor

Choose a reason for hiding this comment

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

most of the work done is limited to the octavia module. only exception is format, but that isn't much faster on the big instances.

the current build is 5 mins, which I think is okay!

Copy link
Contributor Author

@alafanechere alafanechere Jan 3, 2022

Choose a reason for hiding this comment

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

When we discussed this with @davinchia we thought the job was light enough to run on the default ubuntu instance and not depend on the EC2 instance availability. But it could also be interesting to have a build context parity and use an EC2 instance for this build too. My concern is that it will require adding new start and stop jobs for a new runner which will make the full workflow run longer.

with:
python-version: "3.8"

- name: Set up CI Gradle Properties
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a comment with a link to why we set these properties please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest I'm not understanding the purpose of the --add-exports options and copy-pasted this step from other builds for parity.

@@ -105,6 +105,10 @@ if (!System.getenv().containsKey("SUB_BUILD") || System.getenv().get("SUB_BUILD"
include ':tools:code-generator'
}

if (!System.getenv().containsKey("SUB_BUILD") || System.getenv().get("SUB_BUILD") == "OCTAVIA_CLI") {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to just have it be "CLI" instead of "OCTAVIA_CLI"? just easier to type.

Copy link
Contributor

@davinchia davinchia Jan 3, 2022

Choose a reason for hiding this comment

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

I like having a shorter name. Would this be confused with our Go cli? (is that still a thing?)

Copy link
Contributor Author

@alafanechere alafanechere Jan 3, 2022

Choose a reason for hiding this comment

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

My opinion is that the OCTAVIA prefix allows to disambiguate from the airbyte-cli build already declared in this file.

@alafanechere alafanechere temporarily deployed to more-secrets January 3, 2022 08:52 Inactive
@alafanechere
Copy link
Contributor Author

alafanechere commented Jan 3, 2022

Thank you very much @michel-tricot @davinchia and @cgardens for your reviews!
Here are the three remaining open questions I have (in order of priority):

  1. License: Does defaulting to the repo license sound good to you? I declared MIT at first because I was under the impression that anything outside of the platform could be MIT, but, for simplicity, I think we can default to ELv2 for the moment and re-open this licensing question in the future if needed.
  2. Job build context: Should we start a dedicated runner for the octavia-cli build, as we do for connector-base and platform build? The build is light enough for the moment to run on the default ubuntu instance, but for parity between builds, you might want a EC2 runner for this build too. My only concern is that this will lead to a longer run of the gradle.yml workflow.
  3. Gradle properties: @cgardens suggested adding a comment to explain the Set up CI Gradle Properties step. I copy-pasted this step from the other builds. @davinchia would you be able to add this comment as I'm not 100% sure of what's its purpose.

@alafanechere alafanechere requested a review from cgardens January 3, 2022 09:58
@davinchia
Copy link
Contributor

Agree on using ELv2 for now. We can change this later and it's easier to go from a less permissive to more permissive license.

Let's run on the normal Github instance for now. I don't see a strong reason to switch so rather keep it simpler.

How does ^ sound @cgardens ?

I believe the CI properties are to work with Java 17. I don't think we need to annotate them (or if we did, maybe a follow up PR?). @jrhizor do know how long we'll need to keep these settings? Are they temporary?

@michel-tricot
Copy link
Contributor

For the license we should use MIT. That's also what we advertised when we released the new license.

https://docs.airbyte.com/project-overview/licenses/license-faq

@alafanechere alafanechere temporarily deployed to more-secrets January 4, 2022 09:21 Inactive
@alafanechere
Copy link
Contributor Author

For the license we should use MIT. That's also what we advertised when we released the new license.

I re-added the MIT then. @michel-tricot I guess you mean it should be MIT because it's not in the "managed service" scope described in the license FAQ.

@alafanechere alafanechere temporarily deployed to more-secrets January 4, 2022 09:26 Inactive
Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

thanks @alafanechere . my questions around license and where the build should run are answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants