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

Update build+publish process and use bundled packages #24

Merged
merged 4 commits into from
Oct 5, 2022
Merged

Update build+publish process and use bundled packages #24

merged 4 commits into from
Oct 5, 2022

Conversation

jastang
Copy link
Contributor

@jastang jastang commented Oct 3, 2022

Signed-off-by: Jason Tang jason@upbound.io

Description of your changes

Updates the build machinery to use bundled packages, as well as publish to crossplane-contrib OCI repos in both DockerHub and Upbound registries.

xref crossplane/crossplane#3350

I have:

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

How has this code been tested

Build

➜  provider-styra git:(main) ✗ VERSION=v0.2.1 GO=go1.16.3 make build.all
15:54:11 [ .. ] verify go modules dependencies have expected content
all modules verified
15:54:13 [ OK ] go modules dependencies verified
15:54:14 [ .. ] go build linux_amd64
15:54:16 [ OK ] go build linux_amd64
15:54:17 [ .. ] go build linux_arm64
15:54:19 [ OK ] go build linux_arm64
15:54:20 [ .. ] docker build build-087ed814/provider-styra-amd64
[+] Building 1.4s (7/7) FINISHED                                                                     
 => [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 304B                                                            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 2B                                                                 0.0s
 => [internal] load metadata for gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b57  0.3s
 => [internal] load build context                                                               0.8s
 => => transferring context: 44.26MB                                                            0.8s
 => CACHED [1/2] FROM gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d  0.0s
 => [2/2] ADD bin/linux_amd64/provider /usr/local/bin/crossplane-styra-provider                 0.1s
 => exporting to image                                                                          0.1s
 => => exporting layers                                                                         0.1s
 => => writing image sha256:8f1bd144dedce535b523d22cec245f6b6b031a5224782b03dd496e5762b7da39    0.0s
 => => naming to docker.io/build-087ed814/provider-styra-amd64                                  0.0s
15:54:22 [ OK ] docker build build-087ed814/provider-styra-amd64
15:54:22 [ .. ] Building package provider-styra-v0.2.1.xpkg for linux_amd64
xpkg saved to /Users/jasontang/workspace/provider-styra/_output/xpkg/linux_amd64/provider-styra-v0.2.1.xpkg
15:54:24 [ OK ] Built package provider-styra-v0.2.1.xpkg for linux_amd64
15:54:24 [ .. ] docker build build-087ed814/provider-styra-arm64
[+] Building 0.9s (7/7) FINISHED                                                                     
 => [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 304B                                                            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 2B                                                                 0.0s
 => [internal] load metadata for gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b57  0.0s
 => CACHED [1/2] FROM gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d  0.0s
 => [internal] load build context                                                               0.7s
 => => transferring context: 40.97MB                                                            0.7s
 => [2/2] ADD bin/linux_arm64/provider /usr/local/bin/crossplane-styra-provider                 0.1s
 => exporting to image                                                                          0.1s
 => => exporting layers                                                                         0.1s
 => => writing image sha256:e08add8336b478690377d0cfe598c9e92d1bdad03f5f754f16a43140cdd6e1c4    0.0s
 => => naming to docker.io/build-087ed814/provider-styra-arm64                                  0.0s
15:54:26 [ OK ] docker build build-087ed814/provider-styra-arm64
15:54:26 [ .. ] Building package provider-styra-v0.2.1.xpkg for linux_arm64
xpkg saved to /Users/jasontang/workspace/provider-styra/_output/xpkg/linux_arm64/provider-styra-v0.2.1.xpkg
15:54:28 [ OK ] Built package provider-styra-v0.2.1.xpkg for linux_arm64

Publish

➜  provider-styra git:(main) ✗ VERSION=v0.2.1 GO=go1.16.3 make -j2 publish
15:54:54 [ .. ] Pushing package xpkg.upbound.io/jastang/provider-styra:v0.2.1
15:54:54 [ .. ] Skipping image publish for docker.io/provider-styra:v0.2.1
Publish is deferred to xpkg machinery
15:54:54 [ OK ] Image publish skipped for docker.io/provider-styra:v0.2.1
xpkg pushed to xpkg.upbound.io/jastang/provider-styra:v0.2.1
15:55:08 [ OK ] Pushed package xpkg.upbound.io/jastang/provider-styra:v0.2.1

Check

➜  provider-styra git:(jastang-bundled-packages-and-ci) crane manifest xpkg.upbound.io/jastang/provider-styra:v0.2.1 | jq .
{
  "schemaVersion": 2,
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1005,
      "digest": "sha256:0443b3d16c99fcb9b461c411281dd2278b6a7c57aae2ea46c0c4d3b685477ca5",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1005,
      "digest": "sha256:ee5c80b04f1cc797469e3c451abe520d7f81b52e72a9e5eecbbb0cc3c864a10d",
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    }
  ]
}

Signed-off-by: Jason Tang <jason@upbound.io>
@jastang
Copy link
Contributor Author

jastang commented Oct 4, 2022

TODO:

  • confirm dockerhub org crossplane-contrib is ready
  • configure the Actions secrets for Upbound before running CI

Signed-off-by: Jason Tang <jason@upbound.io>
Signed-off-by: Jason Tang <jason@upbound.io>
@jastang jastang marked this pull request as ready for review October 5, 2022 12:56
@@ -149,7 +149,7 @@ func generateDataSource(resp *models.DatasourcesV1DatasourcesGetResponseResult)
}

func generateDurationFromSeconds(seconds int64) *metav1.Duration {
d := (time.Duration)(seconds) * time.Second
d := (time.Duration)(seconds) * time.Second //nolint:durationcheck
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This appears to be a false positive

https://go.dev/play/p/ctZOpv8DYaV

Copy link
Member

@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.

Thanks @jastang! Secrets updated 👍🏻

@hasheddan
Copy link
Member

Signed-off-by: Jason Tang <jason@upbound.io>
@jastang
Copy link
Contributor Author

jastang commented Oct 5, 2022

thanks @hasheddan -- the workflow didn't trigger again, but not sure if it's related to the current Actions outage

@hasheddan
Copy link
Member

@jastang looks like it might be 👍🏻 I feel good about merging here, but let's wait until actions are back online so we can ensure publish works

@hasheddan hasheddan merged commit 93a166b into crossplane-contrib:main Oct 5, 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.

2 participants