Skip to content

Commit

Permalink
unfurl technology example
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner authored Mar 6, 2024
1 parent b5db628 commit afdaf11
Show file tree
Hide file tree
Showing 178 changed files with 5,723 additions and 623 deletions.
14 changes: 14 additions & 0 deletions .github/actions/vintner-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ inputs:
options:
- OS
- GCP
- K8S

runs:
using: 'composite'
Expand Down Expand Up @@ -40,3 +41,16 @@ runs:
run: curl --fail-with-body https://${EXAMPLE}-dot-stoetzms-387808.ey.r.appspot.com
env:
EXAMPLE: ${{ inputs.example }}

- name: (VINTNER) Test application
if: ${{ inputs.env == 'K8S' }}
shell: bash
run: |
MINIKUBE_IP=$(minikube ip)
echo "minikube ip: ${MINIKUBE_IP}"
curl --fail-with-body https://${MINIKUBE_IP}:${PORT}
env:
EXAMPLE: ${{ inputs.example }}
PORT: ${{ inputs.port }}
222 changes: 222 additions & 0 deletions .github/workflows/case-study-unfurl-technology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
name: Case Study "Unfurl Technology"
on:
workflow_dispatch:

jobs:
###################################################
#
# Kubernetes
#
###################################################

kubernetes:
name: Kubernetes
runs-on: ubuntu-22.04
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: kubernetes
ENV: K8S
PORT: 30080
steps:
###################################################
#
# Prepare
#
###################################################

- name: (PREPARE) Checkout repository
uses: actions/checkout@v3
with:
lfs: true

- name: (PREPARE) Start minikube
uses: medyagh/[email protected]

- name: (PREPARE) Install Vintner
uses: ./.github/actions/vintner-install
with:
gcp_service_account_file: ${{ secrets.GCP_SERVICE_ACCOUNT_FILE }}
os_ssh_key_file: ${{ secrets.OS_SSH_KEY_FILE }}
os_application_credential_id: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
os_application_credential_secret: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

- name: (VINTNER) Configure setup
uses: ./.github/actions/vintner-setup
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- 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)
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
- name: (VINTNER) Validate application
uses: ./.github/actions/vintner-validate

- name: (VINTNER) Deploy application
uses: ./.github/actions/vintner-deploy

- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

- name: (VINTNER) Undeploy application
uses: ./.github/actions/vintner-undeploy
if: always()

###################################################
#
# GCP
#
###################################################

gcp:
name: GCP
runs-on: ubuntu-22.04
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: elastic
ENV: GCP
PORT: 80
steps:
###################################################
#
# Prepare
#
###################################################

- name: (PREPARE) Checkout repository
uses: actions/checkout@v3
with:
lfs: true

- name: (PREPARE) Install Vintner
uses: ./.github/actions/vintner-install
with:
gcp_service_account_file: ${{ secrets.GCP_SERVICE_ACCOUNT_FILE }}
os_ssh_key_file: ${{ secrets.OS_SSH_KEY_FILE }}
os_application_credential_id: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
os_application_credential_secret: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

- name: (VINTNER) Configure setup
uses: ./.github/actions/vintner-setup
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- 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
gcp_service_account_file: /tmp/gcp-service-account-file.json
EOF
- name: (VINTNER) Validate application
uses: ./.github/actions/vintner-validate

- name: (VINTNER) Deploy application
uses: ./.github/actions/vintner-deploy

- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

- name: (VINTNER) Undeploy application
uses: ./.github/actions/vintner-undeploy
if: always()

###################################################
#
# OpenStack
#
###################################################

openstack:
name: OpenStack
runs-on: ubuntu-22.04
env:
ORCHESTRATOR: unfurl
EXAMPLE: unfurl-technology-maintenance
PRESET: static
ENV: OS
PORT: 80
steps:
###################################################
#
# Prepare
#
###################################################

- name: (PREPARE) Checkout repository
uses: actions/checkout@v3
with:
lfs: true

- name: (PREPARE) Install Vintner
uses: ./.github/actions/vintner-install
with:
gcp_service_account_file: ${{ secrets.GCP_SERVICE_ACCOUNT_FILE }}
os_ssh_key_file: ${{ secrets.OS_SSH_KEY_FILE }}
os_application_credential_id: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
os_application_credential_secret: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

- name: (VINTNER) Configure setup
uses: ./.github/actions/vintner-setup
with:
orchestrator: ${{ env.ORCHESTRATOR }}

- 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
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:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

- name: (VINTNER) Validate application
uses: ./.github/actions/vintner-validate

- name: (VINTNER) Deploy application
uses: ./.github/actions/vintner-deploy

- name: (VINTNER) Test application
uses: ./.github/actions/vintner-test
with:
example: ${{ env.EXAMPLE }}
env: ${{ env.ENV }}
port: ${{ env.PORT }}

- name: (VINTNER) Undeploy application
uses: ./.github/actions/vintner-undeploy
if: always()
14 changes: 8 additions & 6 deletions cmds/pull-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ if [ ! -f "${ENTRYPOINT}" ]; then
exit 1
fi

# Symbolic
LINK=${1:-false}

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

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

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

# Pull dependencies
echo "Pulling ${e}"
$VINTNER template pull --template "${e}"
# Pull dependenciess
echo "Pulling ${example}"
$VINTNER template pull --template "$(realpath ${example})" --link ${LINK}
done
4 changes: 2 additions & 2 deletions docs/cmds/sofdcar/generate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as files from '#files'
import {ServiceTemplate} from '#spec/service-template'
import Loader from '#graph/loader'
import * as utils from '#utils'
import * as path from 'path'

async function run(name: string, id: string, variant: string) {
const dir = path.join('docs', 'docs', 'sofdcar')
const template = files.loadYAML<ServiceTemplate>(path.join(dir, name + '.yaml'))
const template = new Loader(path.join(dir, name + '.yaml')).raw()
await files.renderFile(
path.join(__dirname, 'profile.template.ejs'),
{
Expand Down
3 changes: 2 additions & 1 deletion docs/cmds/variability/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
VariabilityTestConfig,
} from '#controller/template/test'
import * as files from '#files'
import Loader from '#graph/loader'
import {ServiceTemplate} from '#spec/service-template'
import {InputAssignmentMap} from '#spec/topology-template'
import * as path from 'path'
Expand Down Expand Up @@ -35,7 +36,7 @@ async function main() {
const dir = path.join(groupDir, test)
const id = `${group}-${test}`
const config = loadConfig(dir)
const template = files.loadYAML<ServiceTemplate>(getVariableServiceTemplate({dir, file: config.template}))
const template = new Loader(getVariableServiceTemplate({dir, file: config.template})).raw()
const inputs = getDefaultInputs(dir)
? files.loadYAML<InputAssignmentMap>(getDefaultInputs(dir)!)
: undefined
Expand Down
Loading

0 comments on commit afdaf11

Please sign in to comment.