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

release: dynamic connector VERSION file #301

Merged
merged 3 commits into from
Jul 28, 2022
Merged

Conversation

mdibaiee
Copy link
Member

@mdibaiee mdibaiee commented Jul 27, 2022

Description:

  • Adds a VERSION file to each connector that specifies the version of the connector (at the moment it's v1 for all)
  • This allows us to bump a version when necessary

Workflow steps:

  • Run CI

Documentation links affected:

N/A

Notes for reviewers:

(anything that might help someone review this PR)


This change is Reviewable

@mdibaiee mdibaiee force-pushed the mahdi/release-version branch from a8afdc1 to 319a661 Compare July 27, 2022 13:09
@mdibaiee mdibaiee requested review from willdonnelly and psFried July 27, 2022 13:17
Copy link
Member

@psFried psFried left a comment

Choose a reason for hiding this comment

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

I think this seems directionally right, but had a few comments.

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@@ -60,7 +62,7 @@ jobs:
context: .
file: base-image/Dockerfile
push: true # See 'if' above
tags: ghcr.io/estuary/base-image:dev,ghcr.io/estuary/base-image:v1
tags: ghcr.io/estuary/base-image:dev,ghcr.io/estuary/base-image:${{ steps.prep.outputs.version }}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not seeing why we'd want the version applied to the base image. All of the connectors Dockerfiles that use the base image hard-code the version as :v1. But that's also not making a ton of sense to me, since the build always builds and tags the base image with :local, and only tags it with :v1 on a push to main. So I'd think as it is, that if you make a change to the base image in a PR, then the connector builds won't actually use that change until after it's been merged to main.

Basically, this seems like it was already broken before this PR, but adding the dynamic version to base image definitely doesn't seem like it would help. I'm not confident that I fully understand the purpose of base-image, so take this with a grain of salt. But it seems to me like we could only build the :local tag of the base image and just use that in the connector builds instead of v1.

Copy link
Member Author

Choose a reason for hiding this comment

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

@psFried

So I'd think as it is, that if you make a change to the base image in a PR, then the connector builds won't actually use that change until after it's been merged to main.

That's true, I don't know what's the best way out of that. If you really want to try something in your PR, you can change your PR to include a change to a connector to use base-image:local or something of the sort.

But it seems to me like we could only build the :local tag of the base image and just use that in the connector builds instead of v1.

The idea is we want the base-image to be available to 3rd-parties who want to create connectors for Flow as well, because we have certain requirements that might change (think: we added OpenSSH requirements to docker images, base image serves that).

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't foresee breaking changes in the base-image to be frequent at all. We will realistically only want to break the base-image if we are making some serious changes to how we run connectors.

Copy link
Member

Choose a reason for hiding this comment

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

My two cents: I think given that we want base-image to be published to ghcr.io for others to use it does make sense to give it a version tag, but it seems confusing and unexpected that when making a change to base-image in a PR the new connectors built by that CI run won't include the change. Could we use the :local tag in our connector builds but still push the version-file-tagged base-image?

Copy link
Member

Choose a reason for hiding this comment

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

It looks like CI builds are failing because the ghcr.io/estuary/base-image:local image built in one job isn't visible to the other matrix job. Cursory googling suggests that you can export the whole Docker image as a file and move that between jobs though (see docker/build-push-action#225 (comment) for instance).

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried my best on this, but no luck.

Apparently docker buildx does not pick up local images: docker/buildx#847
This means even if we move the image from the build-base to build-connector job, it doesn't get picked up by buildx. It doesn't even get picked up if you build the base-image in build-connector job, it always tries to fetch the image from remote, and will fail if it doesn't exist.

There is probably one hacky way around this which is spinning up a local registry in the CI job, pushing to that local registry and using that, but that means our Dockerfiles will have FROM localhost:5000/base-image:local in them, which makes building them on our local machines cumbersome and hacky and unintuitive.

All in all, I don't really like this solution. I'd say let's try to live with this until buildx supports a way of using local images in its builds.

Copy link
Member

@willdonnelly willdonnelly Jul 27, 2022

Choose a reason for hiding this comment

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

Yeah, I think we've at least established that this is complex enough it shouldn't be tacked on to this change.

(That said, I think it may still be possible to make local builds work via something like ARG BASE_IMAGE=ghcr.io/estuary/base-image:local and then FROM ${BASE_IMAGE} (relevant docs), and then by overriding the BASE_IMAGE variable during our CI builds it could be pointed at another registry)

Copy link
Member Author

Choose a reason for hiding this comment

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

@willdonnelly that's a good idea, given that it seems to support value substitution just like bash (e.g. ${variable:-default}), we can default to v1 image to allow local builds to run just fine. In this case, we don't even need to move the image, or a local registry, since we do publish the hash-tagged base-image. We can just point to that. I'll look at it tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it working 👍🏽

Copy link
Member Author

@mdibaiee mdibaiee Jul 28, 2022

Choose a reason for hiding this comment

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

So now image builds in CI (except the final dev + version build of connectors) use the local base-image

materialize-boilerplate/VERSION Outdated Show resolved Hide resolved
materialize-sql/VERSION Outdated Show resolved Hide resolved
@mdibaiee mdibaiee force-pushed the mahdi/release-version branch from 319a661 to 2293a3e Compare July 27, 2022 14:35
@mdibaiee mdibaiee force-pushed the mahdi/release-version branch 18 times, most recently from 722bcb1 to 85e7872 Compare July 28, 2022 10:56
@mdibaiee mdibaiee force-pushed the mahdi/release-version branch from 85e7872 to 76295fa Compare July 28, 2022 11:48
Copy link
Member

@psFried psFried left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for also fixing the base image handling. The introduction of the changelogs also seems like a good idea.

Copy link
Member

@willdonnelly willdonnelly left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for getting this working!

@mdibaiee mdibaiee merged commit c98ef88 into main Jul 28, 2022
@mdibaiee mdibaiee deleted the mahdi/release-version branch July 28, 2022 15:48
@oliviamiannone oliviamiannone added the docs complete / NA No (more) doc work related to this PR label Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs complete / NA No (more) doc work related to this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants