Skip to content

fix

fix #110

Workflow file for this run

# GitHub runner seems not to support IPv6.
# See https://github.com/actions/runner-images/issues/668
name: Night
on:
workflow_dispatch:
schedule:
- cron: '20 4 * * 2'
push:
branches:
- fix-night-workflow
concurrency: night
jobs:
night:
name: Night
runs-on: ubuntu-22.04
steps:
###################################################
#
# Prepare
#
###################################################
- name: (PREPARE) Checkout Repository
uses: actions/checkout@v3
with:
lfs: true
- name: (PREPARE) Setup Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}"
- name: (PREPARE) Setup GCloud
uses: google-github-actions/setup-gcloud@v1
with:
version: 438.0.0
- name: (PREPARE) Setup GCP credentials
run: |
if [ -z "${GCP_CREDENTIALS}" ]; then
echo "GCP_CREDENTIALS not defined"
exit 1
fi
echo ${GCP_CREDENTIALS} | base64 --decode > /tmp/gcp-credentials.json
env:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
- name: (PREPARE) Setup OS SSH key file
run: |
if [ -z "${OS_SSH_KEY_FILE}" ]; then
echo "OS_SSH_KEY_FILE not defined"
exit 1
fi
echo ${OS_SSH_KEY_FILE} | base64 --decode > /tmp/os-ssh-key-file
chmod 400 /tmp/os-ssh-key-file
env:
OS_SSH_KEY_FILE: ${{ secrets.OS_SSH_KEY_FILE }}
- name: (PREPARE) Setup OS credentials
run: |
if [ -z "${OS_APPLICATION_CREDENTIAL_ID}" ]; then
echo "OS_APPLICATION_CREDENTIAL_ID not defined"
exit 1
fi
if [ -z "${OS_APPLICATION_CREDENTIAL_SECRET}" ]; then
echo "OS_APPLICATION_CREDENTIAL_SECRET not defined"
exit 1
fi
cat << EOF > /tmp/os-credentials.sh
#!/usr/bin/env bash
export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=https://idm02.bw-cloud.org:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME="Mannheim"
export OS_INTERFACE=public
export OS_APPLICATION_CREDENTIAL_ID=${OS_APPLICATION_CREDENTIAL_ID}
export OS_APPLICATION_CREDENTIAL_SECRET=${OS_APPLICATION_CREDENTIAL_SECRET}
EOF
chmod 755 /tmp/os-credentials.sh
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (PREPARE) Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.10.13
cache: pip
- name: (PREPARE) Cache xOpera
uses: actions/cache@v3
with:
path: /home/runner/opera
key: xopera
- name: (PREPARE) Install xOpera
run: ./src/assets/scripts/install-xopera.sh
- name: (PREPARE) Cache Unfurl
uses: actions/cache@v3
with:
path: /home/runner/unfurl
key: unfurl
- name: (PREPARE) Install Unfurl
run: ./src/assets/scripts/install-unfurl.sh
###################################################
#
# Installation
#
###################################################
- name: (INSTALLATION) Install Vintner
run: curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -
- name: (INSTALLATION) Verify checksum
run: |
wget https://github.com/opentosca/opentosca-vintner/releases/download/latest/vintner-linux-x64.sha256
cp /usr/bin/vintner vintner-linux-x64
sha256sum --check vintner-linux-x64.sha256
rm vintner-linux-x64
rm vintner-linux-x64.sha256
- name: (INSTALLATION) Verify signature
run: |
curl https://vintner.opentosca.org/vintner-release.gpg | gpg --import
wget https://github.com/opentosca/opentosca-vintner/releases/download/latest/vintner-linux-x64.asc
cp /usr/bin/vintner vintner-linux-x64
gpg --verify vintner-linux-x64.asc
rm vintner-linux-x64.asc
###################################################
#
# Unfurl Motivation Production
#
###################################################
- name: (UNFURL-MOTIVATION-PROD) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-MOTIVATION-PROD) Resolve variability
run: |
vintner templates import --template motivation --path examples/unfurl-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets prod
- name: (UNFURL-MOTIVATION-PROD) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-motivation-prod-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
os_application_credential_secret: dummy
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
- name: (UNFURL-MOTIVATION-PROD) Test application
run: curl --fail-with-body https://application-dot-stoetzms-387808.ey.r.appspot.com
- name: (UNFURL-MOTIVATION-PROD) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
- name: Abort
run: exit 1
if: always()
###################################################
#
# Vintner
#
###################################################
- name: (VINTNER) Ensure that version is overridden
run: |
vintner --version
if [ "$(vintner --version)" == "__VERSION__" ]; then
exit 1
fi
- name: (VINTNER) Ensure that license is overridden
run: |
vintner info license
if [ "$(vintner info license)" == "$(cat src/assets/LICENSE)" ]; then
exit 1
fi
- name: (VINTNER) Ensure that dependencies are overridden
run: |
vintner info dependencies
if [ "$(vintner info dependencies)" == "$(cat src/assets/dependencies.csv)" ]; then
exit 1
fi
- name: (VINTNER) Test filesystem initialization
run: vintner setup init
- name: (VINTNER) Test resolver
run: vintner setup benchmark --seeds 10 250
###################################################
#
# Docker
#
###################################################
- name: (DOCKER) Start Docker container
run: |
docker run --detach --name vintner ghcr.io/opentosca/opentosca-vintner:latest
sleep 2
docker logs vintner
- name: (DOCKER) Ensure Vintner can be executed
run: docker exec vintner vintner --version
- name: (DOCKER) Ensure Vintner can be executed
run: |
DOCKER_VERSION=$(docker exec vintner vintner --version)
echo "Docker version: $DOCKER_VERSION}"
BINARY_VERSION=$(vintner --version)
echo "Binary version: ${BINARY_VERSION}"
if [ ${DOCKER_VERSION} != ${BINARY_VERSION} ]; then
echo "Versions do not match"
exit 1
fi
- name: (DOCKER) Stop Docker container
run: docker kill vintner
###################################################
#
# xOpera Motivation Development
#
###################################################
- name: (XOPERA-MOTIVATION-DEV) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-MOTIVATION-DEV) Resolve variability
run: |
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 validate --instance motivation
- name: (XOPERA-MOTIVATION-DEV) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-motivation-dev-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
os_application_credential_id: ${OS_APPLICATION_CREDENTIAL_ID}
os_application_credential_secret: ${OS_APPLICATION_CREDENTIAL_SECRET}
private_vm_ssh_key_file: /tmp/os-ssh-key-file
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (XOPERA-MOTIVATION-DEV) Test application
run: |
VIRTUAL_MACHINE_NAME=abcdefgh-private-vm
cd ~/opera
. .venv/bin/activate
. /tmp/os-credentials.sh
VIRTUAL_MACHINE_IP=$(openstack server show ${VIRTUAL_MACHINE_NAME} -f json | jq -r '.addresses."public-belwue"[0]')
echo "virtual machine name: ${VIRTUAL_MACHINE_NAME}"
echo "virtual machine ip: ${VIRTUAL_MACHINE_IP}"
curl --fail-with-body http://${VIRTUAL_MACHINE_IP}
- name: (XOPERA-MOTIVATION-DEV) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# xOpera Motivation Production
#
###################################################
- name: (XOPERA-MOTIVATION-PROD) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-MOTIVATION-PROD) Resolve variability
run: |
vintner templates import --template motivation --path examples/xopera-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets prod
vintner instances validate --instance motivation
- name: (XOPERA-MOTIVATION-PROD) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-motivation-prod-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
- name: (XOPERA-MOTIVATION-PROD) Test application
run: curl --fail-with-body https://application-dot-stoetzms-387808.ey.r.appspot.com
- name: (XOPERA-MOTIVATION-PROD) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# xOpera Pruning Elastic
#
###################################################
- name: (XOPERA-PRUNING-ELASTIC) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-PRUNING-ELASTIC) Resolve variability
run: |
vintner templates import --template pruning --path examples/xopera-pruning
vintner instances init --instance pruning --template pruning
vintner instances resolve --instance pruning --presets elastic
vintner instances validate --instance pruning
- name: (XOPERA-PRUNING-ELASTIC) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-pruning-elastic-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance pruning --inputs ${DEPLOYMENT_INPUTS}
- name: (XOPERA-PRUNING-ELASTIC) Test application
run: curl --fail-with-body https://shop-dot-stoetzms-387808.ey.r.appspot.com
- name: (XOPERA-PRUNING-ELASTIC) Undeploy application
run: vintner instances undeploy --instance pruning
if: always()
###################################################
#
# Unfurl Motivation Development
#
###################################################
- name: (UNFURL-MOTIVATION-DEV) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-MOTIVATION-DEV) Resolve variability
run: |
vintner templates import --template motivation --path examples/unfurl-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets dev
- name: (UNFURL-MOTIVATION-DEV) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-motivation-dev-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
os_application_credential_id: ${OS_APPLICATION_CREDENTIAL_ID}
os_application_credential_secret: ${OS_APPLICATION_CREDENTIAL_SECRET}
vm_ssh_key_file: /tmp/os-ssh-key-file
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (UNFURL-MOTIVATION-DEV) Test the application
run: |
VIRTUAL_MACHINE_NAME=abcdefgh-private-vm
cd ~/unfurl
. .venv/bin/activate
. /tmp/os-credentials.sh
VIRTUAL_MACHINE_IP=$(openstack server show ${VIRTUAL_MACHINE_NAME} -f json | jq -r '.addresses."public-belwue"[0]')
echo "virtual machine name: ${VIRTUAL_MACHINE_NAME}"
echo "virtual machine ip: ${VIRTUAL_MACHINE_IP}"
curl --fail-with-body http://${VIRTUAL_MACHINE_IP}
- name: (UNFURL-MOTIVATION-DEV) Undeploy the application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# Unfurl Artifacts Enterprise
#
###################################################
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Resolve variability
run: |
vintner templates import --template artifacts --path examples/unfurl-artifacts
vintner instances init --instance artifacts --template artifacts
vintner instances resolve --instance artifacts --inputs examples/unfurl-artifacts/tests/enterprise/inputs.yaml
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-artifacts-pruning-elastic-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_credentials: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance artifacts --inputs ${DEPLOYMENT_INPUTS}
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Test application
run: curl --fail-with-body https://shop-dot-stoetzms-387808.ey.r.appspot.com
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Undeploy application
run: vintner instances undeploy --instance artifacts
if: always()
###################################################
#
# Notification
#
###################################################
- name: (NOTIFICATION) Send success notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) succeeded.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: success()
- name: (NOTIFICATION) Send failure notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) failed.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: failure()
- name: (DISCORD) Send cancel notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) cancelled.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: cancelled()