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

Use bundled packages and update CI to dual publish to DockerHub and Upbound Marketplace #456

Merged
merged 12 commits into from
Sep 7, 2022

Conversation

hasheddan
Copy link
Member

Description of your changes

Drops all deprecated annotations from the provider-aws crossplane.yaml.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Drops the spec from the crossplane.yaml as bundled images will now be
used for provider-aws.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Renames the single image that is being built as base to provider-gcp.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Updates package base image to use distroless static nonroot instead of
defaulting to outdated alpine image.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Updates package base image to use distroless static nonroot instead of
defaulting to outdated alpine image.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Adds the xpkg machinery to Makefile and updates other components to be
compatible.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Updates integration tests to consume the xpkg image that is built.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Adds a login step to publish artifacts workflow for xpkg.upbound.io.

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Fixes #453

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

🤖 (stack-gcp) VERSION=v0.22.0 make -j2 build.all
14:49:57 [ .. ] verify go modules dependencies have expected content
all modules verified
14:49:59 [ OK ] go modules dependencies verified
14:49:59 [ .. ] go build linux_arm64
14:49:59 [ .. ] go build linux_amd64
github.com/crossplane-contrib/provider-gcp/cmd/provider
github.com/crossplane-contrib/provider-gcp/cmd/provider
14:50:02 [ OK ] go build linux_arm64
14:50:02 [ OK ] go build linux_amd64
14:50:02 [ .. ] docker build build-bc8bf8b8/provider-gcp-amd64
14:50:02 [ .. ] docker build build-bc8bf8b8/provider-gcp-arm64
[+] Building 0.0s (0/0)                                                                                                     
[+] Building 0.1s (0/2)                                                                                                     
 => [internal] load .dockerignore                                                                                      0.1s
[+] Building 0.3s (0/2)                                                                                                     
[+] Building 0.4s (1/2)                                                                                                     
[+] Building 0.5s (2/3)                                                                                                     
[+] Building 0.9s (4/6)                                                                                                     
 => [internal] load .dockerignore                                                                                      0.4s
 => => transferring context: 2B                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                   0.4s
[+] Building 1.9s (5/6)                                                                                                     
[+] Building 3.0s (6/7)                                                                                                     
 => [internal] load .dockerignore                                                                                      0.4s 
[+] Building 6.4s (8/8) FINISHED                                                                                            
 => [internal] load build definition from Dockerfile                                                                   0.4s 
 => => transferring dockerfile: 300B                                                                                   0.0s
 => [internal] load .dockerignore                                                                                      0.4s 
[+] Building 6.5s (6/7)                                                                                                     
 => [internal] load .dockerignore                                                                                      0.4s
[+] Building 7.5s (8/8) FINISHED                                                                                            
 => [internal] load .dockerignore                                                                                      0.4s
 => => transferring context: 2B                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                   0.4s
 => => transferring dockerfile: 300B                                                                                   0.0s
 => [internal] load metadata for gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d39d40c2edb3e  0.3s
 => CACHED [1/2] FROM gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d39d40c2edb3e7f6e2452298  0.0s
 => => resolve gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d39d40c2edb3e7f6e2452298b        0.0s
 => [internal] load build context                                                                                      1.1s
 => => transferring context: 47.41MB                                                                                   1.1s
 => [2/2] ADD bin/linux_amd64/provider /usr/local/bin/crossplane-gcp-provider                                          1.0s
 => exporting to oci image format                                                                                      4.6s
 => => exporting layers                                                                                                3.7s
 => => exporting manifest sha256:81cde356af130c2943c936881509cf8bdf06febd44fce95d0f61663f95f1f919                      0.0s
 => => exporting config sha256:1ae123896a572b19687193a6a434f99c2683c3f618b2551bcde1dc4686d36e9b                        0.0s
 => => sending tarball                                                                                                 0.9s
 => importing to docker                                                                                                0.6s
14:50:10 [ OK ] docker build build-bc8bf8b8/provider-gcp-amd64
14:50:10 [ .. ] Building package provider-gcp-v0.22.0.xpkg for linux_amd64
xpkg saved to /home/dan/code/github.com/crossplane/stack-gcp/_output/xpkg/linux_arm64/provider-gcp-v0.22.0.xpkg
14:50:13 [ OK ] Built package provider-gcp-v0.22.0.xpkg for linux_arm64
xpkg saved to /home/dan/code/github.com/crossplane/stack-gcp/_output/xpkg/linux_amd64/provider-gcp-v0.22.0.xpkg
14:50:14 [ OK ] Built package provider-gcp-v0.22.0.xpkg for linux_amd64
🤖 (stack-gcp) VERSION=v0.22.0 make -j2 publish
🤖 (stack-gcp) VERSION=v0.22.0 BRANCH_NAME=main make -j2 publish
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
14:51:13 [ .. ] Pushing package xpkg.upbound.io/dan/provider-gcp:v0.22.0
14:51:13 [ .. ] Skipping image publish for docker.io/provider-gcp:v0.22.0
Publish is deferred to xpkg machinery
14:51:13 [ OK ] Image publish skipped for docker.io/provider-gcp:v0.22.0
14:51:13 [ .. ] Pushing package index.docker.io/hasheddan/provider-gcp:v0.22.0
xpkg pushed to index.docker.io/hasheddan/provider-gcp:v0.22.0
14:51:38 [ OK ] Pushed package index.docker.io/hasheddan/provider-gcp:v0.22.0
xpkg pushed to xpkg.upbound.io/dan/provider-gcp:v0.22.0
14:51:48 [ OK ] Pushed package xpkg.upbound.io/dan/provider-gcp:v0.22.0

Published image contents: https://explore.ggcr.dev/?image=hasheddan%2Fprovider-gcp%3Av0.22.0

Drops all deprecated annotations from the provider-aws crossplane.yaml.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Drops the spec from the crossplane.yaml as bundled images will now be
used for provider-aws.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Renames the single image that is being built as base to provider-gcp.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates package base image to use distroless static nonroot instead of
defaulting to outdated alpine image.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates provider controller image building to use imagelight for
enhanced flexibility. Publish and promotion is deferred to xpkg
machinery.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds the xpkg machinery to Makefile and updates other components to be
compatible.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates integration tests to consume the xpkg image that is built.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates build submodule to consume latest updates, including xpkg.mk.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Forces image to be built before building xpkg, ensuring that the image
is in the daemon before we try to use it as base.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds a login step to publish artifacts workflow for xpkg.upbound.io.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Copy link
Member Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

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

See crossplane-contrib/provider-aws#1460 for similar functionality in provider-aws.

Updates to go1.18 and fixes all linter errors introduced by the
golangci-lint bump.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates integration tests to go back to using the latest stable version
of Crossplane.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Copy link
Collaborator

@Feggah Feggah left a comment

Choose a reason for hiding this comment

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

LGTM.

Just a small comment

Comment on lines -82 to -84
spec:
controller:
image: DOCKER_REGISTRY/provider-gcp-controller:VERSION
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm just curious. If I understand it correctly, now the provider and the controller are the same image. This means that the Provider kind doesn't need to specify the spec.controller.image field.

Looking at the doc.crds, I saw that the field spec.controller is still required:
image

So a valid specification of Provider would be:

apiVersion: meta.pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-gcp
spec:
  controller: {}

This means that provider-gcp version v0.21.0 (latest) and earlier should specify spec.controller.image, v0.22.0 (release that should include this PR) doesn't need to specify it. Am I right? Just wondering if we should write this in the Release notes

Copy link
Member Author

Choose a reason for hiding this comment

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

@Feggah I think it would be worth including this update in the release notes, but it shouldn't have too much of an impact on users as they aren't actually constructing the meta.pkg.crossplane.io types 👍🏻

Comment on lines +310 to +311
username: ${{ secrets.XPKG_ACCESS_ID }}
password: ${{ secrets.XPKG_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

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

Do these need to be created at the crossplane-contrib org level? I don't see them.

Copy link
Member Author

Choose a reason for hiding this comment

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

@negz I have created these tokens for provider-aws / provider-gcp / provider-azure in each individual repo with scope limited to the individual repositories -- happy to broaden permissions and set at org level if you prefer (I feel like we had this same conversation a few years ago 🙂 )

@hasheddan hasheddan merged commit d24f532 into crossplane-contrib:master Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use bundled packages and update CI to dual publish to DockerHub and Upbound Marketplace
3 participants