Skip to content

Commit

Permalink
Merge pull request #42 from kyma-project/wf/release
Browse files Browse the repository at this point in the history
korifi build from git
  • Loading branch information
szeort authored Aug 14, 2024
2 parents 3375bb6 + af52976 commit c02f31b
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 139 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/build-korifi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

86 changes: 86 additions & 0 deletions .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
@@ -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"

13 changes: 10 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}

Expand All @@ -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:
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file removed module-data/korifi/korifi-helm-0.11.2.tar.gz
Binary file not shown.
122 changes: 0 additions & 122 deletions module-data/korifi/values-0.11.2.yaml

This file was deleted.

0 comments on commit c02f31b

Please sign in to comment.