diff --git a/.github/workflows/build-korifi.yml b/.github/workflows/build-korifi.yml index da331c9..80a78d7 100644 --- a/.github/workflows/build-korifi.yml +++ b/.github/workflows/build-korifi.yml @@ -47,12 +47,5 @@ jobs: run: | ../scripts/create-korifi-release.sh ${{ env.V_KORIFI }} - - name: Copy korifi artifacts - shell: bash - run: | - mkdir -p ./module-data/korifi-build - cp .korifi/release-${{ env.V_KORIFI }}/values.yaml ./module-data/korifi-build/values-${{ env.V_KORIFI }}.yaml - cp .korifi/release-${{ env.V_KORIFI }}/korifi-helm.tar.gz ./module-data/korifi-build/korifi-helm-${{ env.V_KORIFI }}.tar.gz - diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml new file mode 100644 index 0000000..d0df8cf --- /dev/null +++ b/.github/workflows/release-draft.yml @@ -0,0 +1,86 @@ +name: Release Draft Workflow + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +env: + V_KORIFI: '0.11.2' + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: [ self-hosted ] + + permissions: + contents: write + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Checkout Korifi-Trinity + uses: actions/checkout@v3 + with: + repository: unified-runtime/korifi-trinity + ref: v${{ env.V_KORIFI }} + github-server-url: 'https://github.tools.sap' + token: ${{ secrets.KORIFI_TRINITY_TOKEN }} + path: '.korifi' + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create korifi release artifacts + env: + VERSION: ${{ env.V_KORIFI }} + DOCKER_REGISTRY: ${{ env.REGISTRY }} + DOCKER_REGISTRY_USER: ${{ github.actor }} + DOCKER_REGISTRY_PASS: ${{ secrets.GITHUB_TOKEN }} + shell: bash + working-directory: '.korifi' + run: | + ../scripts/create-korifi-release.sh ${{ env.V_KORIFI }} + + - name: set version + run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + id: version + + - name: docker build + run: VERSION=${{ steps.version.outputs.version }} make docker-build + + - name: docker-push + run: VERSION=${{ steps.version.outputs.version }} make docker-push + + - name: prepare release artifacts + run: VERSION=${{ steps.version.outputs.version }} make release + + - name: Create draft release + env: + VERSION: ${{ steps.version.outputs.version }} + GITHUB_TOKEN: ${{ github.token }} + shell: bash + run: | + gh release create "${VERSION}" --draft --notes-file RELEASE.md + + - name: Upload release artifacts + env: + VERSION: ${{ steps.version.outputs.version }} + GITHUB_TOKEN: ${{ github.token }} + shell: bash + run: | + gh release upload "${VERSION}" "./release-${VERSION}/cfapi-default-cr.yaml" + gh release upload "${VERSION}" "./release-${VERSION}/cfapi-crd.yaml" + gh release upload "${VERSION}" "./release-${VERSION}/cfapi-manager.yaml" + + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dc3899..d015c04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,10 @@ name: Release Workflow on: - push: - tags: - - 'v*' workflow_dispatch: env: + V_KORIFI: '0.11.2' REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} @@ -24,6 +22,15 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Checkout Korifi-Trinity + uses: actions/checkout@v3 + with: + repository: unified-runtime/korifi-trinity + ref: v${{ env.V_KORIFI }} + github-server-url: 'https://github.tools.sap' + token: ${{ secrets.KORIFI_TRINITY_TOKEN }} + path: '.korifi' + - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: diff --git a/Dockerfile b/Dockerfile index 5c81680..e567afe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM golang:1.22.1-alpine as builder ARG TARGETOS ARG TARGETARCH +ARG V_KORIFI="0.11.2" WORKDIR /workspace # Copy the Go Modules manifests @@ -50,12 +51,9 @@ RUN curl -OLf https://github.com/cert-manager/cert-manager/releases/download/v$V WORKDIR /workspace/module-data/gateway-api RUN curl -OLf https://github.com/kubernetes-sigs/gateway-api/releases/download/v$VERSION_GATEWAY_API/experimental-install.yaml -WORKDIR /workspace/module-data/twuni-helm -RUN curl -OLf https://github.com/twuni/docker-registry.helm/archive/refs/tags/v$VERSION_TWUNI.tar.gz - -#Some day we are going to use the OSS Korifi project -#WORKDIR /workspace/module-data/korifi -#RUN curl -OLf https://github.com/cloudfoundry/korifi/releases/download/v$VERSION_KORIFI/korifi-$VERSION_KORIFI.tgz +WORKDIR /workspace/module-data/korifi +COPY .korifi/release-${V_KORIFI}/values.yaml values-${V_KORIFI}.yaml +COPY .korifi/release-${V_KORIFI}/korifi-helm.tar.gz korifi-helm-${V_KORIFI}.tar.gz # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Makefile b/Makefile index 328657e..5253482 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ VERSION ?= 0.0.0 #IMG ?= trinity.common.repositories.cloud.sap/kyma-module/cfapi-controller-$(VERSION) REGISTRY = ghcr.io IMG ?= kyma-project/cfapi/cfapi-controller +V_KORIFI ?= 0.11.2 # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.24.1 @@ -82,7 +83,7 @@ run: manifests generate fmt vet ## Run a controller from your host. .PHONY: docker-build docker-build: ## Build docker image with the manager. - docker build -t ${REGISTRY}/${IMG} --build-arg TARGETARCH=amd64 . + docker build -t ${REGISTRY}/${IMG} --build-arg TARGETARCH=amd64 --build-arg V_KORIFI=${V_KORIFI} . docker tag ${REGISTRY}/${IMG} ${VERSION} .PHONY: docker-push diff --git a/module-data/korifi/korifi-helm-0.11.2.tar.gz b/module-data/korifi/korifi-helm-0.11.2.tar.gz deleted file mode 100644 index a63fa99..0000000 Binary files a/module-data/korifi/korifi-helm-0.11.2.tar.gz and /dev/null differ diff --git a/module-data/korifi/values-0.11.2.yaml b/module-data/korifi/values-0.11.2.yaml deleted file mode 100644 index cbde8c5..0000000 --- a/module-data/korifi/values-0.11.2.yaml +++ /dev/null @@ -1,122 +0,0 @@ ---- -adminUserName: null -api: - apiServer: - internalPort: 9000 - port: 0 - timeouts: - idle: 900 - read: 900 - readHeader: 10 - write: 900 - url: "" - authProxy: - caCert: "" - host: "" - image: ghcr.io/kyma-project/cfapi/korifi-api-0.0.0@sha256:34311f2f3685fe7ef06c2f35d6e9801635f00f8dab2971fc519e75e1125ab2e7 - include: true - infoConfig: - custom: {} - description: Korifi Cloud Foundry Environment - minCLIVersion: "" - name: korifi - recommendedCLIVersion: "" - supportAddress: https://www.cloudfoundry.org/technology/korifi/ - lifecycle: - stack: cflinuxfs3 - type: buildpack - logcache: - url: "" - nodeSelector: {} - replicas: 1 - resources: - limits: - cpu: 1000m - memory: 1Gi - requests: - cpu: 50m - memory: 100Mi - tolerations: [] - uaaURL: "" - userCertificateExpirationWarningDuration: 168h -containerRegistryCACertSecret: null -containerRegistrySecrets: - - image-registry-credentials -controllers: - extraVCAPApplicationValues: {} - image: ghcr.io/kyma-project/cfapi/korifi-controllers-0.0.0@sha256:ce7c511ccbce675f5954d1ecd99bc960a710dd8f79fc9f3ff5bc40804523c0b1 - maxRetainedBuildsPerApp: 5 - maxRetainedPackagesPerApp: 5 - namespaceLabels: {} - nodeSelector: {} - processDefaults: - diskQuotaMB: 1024 - memoryMB: 1024 - replicas: 1 - resources: - limits: - cpu: 1000m - memory: 1Gi - requests: - cpu: 50m - memory: 100Mi - taskTTL: 30d - tolerations: [] - workloadsTLSSecret: korifi-workloads-ingress-cert -debug: false -defaultAppDomainName: null -eksContainerRegistryRoleARN: "" -generateIngressCertificates: false -helm: - hooksImage: alpine/k8s:1.25.2 -jobTaskRunner: - include: true - jobTTL: 24h - replicas: 1 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - temporarySetPodSeccompProfile: false -kpackImageBuilder: - builderReadinessTimeout: 30s - builderRepository: "" - clusterBuilderName: "" - clusterStackBuildImage: paketobuildpacks/build-jammy-full - clusterStackID: io.buildpacks.stacks.jammy - clusterStackRunImage: paketobuildpacks/run-jammy-full - include: true - replicas: 1 - resources: - limits: - cpu: 1000m - memory: 1Gi - requests: - cpu: 50m - memory: 100Mi -logLevel: info -networking: - gatewayClass: null -reconcilers: - build: kpack-image-builder - run: statefulset-runner -rootNamespace: cf -stagingRequirements: - buildCacheMB: 2048 - diskMB: 0 - memoryMB: 0 -statefulsetRunner: - include: true - replicas: 1 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - temporarySetPodSeccompProfile: false -systemImagePullSecrets: []