From 252c0dcb0cde7144c1e9cf1b94f17aefe7cb205a Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:24:12 -0400 Subject: [PATCH 1/8] Update to Go 1.18 Updates to use Go 1.18 for provider-digitalocean. Signed-off-by: hasheddan --- go.mod | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- go.sum | 3 --- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index ecaa713..1a91d4d 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,14 @@ module github.com/crossplane-contrib/provider-digitalocean -go 1.16 +go 1.18 require ( - github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect github.com/crossplane/crossplane-runtime v0.15.1 github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e github.com/digitalocean/godo v1.77.0 github.com/golang/mock v1.5.0 github.com/google/go-cmp v0.5.6 - github.com/google/go-querystring v1.1.0 // indirect github.com/pkg/errors v0.9.1 - golang.org/x/net v0.0.0-20211020060615-d418f374d309 // indirect - golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect - google.golang.org/protobuf v1.27.1 // indirect gopkg.in/alecthomas/kingpin.v2 v2.2.6 k8s.io/api v0.22.2 k8s.io/apimachinery v0.22.2 @@ -21,4 +16,67 @@ require ( sigs.k8s.io/controller-tools v0.7.0 ) +require ( + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/dave/jennifer v1.4.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/evanphx/json-patch v4.11.0+incompatible // indirect + github.com/fatih/color v1.12.0 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-logr/logr v0.4.0 // indirect + github.com/go-logr/zapr v0.4.0 // indirect + github.com/gobuffalo/flect v0.2.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/googleapis/gnostic v0.5.5 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/mattn/go-colorable v0.1.8 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cobra v1.2.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.17.0 // indirect + golang.org/x/mod v0.4.2 // indirect + golang.org/x/net v0.0.0-20211020060615-d418f374d309 // indirect + golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect + golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect + golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect + golang.org/x/text v0.3.6 // indirect + golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + golang.org/x/tools v0.1.5 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.27.1 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + k8s.io/apiextensions-apiserver v0.22.2 // indirect + k8s.io/client-go v0.22.2 // indirect + k8s.io/component-base v0.22.2 // indirect + k8s.io/klog/v2 v2.9.0 // indirect + k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect + k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) + replace github.com/googleapis/gnostic v0.5.6 => github.com/google/gnostic v0.5.6 diff --git a/go.sum b/go.sum index 31a4073..738786f 100644 --- a/go.sum +++ b/go.sum @@ -98,7 +98,6 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -1134,7 +1133,6 @@ k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8 k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.4.0 h1:lCJCxf/LIowc2IGS9TPjWDyXY4nOmdGdfcwwDQCOURQ= k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= @@ -1166,7 +1164,6 @@ sigs.k8s.io/controller-tools v0.2.4/go.mod h1:m/ztfQNocGYBgTTCmFdnK94uVvgxeZeE3L sigs.k8s.io/controller-tools v0.7.0 h1:iZIz1vEcavyEfxjcTLs1WH/MPf4vhPCtTKhoHqV8/G0= sigs.k8s.io/controller-tools v0.7.0/go.mod h1:bpBAo0VcSDDLuWt47evLhMLPxRPxMDInTEH/YbdeMK0= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca h1:6dsH6AYQWbyZmtttJNe8Gq1cXOeS1BdV3eW37zHilAQ= sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= From d11f43eb74446af745c11610195955ab59d697b6 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:24:36 -0400 Subject: [PATCH 2/8] Update package crossplane.yaml with proper metadata Updates the crossplane.yaml content with proper metadata according to the Crossplane xpkg specification. Signed-off-by: hasheddan --- package/crossplane.yaml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/package/crossplane.yaml b/package/crossplane.yaml index 4727598..8a06051 100644 --- a/package/crossplane.yaml +++ b/package/crossplane.yaml @@ -3,27 +3,21 @@ kind: Provider metadata: name: provider-digitalocean annotations: - source: github.com/crossplane-contrib/provider-digitalocean - license: Apache-2.0 - descriptionShort: | - The DigitalOcean Crossplane provider enables infrastructure management - for DigitalOcean. - - description: | + meta.crossplane.io/source: github.com/crossplane-contrib/provider-digitalocean + meta.crossplane.io/license: Apache-2.0 + meta.crossplane.io/description: | The DigitalOcean Crossplane provider adds support for managing DigitalOcean resources in Kubernetes. - readme: | + meta.crossplane.io/readme: | `provider-digitalocean` is the Crossplane infrastructure provider for [DigitalOcean](https://www.digitalocean.com/). Available resources and their fields can be found in the [CRD - Docs](https://doc.crds.dev/github.com/crossplane-contrib/provider-digitalocean). + Docs](https://marketplace.upbound.io/digitalocean/provider-digitalocean/latest/crds). If you encounter an issue please reach out on [slack.crossplane.io](https://slack.crossplane.io) and create an issue in - the [crossplane-contrib/provider-digitalocean](https://github.com/crossplane-contrib/provider-digitalocean) + the + [crossplane-contrib/provider-digitalocean](https://github.com/crossplane-contrib/provider-digitalocean) repo. -spec: - controller: - image: crossplane/provider-digitalocean-controller:VERSION From 8b0c73320c477dfd351dc8903b8620dc9c147f37 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:25:20 -0400 Subject: [PATCH 3/8] Use copy instead of loop Fixes linter error by using built-in copy instead of loop. Signed-off-by: hasheddan --- pkg/clients/database/database.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/clients/database/database.go b/pkg/clients/database/database.go index 98c3c47..8d63959 100644 --- a/pkg/clients/database/database.go +++ b/pkg/clients/database/database.go @@ -41,8 +41,6 @@ func LateInitializeSpec(p *v1alpha1.DODatabaseClusterParameters, observed godo.D if len(p.Tags) == 0 && len(observed.Tags) != 0 { p.Tags = make([]string, len(observed.Tags)) - for i, tag := range observed.Tags { - p.Tags[i] = tag - } + copy(p.Tags, observed.Tags) } } From 9b25b95340767712d95d3bf2a205156c5e36ea1f Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:25:44 -0400 Subject: [PATCH 4/8] Update build submodule to pick up xpkg machinery Updates the build with latest xpkg building machinery. Signed-off-by: hasheddan --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 7be9f92..832bd82 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 7be9f92190191771dac2cc572d2bb399bc6f2adf +Subproject commit 832bd82745c83908a6eb2086d6726a7366108979 From 272817e60691f434beb0d3bf5d2e4fd218160174 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:29:23 -0400 Subject: [PATCH 5/8] Use single bundled xpkg for provider-digitalocean Combines controller and package into single image with annotated layers. Signed-off-by: hasheddan --- Makefile | 24 +++++++++++-- .../Dockerfile | 10 ------ .../provider-digitalocean-controller/Makefile | 35 ------------------- .../images/provider-digitalocean/Dockerfile | 11 ++++-- cluster/images/provider-digitalocean/Makefile | 10 +++--- 5 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 cluster/images/provider-digitalocean-controller/Dockerfile delete mode 100755 cluster/images/provider-digitalocean-controller/Makefile diff --git a/Makefile b/Makefile index 95d8b37..ba17194 100644 --- a/Makefile +++ b/Makefile @@ -41,15 +41,30 @@ GO111MODULE = on # ==================================================================================== # Setup Kubernetes tools +UP_VERSION = v0.13.0 +UP_CHANNEL = stable -include build/makelib/k8s_tools.mk # ==================================================================================== # Setup Images -REGISTRY_ORGS = docker.io/crossplane -IMAGES = provider-digitalocean provider-digitalocean-controller +IMAGES = provider-digitalocean -include build/makelib/imagelight.mk +# ==================================================================================== +# Setup XPKG + +XPKG_REG_ORGS ?= xpkg.upbound.io/digitalocean +# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are +# inferred. +XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/digitalocean +XPKGS = provider-digitalocean +-include build/makelib/xpkg.mk + +# NOTE(hasheddan): we force image building to happen prior to xpkg build so that +# we ensure image is present in daemon. +xpkg.build.provider-digitalocean: do.build.images + # ==================================================================================== # Targets @@ -107,6 +122,11 @@ submodules: go.cachedir: @go env GOCACHE +# NOTE(hasheddan): we must ensure up is installed in tool cache prior to build +# as including the k8s_tools machinery prior to the xpkg machinery sets UP to +# point to tool cache. +build.init: $(UP) + # This is for running out-of-cluster locally, and is for convenience. Running # this make target will print out the command which was used. For more control, # try running the binary directly with different arguments. diff --git a/cluster/images/provider-digitalocean-controller/Dockerfile b/cluster/images/provider-digitalocean-controller/Dockerfile deleted file mode 100644 index 0df592f..0000000 --- a/cluster/images/provider-digitalocean-controller/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM gcr.io/distroless/static@sha256:d2b0ec3141031720cf5eedef3493b8e129bc91935a43b50562fbe5429878d96b - -ARG TARGETOS -ARG TARGETARCH - -ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-digitalocean-provider - -EXPOSE 8080 -USER 65532 -ENTRYPOINT ["crossplane-digitalocean-provider"] diff --git a/cluster/images/provider-digitalocean-controller/Makefile b/cluster/images/provider-digitalocean-controller/Makefile deleted file mode 100755 index e7d6f43..0000000 --- a/cluster/images/provider-digitalocean-controller/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# ==================================================================================== -# Setup Project - -include ../../../build/makelib/common.mk - -# ==================================================================================== -# Options - -include ../../../build/makelib/imagelight.mk - -# ==================================================================================== -# Targets - -img.build: - @$(INFO) docker build $(IMAGE) - @$(MAKE) BUILD_ARGS="--load" img.build.shared - @$(OK) docker build $(IMAGE) - -img.publish: - @$(INFO) docker publish $(IMAGE) - @$(MAKE) BUILD_ARGS="--push" img.build.shared - @$(OK) docker publish $(IMAGE) - -img.build.shared: - @cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) - @cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL) - @docker buildx build $(BUILD_ARGS) \ - --platform $(IMAGE_PLATFORMS) \ - -t $(IMAGE) \ - $(IMAGE_TEMP_DIR) || $(FAIL) - -img.promote: - @$(INFO) docker promote $(FROM_IMAGE) to $(TO_IMAGE) - @docker buildx imagetools create -t $(TO_IMAGE) $(FROM_IMAGE) - @$(OK) docker promote $(FROM_IMAGE) to $(TO_IMAGE) \ No newline at end of file diff --git a/cluster/images/provider-digitalocean/Dockerfile b/cluster/images/provider-digitalocean/Dockerfile index 32fbfc0..0df592f 100644 --- a/cluster/images/provider-digitalocean/Dockerfile +++ b/cluster/images/provider-digitalocean/Dockerfile @@ -1,3 +1,10 @@ -FROM scratch +FROM gcr.io/distroless/static@sha256:d2b0ec3141031720cf5eedef3493b8e129bc91935a43b50562fbe5429878d96b -COPY package.yaml . +ARG TARGETOS +ARG TARGETARCH + +ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-digitalocean-provider + +EXPOSE 8080 +USER 65532 +ENTRYPOINT ["crossplane-digitalocean-provider"] diff --git a/cluster/images/provider-digitalocean/Makefile b/cluster/images/provider-digitalocean/Makefile index d57ce69..01eff6a 100755 --- a/cluster/images/provider-digitalocean/Makefile +++ b/cluster/images/provider-digitalocean/Makefile @@ -17,15 +17,13 @@ img.build: @$(OK) docker build $(IMAGE) img.publish: - @$(INFO) docker publish $(IMAGE) - @$(MAKE) BUILD_ARGS="--push" img.build.shared - @$(OK) docker publish $(IMAGE) + @$(INFO) Skipping image publish for $(IMAGE) + @echo Publish is deferred to xpkg machinery + @$(OK) Image publish skipped for $(IMAGE) img.build.shared: @cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) - @cp -R ../../../package $(IMAGE_TEMP_DIR) || $(FAIL) - @cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|VERSION|$(VERSION)|g' package/crossplane.yaml || $(FAIL) - @cd $(IMAGE_TEMP_DIR) && find package -type f -name '*.yaml' -exec cat {} >> 'package.yaml' \; -exec printf '\n---\n' \; || $(FAIL) + @cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL) @docker buildx build $(BUILD_ARGS) \ --platform $(IMAGE_PLATFORMS) \ -t $(IMAGE) \ From 8dccfc04308bad47a47044898a0f77d529c271b2 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:30:51 -0400 Subject: [PATCH 6/8] Cleanup github workflows with new machinery Updates github workflows to accommodate new artifact locations. Signed-off-by: hasheddan --- .github/workflows/ci.yml | 47 +++++++++++++--------------------- .github/workflows/promote.yml | 48 ----------------------------------- .github/workflows/tag.yml | 2 +- 3 files changed, 19 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/promote.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b88ab25..74cc28c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,19 +10,18 @@ on: env: # Common versions - GO_VERSION: '1.17' - GOLANGCI_VERSION: 'v1.45.2' - DOCKER_BUILDX_VERSION: 'v0.4.2' + GO_VERSION: '1.18' + GOLANGCI_VERSION: 'v1.47.1' + DOCKER_BUILDX_VERSION: 'v0.8.2' # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether # credentials have been provided before trying to run steps that need them. - DOCKER_USR: ${{ secrets.DOCKER_USR }} - AWS_USR: ${{ secrets.AWS_USR }} + XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }} jobs: detect-noop: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 outputs: noop: ${{ steps.noop.outputs.should_skip }} steps: @@ -36,7 +35,7 @@ jobs: lint: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' @@ -77,7 +76,7 @@ jobs: version: ${{ env.GOLANGCI_VERSION }} check-diff: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' @@ -117,7 +116,7 @@ jobs: run: make check-diff unit-tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' @@ -166,7 +165,7 @@ jobs: file: _output/tests/linux_amd64/coverage.txt e2e-tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' @@ -228,7 +227,7 @@ jobs: run: make e2e USE_HELM3=true publish-artifacts: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' @@ -290,28 +289,18 @@ jobs: with: name: output path: _output/** - - - name: Login to Docker + + - name: Login to Upbound uses: docker/login-action@v1 - if: env.DOCKER_USR != '' + if: env.XPKG_ACCESS_ID != '' with: - username: ${{ secrets.DOCKER_USR }} - password: ${{ secrets.DOCKER_PSW }} + registry: xpkg.upbound.io + username: ${{ secrets.XPKG_ACCESS_ID }} + password: ${{ secrets.XPKG_TOKEN }} - - name: Publish Artifacts to S3 and Docker Hub + - name: Publish Artifacts to Upbound run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} - if: env.AWS_USR != '' && env.DOCKER_USR != '' + if: env.CONTRIB_DOCKER_USR != '' env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Promote Artifacts in S3 and Docker Hub - if: github.ref == 'refs/heads/main' && env.AWS_USR != '' && env.DOCKER_USR != '' - run: make -j2 promote - env: - BRANCH_NAME: main - CHANNEL: main - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} \ No newline at end of file diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml deleted file mode 100644 index 18af02c..0000000 --- a/.github/workflows/promote.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Promote - -on: - workflow_dispatch: - inputs: - version: - description: 'Release version (e.g. v0.1.0)' - required: true - channel: - description: 'Release channel' - required: true - default: 'alpha' - -env: - # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run - # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether - # credentials have been provided before trying to run steps that need them. - DOCKER_USR: ${{ secrets.DOCKER_USR }} - AWS_USR: ${{ secrets.AWS_USR }} - -jobs: - promote-artifacts: - runs-on: ubuntu-18.04 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - - name: Fetch History - run: git fetch --prune --unshallow - - - name: Login to Docker - uses: docker/login-action@v1 - if: env.DOCKER_USR != '' - with: - username: ${{ secrets.DOCKER_USR }} - password: ${{ secrets.DOCKER_PSW }} - - - name: Promote Artifacts in S3 and Docker Hub - if: env.AWS_USR != '' && env.DOCKER_USR != '' - run: make -j2 promote BRANCH_NAME=${GITHUB_REF##*/} - env: - VERSION: ${{ github.event.inputs.version }} - CHANNEL: ${{ github.event.inputs.channel }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 3711e38..c3ce105 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -12,7 +12,7 @@ on: jobs: create-tag: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Checkout From a44bdab2a5a225479ca71a4835cdb07242afef11 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:39:15 -0400 Subject: [PATCH 7/8] Setup Go in the lint workflow The lint workflow now requires setting up Go 1.18 prior to caching the Go build cache. Signed-off-by: hasheddan --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74cc28c..208ff73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,11 @@ jobs: with: submodules: true + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: Find the Go Build Cache id: go run: echo "::set-output name=cache::$(make go.cachedir)" From 788577c76d2fd830fe2aa536ba95882d0045170b Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sun, 9 Oct 2022 15:58:34 -0400 Subject: [PATCH 8/8] Update e2e tests with new xpkg structure Updates e2e tests to accommodate the bundled xpkg format. Signed-off-by: hasheddan --- cluster/local/integration_tests.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cluster/local/integration_tests.sh b/cluster/local/integration_tests.sh index b7a05e2..9b1f58d 100755 --- a/cluster/local/integration_tests.sh +++ b/cluster/local/integration_tests.sh @@ -41,13 +41,10 @@ eval $(make --no-print-directory -C ${projectdir} build.vars) # ------------------------------ SAFEHOSTARCH="${SAFEHOSTARCH:-amd64}" -BUILD_IMAGE="${BUILD_REGISTRY}/${PROJECT_NAME}-${SAFEHOSTARCH}" -PACKAGE_IMAGE="crossplane.io/inttests/${PROJECT_NAME}:${VERSION}" -CONTROLLER_IMAGE="${BUILD_REGISTRY}/${PROJECT_NAME}-controller-${SAFEHOSTARCH}" +CONTROLLER_IMAGE="${BUILD_REGISTRY}/${PROJECT_NAME}-${SAFEHOSTARCH}" version_tag="$(cat ${projectdir}/_output/version)" # tag as latest version to load into kind cluster -PACKAGE_CONTROLLER_IMAGE="crossplane/${PROJECT_NAME}-controller:${VERSION}" K8S_CLUSTER="${K8S_CLUSTER:-${BUILD_REGISTRY}-inttests}" CROSSPLANE_NAMESPACE="crossplane-system" @@ -69,8 +66,7 @@ echo_step "setting up local package cache" CACHE_PATH="${projectdir}/.work/inttest-package-cache" mkdir -p "${CACHE_PATH}" echo "created cache dir at ${CACHE_PATH}" -docker tag "${BUILD_IMAGE}" "${PACKAGE_IMAGE}" -"${UP}" xpkg xp-extract --from-daemon "${PACKAGE_IMAGE}" -o "${CACHE_PATH}/${PACKAGE_NAME}.gz" && chmod 644 "${CACHE_PATH}/${PACKAGE_NAME}.gz" +"${UP}" alpha xpkg xp-extract --from-xpkg "${OUTPUT_DIR}"/xpkg/"${HOSTOS}"_"${SAFEHOSTARCH}"/"${PACKAGE_NAME}"-"${VERSION}".xpkg -o "${CACHE_PATH}/${PACKAGE_NAME}.gz" && chmod 644 "${CACHE_PATH}/${PACKAGE_NAME}.gz" # create kind cluster with extra mounts KIND_NODE_IMAGE="kindest/node:${KIND_NODE_IMAGE_TAG}" @@ -88,8 +84,8 @@ EOF echo "${KIND_CONFIG}" | "${KIND}" create cluster --name="${K8S_CLUSTER}" --wait=5m --image="${KIND_NODE_IMAGE}" --config=- # tag controller image and load it into kind cluster -docker tag "${CONTROLLER_IMAGE}" "${PACKAGE_CONTROLLER_IMAGE}" -"${KIND}" load docker-image "${PACKAGE_CONTROLLER_IMAGE}" --name="${K8S_CLUSTER}" +docker tag "${CONTROLLER_IMAGE}" "${PACKAGE_NAME}" +"${KIND}" load docker-image "${PACKAGE_NAME}" --name="${K8S_CLUSTER}" echo_step "create crossplane-system namespace" "${KUBECTL}" create ns crossplane-system