From 87b04b16cfb1968349e1511e4739b1b178f2f86c Mon Sep 17 00:00:00 2001 From: Roy Golan Date: Wed, 28 Feb 2024 22:14:38 +0200 Subject: [PATCH] WIP: swf-builder generate manifests using kn-workflow Generate manifests and save them in the runtime image. The manifests will be under /deployment/manifests directory and they can be extracted for example by echoing them from the image: podman run builder:latest cat /deployment/manifests/* > manifests-all.yaml or by podman cp: podman cp $(podman create builder:latest):/deployment/manifests . Signed-off-by: Roy Golan --- kogito-swf-builder-image.yaml | 1 + .../added/kn-workflow.sh | 2 ++ modules/kogito-workflow-manifests/install.sh | 35 +++++++++++++++++++ modules/kogito-workflow-manifests/module.yaml | 24 +++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 modules/kogito-workflow-manifests/added/kn-workflow.sh create mode 100644 modules/kogito-workflow-manifests/install.sh create mode 100644 modules/kogito-workflow-manifests/module.yaml diff --git a/kogito-swf-builder-image.yaml b/kogito-swf-builder-image.yaml index 5749630e2..fb61ddb84 100644 --- a/kogito-swf-builder-image.yaml +++ b/kogito-swf-builder-image.yaml @@ -68,6 +68,7 @@ - name: org.kie.kogito.project.versions - name: org.kie.kogito.swf.common.scripts - name: org.kie.kogito.swf.builder.runtime.community + - name: org.kie.kogito.workflow-manifests run: workdir: "/home/kogito/${PROJECT_ARTIFACT_ID}" diff --git a/modules/kogito-workflow-manifests/added/kn-workflow.sh b/modules/kogito-workflow-manifests/added/kn-workflow.sh new file mode 100644 index 000000000..bdb8d75b4 --- /dev/null +++ b/modules/kogito-workflow-manifests/added/kn-workflow.sh @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/modules/kogito-workflow-manifests/install.sh b/modules/kogito-workflow-manifests/install.sh new file mode 100644 index 000000000..0507003d6 --- /dev/null +++ b/modules/kogito-workflow-manifests/install.sh @@ -0,0 +1,35 @@ +#!/bin/sh -e +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +set -x + +MANIFESTS_SOURCE_DIR=/deployments +MANIFESTS_TARGET_DIR=/deployments + +mkdir -p "${KOGITO_HOME}"/generate +mkdir -p "${MANIFESTS_TARGET_DIR}" + +curl -L https://github.com/rgolangh/kie-tools/releases/download/0.0.2/kn-workflow-linux-amd64 -o "${KOGITO_HOME}"/generate/kn-workflow +chmod +x-w "${KOGITO_HOME}"/generate/kn-workflow + +cd "${MANIFESTS_SOURCE_DIR}" +"${KOGITO_HOME}"/generate/kn-workflow gen-manifest --custom-generated-manifests-dir="${MANIFESTS_TARGET_DIR}" + diff --git a/modules/kogito-workflow-manifests/module.yaml b/modules/kogito-workflow-manifests/module.yaml new file mode 100644 index 000000000..bc5abc845 --- /dev/null +++ b/modules/kogito-workflow-manifests/module.yaml @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +schema_version: 1 +name: org.kie.kogito.workflow-manifests +version: "999-SNAPSHOT" +description: Module to generate the workflow manifests +execute: + - script: install.sh