Skip to content

Commit

Permalink
fix pull
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner authored Mar 6, 2024
1 parent afdaf11 commit 96b0ace
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/actions/vintner-install/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@ runs:
- name: (PREPARE) Install Vintner
shell: bash
run: curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -

- name: (PREPARE) Vintner version
shell: bash
run: vintner --version
11 changes: 11 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/code.sh
Original file line number Diff line number Diff line change
@@ -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}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TEMPLATE_NAME="technology-maintenance"
#VINTNER="node ../../../build/cli/index.js"
VINTNER="yarn cli"
DEPLOYMENT_VARIANT="static"
29 changes: 29 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /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 DEPLOYMENT_VARIANT is defined
if [[ -z ${DEPLOYMENT_VARIANT} ]]; then
echo "DEPLOYMENT_VARIANT is not defined"
exit 1
fi

# Set template directory
TEMPLATE_DIR=$(readlink -f $(dirname $0)/../)
11 changes: 11 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/continue.sh
Original file line number Diff line number Diff line change
@@ -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}
15 changes: 15 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /usr/bin/bash
set -e

# Set working directory
cd "$(dirname "$0")"

# Load configuration
source configuration.sh

$VINTNER template pull --template ${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 ${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
9 changes: 9 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/pull.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/bash
set -e

# Load configuration
source configuration.sh

# Pull dependencies
$VINTNER template pull --template ${TEMPLATE_DIR}

8 changes: 8 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/quality.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/bash
set -e

# Load configuration
source configuration.sh

# Quality
$VINTNER template quality --template ${TEMPLATE_DIR}/variable-service-template.yaml --presets ${DEPLOYMENT_VARIANT}
19 changes: 19 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/reimport.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/bash
set -e

# Set working directory
cd "$(dirname "$0")"

# Load configuration
source configuration.sh

$VINTNER instances delete --instance ${TEMPLATE_NAME}

$VINTNER templates delete --template ${TEMPLATE_NAME}

$VINTNER template pull --template ${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 ${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
14 changes: 14 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -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 unfurl
$VINTNER orchestrators enable --orchestrator unfurl
$VINTNER orchestrators attest --orchestrator unfurl
11 changes: 11 additions & 0 deletions examples/unfurl-technology-maintenance/scripts/undeploy.sh
Original file line number Diff line number Diff line change
@@ -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}
1 change: 1 addition & 0 deletions src/assets/templates/template-init/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e
# Load configuration
source configuration.sh

$VINTNER template pull --template ${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} --inputs ${TEMPLATE_DIR}/tests/first/inputs.yaml
Expand Down
2 changes: 1 addition & 1 deletion src/assets/templates/template-init/scripts/pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e
# Load configuration
source configuration.sh

$VINTNER pull ${TEMPLATE_DIR}
$VINTNER template pull --template ${TEMPLATE_DIR}
1 change: 1 addition & 0 deletions src/assets/templates/template-init/scripts/reimport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source configuration.sh
$VINTNER instances delete --instance ${TEMPLATE_NAME}
$VINTNER templates delete --template ${TEMPLATE_NAME}

$VINTNER template pull --template ${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} --inputs ${TEMPLATE_DIR}/tests/first/inputs.yaml
Expand Down
4 changes: 3 additions & 1 deletion src/controller/template/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export default async function (options: TemplatePullOptions) {
const source = path.isAbsolute(dependency.source)
? dependency.source
: path.join(options.template, dependency.source)
const target = path.join(options.template, dependency.target || '.')

if (options.link) {
const target = path.join(options.template, dependency.target || '.')

await files.link(source, target)
} else {
const target = path.join(options.template, dependency.target || files.getBase(source))
await files.sync(source, target)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/controller/template/puml/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default async function (options: TemplatePUMLTypesOptions) {
for (const [type, plot] of Object.entries(result)) {
const output = path.join(
outputDir,
files.getFilename(options.path).replace(/(\.yaml|\.yml)/, '.' + type.replace('_', '-') + '.puml')
files.getBase(options.path).replace(/(\.yaml|\.yml)/, '.' + type.replace('_', '-') + '.puml')
)
if (!output.endsWith('.puml')) throw new Error(`Output path "${output}" does not end with '.puml'`)

Expand Down
2 changes: 1 addition & 1 deletion src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function getDirectory(file: string) {
return path.parse(path.resolve(file)).dir
}

export function getFilename(file: string) {
export function getBase(file: string) {
return path.parse(path.resolve(file)).base
}

Expand Down

0 comments on commit 96b0ace

Please sign in to comment.