Skip to content

Commit

Permalink
Remove image from crossplane.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Kidswiss committed Aug 30, 2024
1 parent 188673c commit 3075f39
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
6 changes: 4 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"template": "https://github.com/vshn/appcat-cookiecutter",
"commit": "f3ff5b20dd78cac35e675813577638ce934a7c71",
"commit": "6a18e430833adf8e515c6050b3ff20268fc47d25",
"checkout": null,
"context": {
"cookiecutter": {
"app_name": "provider-cloudscale",
"component_repo": "vshn/component-appcat",
"provider": true,
"push_upbound": true,
"push_package": true,
"push_image": false,
"_copy_without_render": [
".github/workflows/cruft-update.yml",
".github/changelog-configuration.json"
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ on:
env:
APP_NAME: provider-cloudscale
COMPONENT_REPO: vshn/component-appcat
UPBOUND_PUSH: True
PUSH_UPBOUND: "True"
PUSH_PACKAGE: "True"
PUSH_IMAGE: "False"

jobs:
check-labels:
Expand Down Expand Up @@ -56,24 +58,25 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build branch and push AppCat
if: ${{ env.UPBOUND_PUSH }} == "False"
- name: Build branch and push image
if: env.PUSH_IMAGE == 'true'
run: make docker-push-branchtag -e IMG_TAG="${{ steps.extract_branch.outputs.branch }}"

- name: Build branch and push package
if: env.PUSH_PACKAGE == 'True'
run: make package-push-branchtag -e IMG_TAG="${{ steps.extract_branch.outputs.branch }}"

- name: Login to Upbound
if: ${{ env.UPBOUND_PUSH }} == "True"
uses: docker/login-action@v1
if: env.PUSH_UPBOUND == 'true'
uses: docker/login-action@v3
with:
registry: xpkg.upbound.io
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}

- name: Build branch and push package to upbound
if: ${{ env.UPBOUND_PUSH }} == "True"
run: make package-push-upbound-branchtag -e IMG_TAG="${{ steps.extract_branch.outputs.branch }}"
if: env.PUSH_UPBOUND == 'true' && env.PUSH_PACKAGE == 'true'
run: make package-push-branchtag -e IMG_TAG="${{ steps.extract_branch.outputs.branch }}" -e IMG_REPO=xpkg.upbound.io

open-pr-component:
if: github.event.action == 'opened'
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

env:
APP_NAME: provider-cloudscale
PUSH_UPBOUND: "True"
PUSH_PACKAGE: "True"
PUSH_IMAGE: "False"

jobs:
dist:
Expand Down Expand Up @@ -45,10 +48,24 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push docker image
if: env.PUSH_IMAGE == 'true'
run: make docker-push -e IMG_TAG=${GITHUB_REF##*/} -e APP_NAME=${{ env.APP_NAME }}

- name: Build and push function package
run: make package-push-branchtag -e IMG_TAG=${GITHUB_REF##*/} -e APP_NAME=${{ env.APP_NAME }}
if: env.PUSH_PACKAGE == 'true'
run: make package-push -e IMG_TAG=${GITHUB_REF##*/} -e APP_NAME=${{ env.APP_NAME }}

- name: Login to Upbound
if: env.PUSH_UPBOUND == 'true'
uses: docker/login-action@v1
with:
registry: xpkg.upbound.io
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}

- name: Build branch and push package to upbound
if: env.PUSH_UPBOUND == 'true' && env.PUSH_PACKAGE == 'true'
run: make package-push -e IMG_TAG=${GITHUB_REF##*/} -e APP_NAME=${{ env.APP_NAME }} -e IMG_REPO=xpkg.upbound.io

- name: Build changelog from PRs with labels
id: build_changelog
Expand Down
24 changes: 8 additions & 16 deletions ci.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
IMG_TAG ?= latest
APP_NAME ?= provider-cloudscale
ORG ?= vshn
GHCR_IMG ?= ghcr.io/$(ORG)/$(APP_NAME):$(IMG_TAG)
IMG_REPO ?= ghcr.io
IMG ?= $(IMG_REPO)/$(ORG)/$(APP_NAME):$(IMG_TAG)
DOCKER_CMD ?= docker

# Upbound push config
Expand All @@ -17,15 +18,15 @@ DOCKER_IMAGE_GOARCH = amd64
docker-build:
env CGO_ENABLED=0 GOOS=$(DOCKER_IMAGE_GOOS) GOARCH=$(DOCKER_IMAGE_GOARCH) \
go build -o ${BIN_FILENAME}
docker build --platform $(DOCKER_IMAGE_GOOS)/$(DOCKER_IMAGE_GOARCH) -t ${GHCR_IMG} .
docker build --platform $(DOCKER_IMAGE_GOOS)/$(DOCKER_IMAGE_GOARCH) -t ${IMG} .

.PHONY: docker-build-branchtag
IMG_TAG ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
docker-build-branchtag: docker-build ## Build docker image with current branch name

.PHONY: docker-push
docker-push: docker-build ## Push docker image with the manager.
docker push ${GHCR_IMG}
docker push ${IMG}

.PHONY: docker-push-branchtag
IMG_TAG ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
Expand All @@ -34,28 +35,19 @@ docker-push-branchtag: docker-build-branchtag docker-push ## Push docker image w
.PHONY: package-build
package-build: docker-build
rm -f package/*.xpkg
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg build -f package --verbose --embed-runtime-image=${GHCR_IMG} -o package/package.xpkg
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg build -f package --verbose --embed-runtime-image=${IMG} -o package/package.xpkg

.PHONY: package-push
package-push: package-build
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${GHCR_IMG} --verbose
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${IMG} --verbose

.PHONY: package-build-branchtag
IMG_TAG ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
package-build-branchtag: docker-build-branchtag
rm -f package/*.xpkg
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg build -f package --verbose --embed-runtime-image=${GHCR_IMG} -o package/package.xpkg
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg build -f package --verbose --embed-runtime-image=${IMG} -o package/package.xpkg

.PHONY: package-push-package-branchtag
IMG_TAG ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
package-push-branchtag: package-build-branchtag
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${GHCR_IMG} --verbose

.PHONY: package-push-upbound
package-push-upbound: package-build
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${GHCR_IMG} --verbose

.PHONY: package-push-upbound-branchtag
IMG_TAG ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
package-push-upbound-branchtag: package-build-branchtag
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${GHCR_IMG} --verbose
go run github.com/crossplane/crossplane/cmd/[email protected] xpkg push -f package/package.xpkg ${IMG} --verbose
2 changes: 1 addition & 1 deletion kind/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ kind-setup-ingress: kind-setup ## Install NGINX as ingress controller onto kind
kind-load-image: export GOOS = linux
kind-load-image: export GOARCH = amd64
kind-load-image: kind-setup build-docker ## Load the container image onto kind cluster
@$(kind_bin) load docker-image --name $(KIND_CLUSTER) $(CONTAINER_IMG)
@$(kind_bin) load docker-image --name $(KIND_CLUSTER) $(IMG)

.PHONY: kind-clean
kind-clean: export KUBECONFIG = $(KIND_KUBECONFIG)
Expand Down
2 changes: 0 additions & 2 deletions package/crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ metadata:
If you encounter an issue please create an issue in the
[vshn/provider-cloudscale](https://github.com/vshn/provider-cloudscale/issues) repo.
spec:
controller:
image: ghcr.io/vshn/provider-cloudscale/controller:latest
crossplane:
version: ">=v1.9.0"

0 comments on commit 3075f39

Please sign in to comment.