From 4345ec46baa45c6a26682df43ebd426e90a057f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miles=20St=C3=B6tzner?= Date: Wed, 25 Sep 2024 17:02:47 +0200 Subject: [PATCH 1/2] fix night workflow: upgrade openstacksdk at xopera (#420) --- .github/actions/vintner-resolve/action.yaml | 3 -- .../case-study-unfurl-technology.yaml | 3 ++ .github/workflows/night.yaml | 13 +++---- examples/unfurl-artifacts/scripts/deploy.sh | 2 +- examples/unfurl-artifacts/scripts/undeploy.sh | 0 .../unfurl-aware/scripts/configuration.env | 2 +- examples/unfurl-aware/scripts/setup.sh | 2 +- .../lib/openstack/vm/playbooks/create.yaml | 6 ++-- examples/xopera-motivation/scripts/clean.sh | 11 ++++++ examples/xopera-motivation/scripts/code.sh | 11 ++++++ .../scripts/configuration.env | 5 +++ .../scripts/configuration.sh | 36 +++++++++++++++++++ .../xopera-motivation/scripts/continue.sh | 11 ++++++ .../xopera-motivation/scripts/demo-prod.sh | 12 ------- examples/xopera-motivation/scripts/demo.sh | 17 --------- examples/xopera-motivation/scripts/deploy.sh | 15 ++++++++ examples/xopera-motivation/scripts/enrich.sh | 8 +++++ examples/xopera-motivation/scripts/pull.sh | 9 +++++ examples/xopera-motivation/scripts/quality.sh | 13 +++++++ .../xopera-motivation/scripts/reimport.sh | 20 +++++++++++ examples/xopera-motivation/scripts/setup.sh | 14 ++++++++ .../xopera-motivation/scripts/swap-lib.sh | 16 +++++++++ .../xopera-motivation/scripts/undeploy.sh | 11 ++++++ .../scripts/configuration.env | 2 +- .../scripts/setup.sh | 2 +- examples/xopera-pruning/scripts/clean.sh | 11 ++++++ examples/xopera-pruning/scripts/code.sh | 11 ++++++ .../xopera-pruning/scripts/configuration.env | 5 +++ .../xopera-pruning/scripts/configuration.sh | 36 +++++++++++++++++++ examples/xopera-pruning/scripts/continue.sh | 11 ++++++ examples/xopera-pruning/scripts/deploy.sh | 15 ++++++++ examples/xopera-pruning/scripts/enrich.sh | 8 +++++ examples/xopera-pruning/scripts/pull.sh | 9 +++++ examples/xopera-pruning/scripts/quality.sh | 13 +++++++ examples/xopera-pruning/scripts/reimport.sh | 20 +++++++++++ examples/xopera-pruning/scripts/setup.sh | 14 ++++++++ examples/xopera-pruning/scripts/swap-lib.sh | 16 +++++++++ examples/xopera-pruning/scripts/undeploy.sh | 11 ++++++ src/assets/scripts/install-xopera.sh | 3 +- tests/utils.ts | 2 +- 40 files changed, 378 insertions(+), 51 deletions(-) mode change 100644 => 100755 examples/unfurl-artifacts/scripts/undeploy.sh create mode 100755 examples/xopera-motivation/scripts/clean.sh create mode 100755 examples/xopera-motivation/scripts/code.sh create mode 100644 examples/xopera-motivation/scripts/configuration.env create mode 100755 examples/xopera-motivation/scripts/configuration.sh create mode 100755 examples/xopera-motivation/scripts/continue.sh delete mode 100644 examples/xopera-motivation/scripts/demo-prod.sh delete mode 100644 examples/xopera-motivation/scripts/demo.sh create mode 100755 examples/xopera-motivation/scripts/deploy.sh create mode 100755 examples/xopera-motivation/scripts/enrich.sh create mode 100755 examples/xopera-motivation/scripts/pull.sh create mode 100755 examples/xopera-motivation/scripts/quality.sh create mode 100755 examples/xopera-motivation/scripts/reimport.sh create mode 100755 examples/xopera-motivation/scripts/setup.sh create mode 100755 examples/xopera-motivation/scripts/swap-lib.sh create mode 100755 examples/xopera-motivation/scripts/undeploy.sh create mode 100755 examples/xopera-pruning/scripts/clean.sh create mode 100755 examples/xopera-pruning/scripts/code.sh create mode 100644 examples/xopera-pruning/scripts/configuration.env create mode 100755 examples/xopera-pruning/scripts/configuration.sh create mode 100755 examples/xopera-pruning/scripts/continue.sh create mode 100755 examples/xopera-pruning/scripts/deploy.sh create mode 100755 examples/xopera-pruning/scripts/enrich.sh create mode 100755 examples/xopera-pruning/scripts/pull.sh create mode 100755 examples/xopera-pruning/scripts/quality.sh create mode 100755 examples/xopera-pruning/scripts/reimport.sh create mode 100755 examples/xopera-pruning/scripts/setup.sh create mode 100755 examples/xopera-pruning/scripts/swap-lib.sh create mode 100755 examples/xopera-pruning/scripts/undeploy.sh diff --git a/.github/actions/vintner-resolve/action.yaml b/.github/actions/vintner-resolve/action.yaml index 1736b132ab..1c77fa3652 100644 --- a/.github/actions/vintner-resolve/action.yaml +++ b/.github/actions/vintner-resolve/action.yaml @@ -6,9 +6,6 @@ inputs: preset: required: false - orchestrator: - required: true - runs: using: 'composite' steps: diff --git a/.github/workflows/case-study-unfurl-technology.yaml b/.github/workflows/case-study-unfurl-technology.yaml index 1cb6e3d1d4..e3de1442f7 100644 --- a/.github/workflows/case-study-unfurl-technology.yaml +++ b/.github/workflows/case-study-unfurl-technology.yaml @@ -1,6 +1,9 @@ +# TODO: migrate this + name: Case Study "Unfurl Technology" on: workflow_dispatch: + concurrency: unfurl-technology jobs: ################################################### diff --git a/.github/workflows/night.yaml b/.github/workflows/night.yaml index 17370b2987..74139aabe1 100644 --- a/.github/workflows/night.yaml +++ b/.github/workflows/night.yaml @@ -4,8 +4,6 @@ # We dot not introduce one big "vintner-case-study" action due to better logging.defaults: # See https://github.com/orgs/community/discussions/21276 -# TODO: fix OpenStack problem when using xOpera - name: Night on: workflow_dispatch: @@ -14,6 +12,7 @@ on: push: branches: - fix-night-workflow + concurrency: night jobs: ################################################### @@ -148,7 +147,6 @@ jobs: xopera-motivation-dev: name: xOpera Motivation Dev runs-on: ubuntu-22.04 - if: false env: ORCHESTRATOR: xopera EXAMPLE: xopera-motivation @@ -217,7 +215,6 @@ jobs: xopera-motivation-prod: name: xOpera Motivation Prod runs-on: ubuntu-22.04 - if: false env: ORCHESTRATOR: xopera EXAMPLE: xopera-motivation @@ -413,7 +410,6 @@ jobs: xopera-pruning-static: name: xOpera Pruning Static runs-on: ubuntu-22.04 - if: false concurrency: xopera-pruning-static env: ORCHESTRATOR: xopera @@ -483,7 +479,6 @@ jobs: xopera-pruning-elastic: name: xOpera Pruning Elastic runs-on: ubuntu-22.04 - if: false concurrency: xopera-pruning-elastic env: ORCHESTRATOR: xopera @@ -548,7 +543,6 @@ jobs: xopera-pruning-mode-static: name: xOpera Pruning Mode "Consistent Loose" Static runs-on: ubuntu-22.04 - if: false concurrency: xopera-pruning-static env: ORCHESTRATOR: xopera @@ -618,7 +612,6 @@ jobs: xopera-pruning-mode-elastic: name: xOpera Pruning Mode "Consistent Loose" Elastic runs-on: ubuntu-22.04 - if: false concurrency: xopera-pruning-elastic env: ORCHESTRATOR: xopera @@ -680,7 +673,9 @@ jobs: # ################################################### + # TODO: Disabled for now. Out of nowhere, github workflow cant deploy the application (works on my machine) unfurl-artifacts-community: + if: false name: Unfurl Artifacts Community runs-on: ubuntu-22.04 env: @@ -811,7 +806,9 @@ jobs: # ################################################### + # TODO: Disabled for now. Out of nowhere, github workflow cant deploy the application (works on my machine) unfurl-aware-local: + if: false name: Unfurl Aware Local runs-on: ubuntu-22.04 env: diff --git a/examples/unfurl-artifacts/scripts/deploy.sh b/examples/unfurl-artifacts/scripts/deploy.sh index 25896452c0..b5550b33d7 100644 --- a/examples/unfurl-artifacts/scripts/deploy.sh +++ b/examples/unfurl-artifacts/scripts/deploy.sh @@ -8,4 +8,4 @@ $VINTNER templates import --template ${TEMPLATE_NAME} --path ${TEMPLATE_DIR} $VINTNER instances init --instance ${TEMPLATE_NAME} --template ${TEMPLATE_NAME} $VINTNER instances resolve --instance ${TEMPLATE_NAME} --presets ${DEPLOYMENT_VARIANT} $VINTNER instances validate --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml -# $VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml +$VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml diff --git a/examples/unfurl-artifacts/scripts/undeploy.sh b/examples/unfurl-artifacts/scripts/undeploy.sh old mode 100644 new mode 100755 diff --git a/examples/unfurl-aware/scripts/configuration.env b/examples/unfurl-aware/scripts/configuration.env index 40cf245b43..98baf87936 100644 --- a/examples/unfurl-aware/scripts/configuration.env +++ b/examples/unfurl-aware/scripts/configuration.env @@ -1,3 +1,3 @@ TEMPLATE_NAME="aware" VINTNER="node ../../../build/cli/index.js" -DEPLOYMENT_VARIANT="cloud" \ No newline at end of file +DEPLOYMENT_VARIANT="local" \ No newline at end of file diff --git a/examples/unfurl-aware/scripts/setup.sh b/examples/unfurl-aware/scripts/setup.sh index 7e72240ae2..e7b7e0cb4f 100755 --- a/examples/unfurl-aware/scripts/setup.sh +++ b/examples/unfurl-aware/scripts/setup.sh @@ -5,6 +5,6 @@ set -e source configuration.sh $VINTNER setup init -$VINTNER orchestrators init unfurl --no-venv +$VINTNER orchestrators init unfurl $VINTNER orchestrators enable --orchestrator unfurl $VINTNER orchestrators attest --orchestrator unfurl \ No newline at end of file diff --git a/examples/xopera-motivation/lib/openstack/vm/playbooks/create.yaml b/examples/xopera-motivation/lib/openstack/vm/playbooks/create.yaml index 42d5a2b25e..85f655979f 100644 --- a/examples/xopera-motivation/lib/openstack/vm/playbooks/create.yaml +++ b/examples/xopera-motivation/lib/openstack/vm/playbooks/create.yaml @@ -39,15 +39,15 @@ - name: Set attributes set_stats: data: - private_address: '{{ server_info.server.private_v4 }}' - public_address: '{{ server_info.server.public_v4 }}' + private_address: '{{ server_info.server.addresses[network][0].addr }}' + public_address: '{{ server_info.server.addresses[network][0].addr }}' id: '{{ server_info.server.id }}' - name: Create temporary inventory for ssh wait add_host: name: server groups: vms - ansible_host: '{{ server_info.server.public_v4 }}' + ansible_host: '{{ server_info.server.addresses[network][0].addr }}' ansible_user: '{{ ssh_user }}' ansible_ssh_private_key_file: '{{ ssh_key_file }}' ansible_ssh_common_args: > diff --git a/examples/xopera-motivation/scripts/clean.sh b/examples/xopera-motivation/scripts/clean.sh new file mode 100755 index 0000000000..dc174b7f71 --- /dev/null +++ b/examples/xopera-motivation/scripts/clean.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Clean +$VINTNER setup clean --force diff --git a/examples/xopera-motivation/scripts/code.sh b/examples/xopera-motivation/scripts/code.sh new file mode 100755 index 0000000000..dbe3358fb5 --- /dev/null +++ b/examples/xopera-motivation/scripts/code.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Open VS Code +$VINTNER instances code --instance ${TEMPLATE_NAME} \ No newline at end of file diff --git a/examples/xopera-motivation/scripts/configuration.env b/examples/xopera-motivation/scripts/configuration.env new file mode 100644 index 0000000000..4c3387dae3 --- /dev/null +++ b/examples/xopera-motivation/scripts/configuration.env @@ -0,0 +1,5 @@ +TEMPLATE_NAME="xopera-motivation" +VINTNER="node ../../../build/cli/index.js" +#VINTNER="../../../task vintner" +ORCHESTRATOR="xopera" +VARIANT="dev" diff --git a/examples/xopera-motivation/scripts/configuration.sh b/examples/xopera-motivation/scripts/configuration.sh new file mode 100755 index 0000000000..9c517b8682 --- /dev/null +++ b/examples/xopera-motivation/scripts/configuration.sh @@ -0,0 +1,36 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.env + +# Check that TEMPLATE_NAME is defined +if [[ -z ${TEMPLATE_NAME} ]]; then + echo "TEMPLATE_NAME is not defined" + exit 1 +fi + +# Check that VINTNER is defined +if [[ -z ${VINTNER} ]]; then + echo "VINTNER is not defined" + exit 1 +fi + + +# Check that VARIANT is defined +if [[ -z ${VARIANT} ]]; then + echo "VARIANT is not defined" + exit 1 +fi + +# Check that ORCHESTRATOR is defined +if [[ -z ${ORCHESTRATOR} ]]; then + echo "ORCHESTRATOR is not defined" + exit 1 +fi + +# Set template directory +TEMPLATE_DIR=$(readlink -f $(dirname $0)/../) diff --git a/examples/xopera-motivation/scripts/continue.sh b/examples/xopera-motivation/scripts/continue.sh new file mode 100755 index 0000000000..4784e34fb6 --- /dev/null +++ b/examples/xopera-motivation/scripts/continue.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Continue deployment +$VINTNER instances continue --instance ${TEMPLATE_NAME} --force diff --git a/examples/xopera-motivation/scripts/demo-prod.sh b/examples/xopera-motivation/scripts/demo-prod.sh deleted file mode 100644 index bc852210a4..0000000000 --- a/examples/xopera-motivation/scripts/demo-prod.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /usr/bin/bash -set -e - -task cli -- setup clean --force -task cli -- setup init -task cli -- orchestrators init xopera-wsl -task cli -- orchestrators enable --orchestrator xopera-wsl - -task cli -- templates import --template motivation --path examples/xopera-motivation -task cli -- instances init --instance motivation --template motivation -task cli -- instances resolve --instance motivation --presets prod -task cli -- instances deploy --instance motivation --inputs examples/xopera-motivation/deployment-inputs.ignored.yaml diff --git a/examples/xopera-motivation/scripts/demo.sh b/examples/xopera-motivation/scripts/demo.sh deleted file mode 100644 index 5e31279a7e..0000000000 --- a/examples/xopera-motivation/scripts/demo.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /usr/bin/bash -set -e - -# Ensure that vintner is installed -if ! which vintner &>/dev/null; then - echo "\"vintner\" not installed" - exit 1 -fi - -vintner setup init -vintner orchestrators init xopera-wsl -vintner orchestrators enable --orchestrator xopera-wsl - -vintner templates import --template motivation --path examples/xopera-motivation -vintner instances init --instance motivation --template motivation -vintner instances resolve --instance motivation --presets dev -vintner instances deploy --instance motivation --inputs examples/xopera-motivation/inputs.yaml diff --git a/examples/xopera-motivation/scripts/deploy.sh b/examples/xopera-motivation/scripts/deploy.sh new file mode 100755 index 0000000000..1d4d813ecf --- /dev/null +++ b/examples/xopera-motivation/scripts/deploy.sh @@ -0,0 +1,15 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +$VINTNER template pull --dir ${TEMPLATE_DIR} +$VINTNER templates import --template ${TEMPLATE_NAME} --path ${TEMPLATE_DIR} +$VINTNER instances init --instance ${TEMPLATE_NAME} --template ${TEMPLATE_NAME} +$VINTNER instances resolve --instance ${TEMPLATE_NAME} --presets ${VARIANT} +$VINTNER instances validate --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml +$VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml diff --git a/examples/xopera-motivation/scripts/enrich.sh b/examples/xopera-motivation/scripts/enrich.sh new file mode 100755 index 0000000000..8e2ca88227 --- /dev/null +++ b/examples/xopera-motivation/scripts/enrich.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Enrich +$VINTNER template enrich --template ${TEMPLATE_DIR}/variable-service-template.yaml --output ${TEMPLATE_DIR}/enriched.yaml diff --git a/examples/xopera-motivation/scripts/pull.sh b/examples/xopera-motivation/scripts/pull.sh new file mode 100755 index 0000000000..90f0358264 --- /dev/null +++ b/examples/xopera-motivation/scripts/pull.sh @@ -0,0 +1,9 @@ +#! /usr/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Pull dependencies +$VINTNER template pull --dir ${TEMPLATE_DIR} + diff --git a/examples/xopera-motivation/scripts/quality.sh b/examples/xopera-motivation/scripts/quality.sh new file mode 100755 index 0000000000..fb4b90537a --- /dev/null +++ b/examples/xopera-motivation/scripts/quality.sh @@ -0,0 +1,13 @@ +#! /usr/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Quality +for dir in ../tests/*/; +#for dir in "../tests/gcp"; +do + dir=$(basename $dir) + echo "${dir}: $($VINTNER template quality --template ${TEMPLATE_DIR}/variable-service-template.yaml --inputs ${TEMPLATE_DIR}/tests/${dir}/inputs.yaml)" +done diff --git a/examples/xopera-motivation/scripts/reimport.sh b/examples/xopera-motivation/scripts/reimport.sh new file mode 100755 index 0000000000..c738698aeb --- /dev/null +++ b/examples/xopera-motivation/scripts/reimport.sh @@ -0,0 +1,20 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +$VINTNER instances undeploy --instance ${TEMPLATE_NAME} || true + +$VINTNER instances delete --instance ${TEMPLATE_NAME} --force || true +$VINTNER templates delete --template ${TEMPLATE_NAME} || true + +$VINTNER template pull --dir ${TEMPLATE_DIR} +$VINTNER templates import --template ${TEMPLATE_NAME} --path ${TEMPLATE_DIR} +$VINTNER instances init --instance ${TEMPLATE_NAME} --template ${TEMPLATE_NAME} +$VINTNER instances resolve --instance ${TEMPLATE_NAME} --presets ${VARIANT} +$VINTNER instances validate --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml +$VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml diff --git a/examples/xopera-motivation/scripts/setup.sh b/examples/xopera-motivation/scripts/setup.sh new file mode 100755 index 0000000000..519cac182c --- /dev/null +++ b/examples/xopera-motivation/scripts/setup.sh @@ -0,0 +1,14 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Setup +$VINTNER setup init +$VINTNER orchestrators init ${ORCHESTRATOR} +$VINTNER orchestrators enable --orchestrator ${ORCHESTRATOR} +$VINTNER orchestrators attest --orchestrator ${ORCHESTRATOR} \ No newline at end of file diff --git a/examples/xopera-motivation/scripts/swap-lib.sh b/examples/xopera-motivation/scripts/swap-lib.sh new file mode 100755 index 0000000000..3c6c742fdf --- /dev/null +++ b/examples/xopera-motivation/scripts/swap-lib.sh @@ -0,0 +1,16 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +FS="/c/Users" +if [[ "${OSTYPE}" == "linux-gnu" ]]; then + FS="/home" +fi + +# Delete lib in instance +rm -rf ${FS}/stoetzms/.opentosca_vintner/instances/technology-gcp/data/ensemble/lib + +# Copy local lib into instance +cp -R ../lib ${FS}/stoetzms/.opentosca_vintner/instances/technology-gcp/data/ensemble diff --git a/examples/xopera-motivation/scripts/undeploy.sh b/examples/xopera-motivation/scripts/undeploy.sh new file mode 100755 index 0000000000..799765e670 --- /dev/null +++ b/examples/xopera-motivation/scripts/undeploy.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Undeploy application +$VINTNER instances undeploy --instance ${TEMPLATE_NAME} diff --git a/examples/xopera-pruning-consistent-loose/scripts/configuration.env b/examples/xopera-pruning-consistent-loose/scripts/configuration.env index 87aafd7733..c47e99d79c 100644 --- a/examples/xopera-pruning-consistent-loose/scripts/configuration.env +++ b/examples/xopera-pruning-consistent-loose/scripts/configuration.env @@ -1,3 +1,3 @@ TEMPLATE_NAME="consistent-loose" -VINTNER="task cli --" +VINTNER="node ../../../build/cli/index.js" VARIABILITY_PRESET="static" \ No newline at end of file diff --git a/examples/xopera-pruning-consistent-loose/scripts/setup.sh b/examples/xopera-pruning-consistent-loose/scripts/setup.sh index c0ee7a553c..7437f2bc07 100755 --- a/examples/xopera-pruning-consistent-loose/scripts/setup.sh +++ b/examples/xopera-pruning-consistent-loose/scripts/setup.sh @@ -5,6 +5,6 @@ set -e source configuration.sh $VINTNER setup init -$VINTNER orchestrators init xopera --no-venv +$VINTNER orchestrators init xopera $VINTNER orchestrators enable --orchestrator xopera $VINTNER orchestrators attest --orchestrator xopera \ No newline at end of file diff --git a/examples/xopera-pruning/scripts/clean.sh b/examples/xopera-pruning/scripts/clean.sh new file mode 100755 index 0000000000..dc174b7f71 --- /dev/null +++ b/examples/xopera-pruning/scripts/clean.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Clean +$VINTNER setup clean --force diff --git a/examples/xopera-pruning/scripts/code.sh b/examples/xopera-pruning/scripts/code.sh new file mode 100755 index 0000000000..dbe3358fb5 --- /dev/null +++ b/examples/xopera-pruning/scripts/code.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Open VS Code +$VINTNER instances code --instance ${TEMPLATE_NAME} \ No newline at end of file diff --git a/examples/xopera-pruning/scripts/configuration.env b/examples/xopera-pruning/scripts/configuration.env new file mode 100644 index 0000000000..a5200ec576 --- /dev/null +++ b/examples/xopera-pruning/scripts/configuration.env @@ -0,0 +1,5 @@ +TEMPLATE_NAME="xopera-pruning" +VINTNER="node ../../../build/cli/index.js" +#VINTNER="../../../task vintner" +ORCHESTRATOR="xopera" +VARIANT="static" diff --git a/examples/xopera-pruning/scripts/configuration.sh b/examples/xopera-pruning/scripts/configuration.sh new file mode 100755 index 0000000000..9c517b8682 --- /dev/null +++ b/examples/xopera-pruning/scripts/configuration.sh @@ -0,0 +1,36 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.env + +# Check that TEMPLATE_NAME is defined +if [[ -z ${TEMPLATE_NAME} ]]; then + echo "TEMPLATE_NAME is not defined" + exit 1 +fi + +# Check that VINTNER is defined +if [[ -z ${VINTNER} ]]; then + echo "VINTNER is not defined" + exit 1 +fi + + +# Check that VARIANT is defined +if [[ -z ${VARIANT} ]]; then + echo "VARIANT is not defined" + exit 1 +fi + +# Check that ORCHESTRATOR is defined +if [[ -z ${ORCHESTRATOR} ]]; then + echo "ORCHESTRATOR is not defined" + exit 1 +fi + +# Set template directory +TEMPLATE_DIR=$(readlink -f $(dirname $0)/../) diff --git a/examples/xopera-pruning/scripts/continue.sh b/examples/xopera-pruning/scripts/continue.sh new file mode 100755 index 0000000000..4784e34fb6 --- /dev/null +++ b/examples/xopera-pruning/scripts/continue.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Continue deployment +$VINTNER instances continue --instance ${TEMPLATE_NAME} --force diff --git a/examples/xopera-pruning/scripts/deploy.sh b/examples/xopera-pruning/scripts/deploy.sh new file mode 100755 index 0000000000..1d4d813ecf --- /dev/null +++ b/examples/xopera-pruning/scripts/deploy.sh @@ -0,0 +1,15 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +$VINTNER template pull --dir ${TEMPLATE_DIR} +$VINTNER templates import --template ${TEMPLATE_NAME} --path ${TEMPLATE_DIR} +$VINTNER instances init --instance ${TEMPLATE_NAME} --template ${TEMPLATE_NAME} +$VINTNER instances resolve --instance ${TEMPLATE_NAME} --presets ${VARIANT} +$VINTNER instances validate --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml +$VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml diff --git a/examples/xopera-pruning/scripts/enrich.sh b/examples/xopera-pruning/scripts/enrich.sh new file mode 100755 index 0000000000..8e2ca88227 --- /dev/null +++ b/examples/xopera-pruning/scripts/enrich.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Enrich +$VINTNER template enrich --template ${TEMPLATE_DIR}/variable-service-template.yaml --output ${TEMPLATE_DIR}/enriched.yaml diff --git a/examples/xopera-pruning/scripts/pull.sh b/examples/xopera-pruning/scripts/pull.sh new file mode 100755 index 0000000000..90f0358264 --- /dev/null +++ b/examples/xopera-pruning/scripts/pull.sh @@ -0,0 +1,9 @@ +#! /usr/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Pull dependencies +$VINTNER template pull --dir ${TEMPLATE_DIR} + diff --git a/examples/xopera-pruning/scripts/quality.sh b/examples/xopera-pruning/scripts/quality.sh new file mode 100755 index 0000000000..fb4b90537a --- /dev/null +++ b/examples/xopera-pruning/scripts/quality.sh @@ -0,0 +1,13 @@ +#! /usr/bin/bash +set -e + +# Load configuration +source configuration.sh + +# Quality +for dir in ../tests/*/; +#for dir in "../tests/gcp"; +do + dir=$(basename $dir) + echo "${dir}: $($VINTNER template quality --template ${TEMPLATE_DIR}/variable-service-template.yaml --inputs ${TEMPLATE_DIR}/tests/${dir}/inputs.yaml)" +done diff --git a/examples/xopera-pruning/scripts/reimport.sh b/examples/xopera-pruning/scripts/reimport.sh new file mode 100755 index 0000000000..c738698aeb --- /dev/null +++ b/examples/xopera-pruning/scripts/reimport.sh @@ -0,0 +1,20 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +$VINTNER instances undeploy --instance ${TEMPLATE_NAME} || true + +$VINTNER instances delete --instance ${TEMPLATE_NAME} --force || true +$VINTNER templates delete --template ${TEMPLATE_NAME} || true + +$VINTNER template pull --dir ${TEMPLATE_DIR} +$VINTNER templates import --template ${TEMPLATE_NAME} --path ${TEMPLATE_DIR} +$VINTNER instances init --instance ${TEMPLATE_NAME} --template ${TEMPLATE_NAME} +$VINTNER instances resolve --instance ${TEMPLATE_NAME} --presets ${VARIANT} +$VINTNER instances validate --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml +$VINTNER instances deploy --instance ${TEMPLATE_NAME} --inputs ${TEMPLATE_DIR}/deployment-inputs.ignored.yaml diff --git a/examples/xopera-pruning/scripts/setup.sh b/examples/xopera-pruning/scripts/setup.sh new file mode 100755 index 0000000000..519cac182c --- /dev/null +++ b/examples/xopera-pruning/scripts/setup.sh @@ -0,0 +1,14 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Setup +$VINTNER setup init +$VINTNER orchestrators init ${ORCHESTRATOR} +$VINTNER orchestrators enable --orchestrator ${ORCHESTRATOR} +$VINTNER orchestrators attest --orchestrator ${ORCHESTRATOR} \ No newline at end of file diff --git a/examples/xopera-pruning/scripts/swap-lib.sh b/examples/xopera-pruning/scripts/swap-lib.sh new file mode 100755 index 0000000000..3c6c742fdf --- /dev/null +++ b/examples/xopera-pruning/scripts/swap-lib.sh @@ -0,0 +1,16 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +FS="/c/Users" +if [[ "${OSTYPE}" == "linux-gnu" ]]; then + FS="/home" +fi + +# Delete lib in instance +rm -rf ${FS}/stoetzms/.opentosca_vintner/instances/technology-gcp/data/ensemble/lib + +# Copy local lib into instance +cp -R ../lib ${FS}/stoetzms/.opentosca_vintner/instances/technology-gcp/data/ensemble diff --git a/examples/xopera-pruning/scripts/undeploy.sh b/examples/xopera-pruning/scripts/undeploy.sh new file mode 100755 index 0000000000..799765e670 --- /dev/null +++ b/examples/xopera-pruning/scripts/undeploy.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +set -e + +# Set working directory +cd "$(dirname "$0")" + +# Load configuration +source configuration.sh + +# Undeploy application +$VINTNER instances undeploy --instance ${TEMPLATE_NAME} diff --git a/src/assets/scripts/install-xopera.sh b/src/assets/scripts/install-xopera.sh index 22d7fe268f..70800caa0f 100755 --- a/src/assets/scripts/install-xopera.sh +++ b/src/assets/scripts/install-xopera.sh @@ -33,8 +33,7 @@ if [ ! -f ".venv/bin/activate" ]; then fi # Install xOpera -# openstacksdk==0.61 is required, see https://storyboard.openstack.org/#!/story/2010128 # pyyaml==5.3.1 is required, see https://github.com/yaml/pyyaml/issues/724#issuecomment-1638587228 # requests==2.31.0 is required, see https://github.com/ansible-collections/community.docker/issues/868 -pip install opera==0.6.9 openstacksdk==0.61 python-openstackclient==6.0.0 pyyaml==5.3.1 pymysql==1.1.0 ansible==8.7.0 ansible-core==2.15.9 +pip install opera==0.6.9 openstacksdk==1.0.0 python-openstackclient==6.0.0 pyyaml==5.3.1 pymysql==1.1.0 ansible==8.7.0 ansible-core==2.15.9 ansible-galaxy collection install community.docker:3.9.0 kubernetes.core:3.2.0 google.cloud:1.2.0 dubzland.minio:1.2.0 --force diff --git a/tests/utils.ts b/tests/utils.ts index aedbb2e81a..ec0b2b6aeb 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -56,7 +56,7 @@ export function runGroups(groups: VariabilityTestGroup[]) { const effectiveTests = onlyTests.length ? onlyTests : nonDisabledTests effectiveTests.forEach(test => { - it(test.name, getDefaultTest(test.dir, test.vstdir)).timeout(10 * 1000) + it(test.name, getDefaultTest(test.dir, test.vstdir)).timeout(20 * 1000) }) }) } From e524c64010282d3e290023ab9fb2065f66a66e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miles=20St=C3=B6tzner?= Date: Fri, 27 Sep 2024 20:14:35 +0200 Subject: [PATCH 2/2] fix asterisk parsing (#421) --- src/controller/utils/scenarios.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/controller/utils/scenarios.ts b/src/controller/utils/scenarios.ts index d9986c5956..117d5a0a2a 100644 --- a/src/controller/utils/scenarios.ts +++ b/src/controller/utils/scenarios.ts @@ -21,6 +21,13 @@ export type ScenariosOptions = { } export default async function (options: ScenariosOptions) { + /** + * Replace 'asterisk' with '*' due to parsing problems + */ + options.hosting = check.isArray(options.hosting) + ? options.hosting.map(hosting => (hosting === 'asterisk' ? ASTERISK : hosting)) + : options.hosting + /** * Graph */ @@ -113,8 +120,11 @@ function matches(graph: Graph, input: string[], hosting: string[]): boolean { // Accept that user provided hosting is shorter than rule if (check.isUndefined(is)) return true + if (asterisk) return matches(graph, utils.copy(input), utils.copy(hosting)) + if (graph.inheritance.isNodeType(is, question)) { const hostingCopy = utils.copy(hosting) + if (asterisk) hostingCopy.shift() hostingCopy.shift() @@ -123,7 +133,5 @@ function matches(graph: Graph, input: string[], hosting: string[]): boolean { return matches(graph, utils.copy(input), hostingCopy) } - if (asterisk) return matches(graph, utils.copy(input), utils.copy(hosting)) - return false }