Skip to content

Commit

Permalink
unfurl technology
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner authored Mar 12, 2024
1 parent 39a7fd6 commit a379126
Show file tree
Hide file tree
Showing 246 changed files with 4,701 additions and 1,046 deletions.
33 changes: 27 additions & 6 deletions .github/actions/vintner-resolve/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,42 @@ inputs:
required: true

preset:
required: true
required: false

orchestrator:
required: true

runs:
using: 'composite'
steps:
- name: (VINTNER) Pull dependencies
shell: bash
run: vintner template pull --dir examples/${EXAMPLE}
env:
EXAMPLE: ${{ inputs.example }}

- name: (VINTNER) Import template
shell: bash
run: vintner templates import --template template --path examples/${EXAMPLE}
env:
EXAMPLE: ${{ inputs.example }}

- name: (VINTNER) Init instance
shell: bash
run: vintner instances init --instance instance --template template

- name: (VINTNER) Resolve variability
shell: bash
run: |
vintner template pull --template examples/${EXAMPLE}
vintner templates import --template template --path examples/${EXAMPLE}
vintner instances init --instance instance --template template
vintner instances resolve --instance instance --presets ${PRESET}
VINTNER_ARGS=""
if [ -f "/tmp/variability-inputs.yaml" ]; then
VINTNER_ARGS="${VINTNER_ARGS} --inputs /tmp/variability-inputs.yaml"
fi
if [ -n "${PRESET}" ]; then
VINTNER_ARGS="${VINTNER_ARGS} --presets ${PRESET}"
fi
vintner instances resolve --instance instance ${VINTNER_ARGS}
env:
EXAMPLE: ${{ inputs.example }}
PRESET: ${{ inputs.preset }}
1 change: 0 additions & 1 deletion .github/actions/vintner-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ runs:
curl --fail-with-body https://${MINIKUBE_IP}:${PORT}
env:
EXAMPLE: ${{ inputs.example }}
PORT: ${{ inputs.port }}
84 changes: 70 additions & 14 deletions .github/workflows/case-study-unfurl-technology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-22.04
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: kubernetes
EXAMPLE: unfurl-technology-conditional-quality-maintenance
EXAMPLE_OVERRIDE: unfurl-technology
ENV: K8S
PORT: 30080
steps:
Expand Down Expand Up @@ -46,20 +46,32 @@ jobs:
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- name: (VINTNER) Assign variability inputs
run: |
cat << EOF > /tmp/variability-inputs.yaml
env: KUBERNETES
medium: false
optional_feature: true
premium_feature: true
EOF
- name: (VINTNER) Resolve variability
uses: ./.github/actions/vintner-resolve
with:
example: ${{ env.EXAMPLE }}
preset: ${{ env.PRESET }}

- name: (VINTNER) Assign deployment inputs
run: |
cat << EOF > /tmp/deployment-inputs.yaml
k8s_api_port: $(minikube ip)
database_password: ${DB_PASSWORD}
k8s_api_address: $(minikube ip)
k8s_api_port: '8843'
k8s_ca_cert_file: /home/runner/.minikube/ca.crt
k8s_client_cert_file: /home/runner/.minikube/profiles/minikube/client.crt
k8s_client_key_file: /home/runner/.minikube/profiles/minikube/client.key
EOF
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

- name: (VINTNER) Validate application
uses: ./.github/actions/vintner-validate
Expand All @@ -70,7 +82,7 @@ jobs:
- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
example: ${{ env.EXAMPLE_OVERRIDE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

Expand All @@ -89,8 +101,8 @@ jobs:
runs-on: ubuntu-22.04
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: elastic
EXAMPLE: unfurl-technology-conditional-quality-maintenance
EXAMPLE_OVERRIDE: unfurl-technology
ENV: GCP
PORT: 80
steps:
Expand Down Expand Up @@ -118,17 +130,32 @@ jobs:
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- name: (VINTNER) Assign variability inputs
run: |
cat << EOF > /tmp/variability-inputs.yaml
env: ELASTIC
medium: false
optional_feature: true
premium_feature: true
EOF
- name: (VINTNER) Resolve variability
uses: ./.github/actions/vintner-resolve
with:
example: ${{ env.EXAMPLE }}
preset: ${{ env.PRESET }}

- name: (VINTNER) Assign deployment inputs
run: |
cat << EOF > /tmp/deployment-inputs.yaml
database_password: ${DB_PASSWORD}
gcp_region: ${GCP_REGION}
gcp_service_account_file: /tmp/gcp-service-account-file.json
gcp_project: ${GCP_PROJECT}
EOF
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
GCP_REGION: ${{ secrets.GCP_REGION }}
GCP_PROJECT: ${{ secrets.GCP_PROJECT }}

- name: (VINTNER) Validate application
uses: ./.github/actions/vintner-validate
Expand All @@ -139,7 +166,7 @@ jobs:
- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
example: ${{ env.EXAMPLE_OVERRIDE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

Expand All @@ -156,10 +183,12 @@ jobs:
openstack:
name: OpenStack
runs-on: ubuntu-22.04
# TODO: is working
if: false
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: static
EXAMPLE: unfurl-technology-conditional-quality-maintenance
EXAMPLE_OVERRIDE: unfurl-technology
ENV: OS
PORT: 80
steps:
Expand Down Expand Up @@ -187,20 +216,47 @@ jobs:
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- name: (VINTNER) Assign variability inputs
run: |
cat << EOF > /tmp/variability-inputs.yaml
env: STATIC
medium: true
optional_feature: true
premium_feature: true
EOF
- name: (VINTNER) Resolve variability
uses: ./.github/actions/vintner-resolve
with:
example: ${{ env.EXAMPLE }}
preset: ${{ env.PRESET }}

- name: (VINTNER) Assign deployment inputs
run: |
cat << EOF > /tmp/deployment-inputs.yaml
database_password: ${DB_PASSWORD}
os_network: ${OS_NETWORK}
os_ssh_key_name: ${OS_SSH_KEY_NAME}
os_ssh_user: ${OS_SSH_USER}
os_ssh_key_file: /tmp/os-ssh-key-file
os_region_name: ${OS_REGION_NAME}
os_auth_type: ${OS_AUTH_TYPE}
os_auth_url: ${OS_AUTH_URL}
os_identity_api_version: '${OS_IDENTITY_API_VERSION}'
os_interface: ${OS_INTERFACE}
os_application_credential_id: ${OS_APPLICATION_CREDENTIAL_ID}
os_application_credential_secret: ${OS_APPLICATION_CREDENTIAL_SECRET}
os_ssh_key_file: /tmp/os-ssh-key-file
EOF
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

OS_NETWORK: ${{ secrets.OS_NETWORK }}
OS_SSH_KEY_NAME: ${{ secrets.OS_SSH_KEY_NAME }}
OS_SSH_USER: ${{ secrets.OS_SSH_USER }}
OS_REGION_NAME: ${{ secrets.OS_REGION_NAME }}
OS_AUTH_TYPE: ${{ secrets.OS_AUTH_TYPE }}
OS_AUTH_URL: ${{ secrets.OS_AUTH_URL }}
OS_IDENTITY_API_VERSION: ${{ secrets.OS_IDENTITY_API_VERSION }}
OS_INTERFACE: ${{ secrets.OS_INTERFACE }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

Expand All @@ -213,7 +269,7 @@ jobs:
- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
example: ${{ env.EXAMPLE_OVERRIDE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

Expand Down
16 changes: 15 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,19 @@
"arrowParens": "avoid",
"tabWidth": 4,
"printWidth": 120,
"semi": false
"semi": false,
"overrides": [
{
"files": ["*.yaml", "*.yml"],
"options": {
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid",
"tabWidth": 4,
"printWidth": 160,
"semi": false
}
}
]
}
13 changes: 6 additions & 7 deletions cmds/pull-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -e
cd "$(dirname "$0")"
cd ../


# Check that vintner has been built
ENTRYPOINT="build/cli/index.js"
VINTNER="node build/cli/index.js"
Expand All @@ -18,19 +17,19 @@ fi
LINK=${1:-false}

# Pull dependencies of each example
for example in examples/*/; do
for EXAMPLE in examples/*/; do

# Ignore directories starting with a dot
if [[ "${example}" == "\."* ]]; then
if [[ "${EXAMPLE}" == "\."* ]]; then
continue
fi

# Ignore directories without config.yaml
if [ ! -f "${example}/config.yaml" ]; then
if [ ! -f "${EXAMPLE}/config.yaml" ]; then
continue
fi

# Pull dependenciess
echo "Pulling ${example}"
$VINTNER template pull --template "$(realpath ${example})" --link ${LINK}
# Pull dependencies
echo "Pulling ${EXAMPLE}"
$VINTNER template pull --dir "$(realpath ${EXAMPLE})" --link ${LINK}
done
32 changes: 32 additions & 0 deletions cmds/unpull-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/bash
set -e

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

# Check that vintner has been built
ENTRYPOINT="build/cli/index.js"
VINTNER="node build/cli/index.js"
if [ ! -f "${ENTRYPOINT}" ]; then
echo "Entrypoint not found"
exit 1
fi

# Unpull dependencies of each example
for EXAMPLE in examples/*/; do

# Ignore directories starting with a dot
if [[ "${EXAMPLE}" == "\."* ]]; then
continue
fi

# Ignore directories without config.yaml
if [ ! -f "${EXAMPLE}/config.yaml" ]; then
continue
fi

# Unpull dependencies
echo "$Unpulling ${EXAMPLE}"
$VINTNER template unpull --dir "$(realpath ${EXAMPLE})"
done
2 changes: 1 addition & 1 deletion docs/cmds/query/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {loadAllTests} from '../../../tests/query/query-test'

async function main() {
const documentationDirectory = path.join('docs', 'docs', 'queries4tosca', 'tests')
files.deleteDirectory(documentationDirectory)
files.removeDirectory(documentationDirectory)
files.createDirectory(documentationDirectory)

const tests = loadAllTests()
Expand Down
2 changes: 1 addition & 1 deletion docs/cmds/variability/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Test = {

async function main() {
const documentationDirectory = path.join('docs', 'docs', 'variability4tosca', 'tests')
files.deleteDirectory(documentationDirectory)
files.removeDirectory(documentationDirectory)
files.createDirectory(documentationDirectory)

const testsDirectory = path.join('tests', 'conformance')
Expand Down
Loading

0 comments on commit a379126

Please sign in to comment.