From 60baa9eac63e3a44cec9f0c4b419b30b510b1af9 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Mon, 20 Nov 2023 14:13:42 -0500 Subject: [PATCH 1/6] add setenv script Signed-off-by: Jordan Dubrick --- setenv.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 setenv.sh diff --git a/setenv.sh b/setenv.sh new file mode 100644 index 000000000..919436b89 --- /dev/null +++ b/setenv.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# Copyright Red Hat +# +# Licensed 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. + +# This script aliases the docker cli if the environment variable USE_PODMAN is set to true. + +# default value is false if USE_PODMAN is unset or null +podman=${USE_PODMAN:-false} +if [ ${podman} == true ]; then + alias docker=podman + echo "setting alias docker=podman" +fi \ No newline at end of file From 1e6193212c91bc17ba8fee8179e6fa0618e8edf4 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Mon, 20 Nov 2023 15:27:08 -0500 Subject: [PATCH 2/6] update run script to include podman capabilities Signed-off-by: Jordan Dubrick --- docker-run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-run.sh b/docker-run.sh index 9485421d1..9cc72b2ee 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -15,6 +15,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Allow setting of podman environment var in the script runtime +shopt -s expand_aliases +set -eux # git ROOT directory used to mount filesystem GIT_ROOT_DIRECTORY=$(git rev-parse --show-toplevel) @@ -23,6 +26,9 @@ WORKDIR="/projects/src/${GO_MODULE}" # Container image IMAGE_NAME="quay.io/devfile/kubernetes-api-build-prerequisites:latest" +# Run script to set env var for podman if necessary +. ./setenv.sh + init() { BLUE='\033[1;34m' GREEN='\033[0;32m' From 38705865042410f3d1a99506fcdffbbd094e797b Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Mon, 20 Nov 2023 15:36:09 -0500 Subject: [PATCH 3/6] update documentation to reflect podman implementation Signed-off-by: Jordan Dubrick --- CONTRIBUTING.md | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 02ee6799e..cc34424e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,8 @@ Before contributing to this repository for the first time, please review our pro ### Building -To build the CRD and the various schemas, you don't need to install any pre-requisite apart from `docker`. -In the root directory, just run the following command: +To build the CRD and the various schemas, you don't need to install any pre-requisite apart from `docker` or `podman`. +In the root directory, if you are using `podman` first run `export USE_PODMAN=true`. Then for either `docker` or `podman` run the following command: ```console bash ./docker-run.sh ./build.sh diff --git a/README.md b/README.md index 7b79caf2f..d9b18cba3 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ Release details and process are found in [Devfile Release](RELEASE.md) ## How to build -In order to build the CRD and the various schemas, you don't need to install any pre-requisite apart from `docker`. -In the root directory, just run the following command: +To build the CRD and the various schemas, you don't need to install any pre-requisite apart from `docker` or `podman`. +In the root directory, if you are using `podman` first run `export USE_PODMAN=true`. Then for either `docker` or `podman` run the following command: ```console bash ./docker-run.sh ./build.sh From cce5fe42a8a98f0462ce4b326b847be4a27ea95c Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Tue, 21 Nov 2023 10:51:34 -0500 Subject: [PATCH 4/6] update documentation to remove duplicate entries Signed-off-by: Jordan Dubrick --- CONTRIBUTING.md | 9 +++++++++ README.md | 18 +++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cc34424e9..623a2fe8c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,15 @@ In the root directory, if you are using `podman` first run `export USE_PODMAN=tr bash ./docker-run.sh ./build.sh ``` +### Typescript model + +Typescript model is generated based on JSON Schema with help of . +To generate them locally run: + +```console +bash ./build/typescript-model/generate.sh +``` + ### Testing Find more information about tests in the [testing document](test/README.md). diff --git a/README.md b/README.md index d9b18cba3..4809b19b2 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Sources for this API are defined in Go code, starting from the [devworkspace_types.go source file](pkg/apis/workspaces/v1alpha2/devworkspace_types.go) From these Go sources, several files are generated: + - A Kubernetes Custom Resource Definition(CRD) with an embedded OpenApi schema, - json schemas (in the [schemas](schemas) folder) generated from the above CRD, to specify the syntax of: - the DevWorkspace CRD itself; @@ -34,21 +35,7 @@ Release details and process are found in [Devfile Release](RELEASE.md) ## How to build -To build the CRD and the various schemas, you don't need to install any pre-requisite apart from `docker` or `podman`. -In the root directory, if you are using `podman` first run `export USE_PODMAN=true`. Then for either `docker` or `podman` run the following command: - -```console -bash ./docker-run.sh ./build.sh -``` - -### Typescript model - -Typescript model is generated based on JSON Schema with help of . -To generate them locally run: - -```console -bash ./build/typescript-model/generate.sh -``` +For information about building this project visit [CONTRIBUTING.md](./CONTRIBUTING.md). ## Specification status @@ -61,6 +48,7 @@ In order to test existing or new Devfile 2.0 or DevWorkspace sample files in a s [![Contribute](https://img.shields.io/badge/developer-workspace-525C86?logo=eclipse-che&labelColor=FDB940)](https://workspaces.openshift.com/f?url=https://github.com/devfile/api) As soon as the devworkspace is opened, you should be able to: + - open the `yaml` files in the following folders: - `samples/` - `devfile-support/samples` From f2d6c951e90c8d68709690498b067f8714945726 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Wed, 22 Nov 2023 14:08:35 -0500 Subject: [PATCH 5/6] add inline setting of alias to remove need for additional script Signed-off-by: Jordan Dubrick --- README.md | 2 +- docker-run.sh | 7 +++++-- setenv.sh | 25 ------------------------- 3 files changed, 6 insertions(+), 28 deletions(-) delete mode 100644 setenv.sh diff --git a/README.md b/README.md index 4809b19b2..ced708f2b 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Release details and process are found in [Devfile Release](RELEASE.md) ## How to build -For information about building this project visit [CONTRIBUTING.md](./CONTRIBUTING.md). +For information about building this project visit [CONTRIBUTING.md](./CONTRIBUTING.md#building). ## Specification status diff --git a/docker-run.sh b/docker-run.sh index 9cc72b2ee..bc992b9f9 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -26,8 +26,11 @@ WORKDIR="/projects/src/${GO_MODULE}" # Container image IMAGE_NAME="quay.io/devfile/kubernetes-api-build-prerequisites:latest" -# Run script to set env var for podman if necessary -. ./setenv.sh +# For users who want to use podman this enables the alias to work throughout the scripts runtime +if [[ ${USE_PODMAN} == true ]]; then + alias docker=podman + echo "using podman as container engine" +fi init() { BLUE='\033[1;34m' diff --git a/setenv.sh b/setenv.sh deleted file mode 100644 index 919436b89..000000000 --- a/setenv.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# -# Copyright Red Hat -# -# Licensed 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. - -# This script aliases the docker cli if the environment variable USE_PODMAN is set to true. - -# default value is false if USE_PODMAN is unset or null -podman=${USE_PODMAN:-false} -if [ ${podman} == true ]; then - alias docker=podman - echo "setting alias docker=podman" -fi \ No newline at end of file From d086125d98d3e62bf6f097d441dbd632d6a4e7ce Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Wed, 22 Nov 2023 14:33:40 -0500 Subject: [PATCH 6/6] fix unset variable Signed-off-by: Jordan Dubrick --- docker-run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-run.sh b/docker-run.sh index bc992b9f9..820380a9f 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -27,6 +27,7 @@ WORKDIR="/projects/src/${GO_MODULE}" IMAGE_NAME="quay.io/devfile/kubernetes-api-build-prerequisites:latest" # For users who want to use podman this enables the alias to work throughout the scripts runtime +USE_PODMAN=${USE_PODMAN:-false} if [[ ${USE_PODMAN} == true ]]; then alias docker=podman echo "using podman as container engine"