generated from openmcp-project/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
OCM package build + publish + local tests #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hubert-Szczepanski-SAP
wants to merge
5
commits into
main
Choose a base branch
from
feat/adding-ocm-package-for-new-version-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e87e951
OCM package with local tests
Hubert-Szczepanski-SAP bd7439b
local descriptor fix
Hubert-Szczepanski-SAP 8232ef0
Merge branch 'main' into feat/adding-ocm-package-for-new-version-release
Hubert-Szczepanski-SAP a53fb56
fixing config for local docker and tags (was working only first time)
Hubert-Szczepanski-SAP 12a9a5d
Merge branch 'feat/adding-ocm-package-for-new-version-release' of htt…
Hubert-Szczepanski-SAP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,6 @@ public/frontend-config.json | |
|
||
# Sentry Config File | ||
.env.sentry-build-plugin | ||
|
||
# OCM build artifacts | ||
.ctf/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
version: "3" | ||
|
||
vars: | ||
# Variables for Docker image | ||
REGISTRY: ghcr.io/openmcp-project | ||
IMAGE_NAME: mcp-ui-frontend | ||
IMAGE_TAG: '{{.TAG | default "latest"}}' | ||
DOCKER_IMAGE: "{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}" | ||
|
||
# Variables for local testing | ||
LOCAL_REGISTRY: localhost:5000 | ||
LOCAL_IMAGE_NAME: mcp-ui-frontend | ||
LOCAL_DOCKER_IMAGE: "{{.LOCAL_REGISTRY}}/{{.LOCAL_IMAGE_NAME}}:{{.IMAGE_TAG}}" | ||
|
||
# Variables for OCM component | ||
OCM_COMPONENT_NAME: github.com/openmcp-project/ui | ||
OCM_COMPONENT_VERSION: '{{.OCM_COMPONENT_VERSION | default .IMAGE_TAG}}' | ||
OCM_PROVIDER: openmcp-project | ||
OCM_TARGET_REPO: '{{.OCM_TARGET_REPO | default (print .REGISTRY "/components") }}' | ||
OCM_OUTPUT_DIR: "{{.ROOT_DIR}}/.ctf" | ||
OCM_DESCRIPTOR: "{{.ROOT_DIR}}/ocm/component-descriptor.yaml" | ||
OCM_DESCRIPTOR_LOCAL: "{{.ROOT_DIR}}/ocm/component-descriptor-local.yaml" | ||
|
||
tasks: | ||
default: | ||
desc: Show available tasks | ||
cmds: | ||
- task --list | ||
|
||
build:ocm: | ||
desc: "Builds the ocm component. Usage: task build:ocm -- <version>" | ||
cmds: | ||
- rm -rf {{.OCM_OUTPUT_DIR}} | ||
- | | ||
ocm add components --create --force --copy-resources \ | ||
--complete \ | ||
--lookup {{.OCM_TARGET_REPO}} \ | ||
--file {{.OCM_OUTPUT_DIR}} \ | ||
{{.OCM_DESCRIPTOR}} -- \ | ||
VERSION={{.OCM_COMPONENT_VERSION}} \ | ||
COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \ | ||
PROVIDER={{.OCM_PROVIDER}} | ||
vars: | ||
OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}' | ||
|
||
publish:ocm: | ||
desc: "Publishes the ocm component to the registry." | ||
cmds: | ||
- | | ||
ocm transfer ctf \ | ||
--copy-resources \ | ||
--enforce --overwrite \ | ||
{{.OCM_OUTPUT_DIR}} {{.OCM_TARGET_REPO}} | ||
|
||
# Those tasks are only for local testing purposes | ||
|
||
test:inspect-ocm: | ||
desc: "Inspects the locally built OCM component. Usage: task test:inspect-ocm -- <version>" | ||
cmds: | ||
- echo "--- Component Details ---" | ||
- ocm get component -o yaml {{.OCM_COMPONENT_NAME}}:{{.OCM_COMPONENT_VERSION}} --repo {{.OCM_OUTPUT_DIR}} | ||
- echo "\n--- Component Resources ---" | ||
- ocm get resources -o wide {{.OCM_COMPONENT_NAME}}:{{.OCM_COMPONENT_VERSION}} --repo {{.OCM_OUTPUT_DIR}} | ||
vars: | ||
OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}' | ||
|
||
test:build-image: | ||
desc: "Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test" | ||
cmds: | ||
- docker build -t {{.DOCKER_IMAGE}} . | ||
|
||
test:publish-image: | ||
desc: "Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test" | ||
cmds: | ||
- docker push {{.DOCKER_IMAGE}} | ||
|
||
test:run: | ||
desc: "Runs the locally built image in a docker container. Usage: task test:run TAG=v-local-test" | ||
cmds: | ||
- docker run --rm -p 3000:3000 {{.DOCKER_IMAGE}} | ||
|
||
test:run-from-ocm: | ||
desc: "Extracts image reference from OCM component and runs it. Usage: task test:run-from-ocm -- <version>" | ||
cmds: | ||
- | | ||
IMAGE_REF=$(ocm get resources {{.OCM_COMPONENT_NAME}}:{{.OCM_COMPONENT_VERSION}} --repo {{.OCM_OUTPUT_DIR}} -o json | jq -r '.items[0].element.access.imageReference') | ||
echo "Running image from OCM component: $IMAGE_REF" | ||
docker run --rm -p 5173:5173 --env-file {{.ROOT_DIR}}/.env $IMAGE_REF | ||
vars: | ||
OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}' | ||
|
||
local:start-registry: | ||
desc: "Starts a local Docker registry on localhost:5000" | ||
cmds: | ||
- docker run -d -p 5000:5000 --name registry --rm registry:2 | ||
status: | ||
- docker ps | grep -q registry | ||
|
||
local:stop-registry: | ||
desc: "Stops the local Docker registry" | ||
cmds: | ||
- docker stop registry | ||
ignore_error: true | ||
|
||
local:build-and-push: | ||
desc: "Builds and pushes image to local registry. Usage: task local:build-and-push TAG=v0.0.1" | ||
cmds: | ||
- docker build -t localhost:5000/mcp-ui-frontend:{{.TAG}} . | ||
- docker push localhost:5000/mcp-ui-frontend:{{.TAG}} | ||
vars: | ||
TAG: '{{.TAG | default "latest"}}' | ||
|
||
local:build-ocm: | ||
desc: "Builds OCM component with local registry reference (uses --skip-digest-generation for local testing). Usage: task local:build-ocm -- <version>" | ||
cmds: | ||
- rm -rf {{.OCM_OUTPUT_DIR}} | ||
- | | ||
ocm add components --create --force --skip-digest-generation \ | ||
--file {{.OCM_OUTPUT_DIR}} \ | ||
{{.OCM_DESCRIPTOR_LOCAL}} -- \ | ||
VERSION={{.OCM_COMPONENT_VERSION}} \ | ||
COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \ | ||
PROVIDER={{.OCM_PROVIDER}} | ||
vars: | ||
OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}' | ||
|
||
# This is full workflow to create local registry, build, push, create OCM and run application locally. | ||
|
||
local:test-full-flow: | ||
desc: "Full local test: start registry, build, push, create OCM, run. Usage: task local:test-full-flow TAG=v0.0.1" | ||
cmds: | ||
- task: local:start-registry | ||
- task: local:build-and-push | ||
vars: | ||
TAG: "{{.TAG}}" | ||
- task: local:build-ocm | ||
vars: | ||
CLI_ARGS: "{{.TAG}}" | ||
- task: test:inspect-ocm | ||
vars: | ||
CLI_ARGS: "{{.TAG}}" | ||
- task: test:run-from-ocm | ||
vars: | ||
CLI_ARGS: "{{.TAG}}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: ${COMPONENT_NAME} | ||
version: ${VERSION} | ||
provider: | ||
name: ${PROVIDER} | ||
sources: [] | ||
componentReferences: [] | ||
resources: | ||
- name: mcp-ui-frontend-image | ||
type: ociImage | ||
version: ${VERSION} | ||
access: | ||
type: ociArtifact | ||
imageReference: localhost:5000/mcp-ui-frontend:${VERSION} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: ${COMPONENT_NAME} | ||
version: ${VERSION} | ||
provider: | ||
name: ${PROVIDER} | ||
sources: [] | ||
componentReferences: [] | ||
resources: | ||
- name: mcp-ui-frontend-image | ||
type: ociImage | ||
version: ${VERSION} | ||
access: | ||
type: ociArtifact | ||
imageReference: ghcr.io/openmcp-project/mcp-ui-frontend:${VERSION} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need this and installation below