Skip to content
Open
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
16 changes: 16 additions & 0 deletions .github/workflows/on-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ jobs:
sbom: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }}

- name: Install OCM CLI
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this.

run: |
sudo curl -sL https://raw.githubusercontent.com/open-component-model/ocm/main/install.sh | sudo bash

- name: Install Go-Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build OCM component
run: task build:ocm -- ${{ github.event.inputs.nextVersion }}

- name: Publish OCM component
run: task publish:ocm

- name: Create Release with autogenerated release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ public/frontend-config.json

# Sentry Config File
.env.sentry-build-plugin

# OCM build artifacts
.ctf/
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN npm ci

# Build
ENV NODE_ENV=production
ENV NODE_OPTIONS=--max-old-space-size=4096
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it without not working? Why we need to change the Dockerfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not working for me when I was trying to deploy it locally

COPY . .
RUN npm run build

Expand Down
144 changes: 144 additions & 0 deletions Taskfile.yml
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
REGISTRY: ghcr.io/openmcp-project
REGISTRY: {{.REGISTRY | default (print "ghcr.io/openmcp-project") }}

Lets do it like this. So someone can override the registry locally if he/she wants to.

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}}"
Comment on lines +11 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOCAL_REGISTRY: localhost:5000
LOCAL_IMAGE_NAME: mcp-ui-frontend
LOCAL_DOCKER_IMAGE: "{{.LOCAL_REGISTRY}}/{{.LOCAL_IMAGE_NAME}}:{{.IMAGE_TAG}}"

You dont need to add a local registry & image for building the ocm component locally. You can just use the oci image from remote and build it locally with the remote image.


# 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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ocm add components --create --force --copy-resources \
ocm add components --create \

Also we dont need to copy the resource, the image is already pushed to the oci ghcr repo

--complete \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--complete \

We dont need the complete mark here.

--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 \
Comment on lines +51 to +52
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--copy-resources \
--enforce --overwrite \

No need for copy-resources, the image is already in ghcr. This would copy it again.
Would prefer not to use --enforce and --overwrite to not overwrite a component for now.

{{.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}}'
Comment on lines +57 to +90
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to call this not test: as this is more a reserved word for test runs.

Maybe lets call it build:image:local.
Would also rename test:run to run:image:local or similar.

We also don't need the action test:run-from-ocm.


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}}"
Comment on lines +92 to +144
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove this local registry part. We don't need this.

13 changes: 13 additions & 0 deletions ocm/component-descriptor-local.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for having a local and a remote descriptor. We just need one, the remote.

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}
13 changes: 13 additions & 0 deletions ocm/component-descriptor.yaml
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}
Loading