Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: make tidy
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x

- name: task generate
run: |
make tidy
task generate
git diff --exit-code

- name: make verify
run: make verify
- name: task validate
run: task validate

- name: make test
run: make test
- name: task test
run: task test
30 changes: 13 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
ssh-key: ${{ secrets.PUSH_KEY }}
fetch-tags: true
fetch-depth: 0
submodules: recursive

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x

- name: Read and validate VERSION
id: version
run: |
VERSION=$(cat VERSION)
VERSION=$(task version)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then
echo "Invalid version format in VERSION file: $VERSION"
exit 1
Expand Down Expand Up @@ -68,24 +74,14 @@ jobs:
with:
go-version-file: go.mod

- name: Build the ${{ github.repository }}
- name: Build and Push Images
run: |
make prepare-release
make build

- name: Build Images
run: |
IMAGE_REGISTRY=ghcr.io/openmcp-project make image-build

- name: setup OCM
uses: open-component-model/ocm-setup-action@main
task build:img:all

- name: Create OCM CTF
- name: Package and Push Helm Charts
run: |
ocm add componentversions --create \
--file ctf component-constructor.yaml \
--settings settings.yaml -- VERSION=${{ env.version }}
task build:helm:all

- name: Push CTF
- name: Build and Push OCM Component
run: |
ocm transfer ctf --overwrite ./ctf ${{ env.OCI_URL }}
task build:ocm:all
26 changes: 24 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ jobs:
ssh-key: ${{ secrets.PUSH_KEY }}
fetch-tags: true
fetch-depth: 0
submodules: recursive

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x

- name: Read and validate VERSION
id: version
run: |
VERSION=$(cat VERSION)
VERSION=$(task version)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then
echo "Invalid version format in VERSION file: $VERSION"
exit 1
Expand Down Expand Up @@ -64,6 +70,22 @@ jobs:
git tag -a "${{ env.version }}" -m "Release ${{ env.version }}"
git push origin "${{ env.version }}"

- name: Create Git tag for api submodule
if: ${{ env.SKIP != 'true' }}
run: |
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"

echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV

git config user.name "$AUTHOR_NAME"
git config user.email "$AUTHOR_EMAIL"

git tag -a "api/${{ env.version }}" -m "Release ${{ env.version }}"
git push origin "api/${{ env.version }}"

- name: Create GitHub release
if: ${{ env.SKIP != 'true' }}
uses: softprops/action-gh-release@v2
Expand All @@ -79,7 +101,7 @@ jobs:
- name: Push dev VERSION
if: ${{ env.SKIP != 'true' }}
run: |
echo "${{ env.version }}-dev" > VERSION
task release:set-version -- "${{ env.version }}-dev"
git config user.name "${{ env.AUTHOR_NAME }}"
git config user.email "${{ env.AUTHOR_EMAIL }}"
git add VERSION
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ components/
/**/cover.*.html

*.tmp
.task/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "hack/common"]
path = hack/common
url = https://github.com/openmcp-project/build
165 changes: 0 additions & 165 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions Makefile
71 changes: 71 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: 3

# vars: # cannot be specified here due to https://github.com/go-task/task/issues/2108
# NESTED_MODULES: api
# API_DIRS: '{{.ROOT_DIR}}/api/core/v1alpha1/...'
# MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
# CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/constants/... {{.ROOT_DIR}}/api/errors/... {{.ROOT_DIR}}/api/install/... {{.ROOT_DIR}}/api/v1alpha1/... {{.ROOT_DIR}}/api/core/v1alpha1/...'
# COMPONENTS: 'mcp-operator'
# REPO_URL: 'https://github.com/openmcp-project/mcp-operator'
# GENERATE_DOCS_INDEX: "true"

includes:
shared:
taskfile: hack/common/Taskfile_controller.yaml
flatten: true
excludes: # put task names in here which are overwritten in this file
- generate:code
- validate:test
vars:
NESTED_MODULES: api
API_DIRS: '{{.ROOT_DIR}}/api/core/v1alpha1/...'
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/constants/... {{.ROOT_DIR}}/api/errors/... {{.ROOT_DIR}}/api/install/... {{.ROOT_DIR}}/api/v1alpha1/... {{.ROOT_DIR}}/api/core/v1alpha1/...'
COMPONENTS: 'mcp-operator'
REPO_URL: 'https://github.com/openmcp-project/mcp-operator'
GENERATE_DOCS_INDEX: "true"
common: # imported a second time so that overwriting task definitions can call the overwritten task with a 'c:' prefix
taskfile: hack/common/Taskfile_controller.yaml
internal: true
aliases:
- c
vars:
NESTED_MODULES: api
API_DIRS: '{{.ROOT_DIR}}/api/core/v1alpha1/...'
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/constants/... {{.ROOT_DIR}}/api/errors/... {{.ROOT_DIR}}/api/install/... {{.ROOT_DIR}}/api/v1alpha1/... {{.ROOT_DIR}}/api/core/v1alpha1/...'
COMPONENTS: 'mcp-operator'
REPO_URL: 'https://github.com/openmcp-project/mcp-operator'
GENERATE_DOCS_INDEX: "true"

tasks:
generate:code: # overwrites shared code task to add external API fetching
desc: " Generate code (mainly DeepCopy functions) and fetches external APIs."
aliases:
- gen:code
- g:code
run: once
cmds:
- task: external-apis
- task: c:generate:code

external-apis:
desc: " Fetch external APIs."
run: once
method: checksum
sources:
- hack/external-apis/*
cmds:
- 'go run {{.ROOT_DIR}}/hack/external-apis/main.go'
internal: true

validate:test: # overwrites the test task to add a dependency towards envtest
desc: " Run all tests."
aliases:
- val:test
- v:test
run: once
deps:
- tools:envtest
cmds:
- task: c:validate:test
4 changes: 1 addition & 3 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/openmcp-project/mcp-operator/api

go 1.23.0

toolchain go1.23.6
go 1.23.5

require (
github.com/onsi/ginkgo/v2 v2.22.2
Expand Down
Loading