Skip to content

Commit

Permalink
composite
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner committed Jan 6, 2024
1 parent cb75821 commit 2a92c3f
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 93 deletions.
115 changes: 115 additions & 0 deletions .github/actions/prepare-integration-test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: 'Prepare Integration Test Environment'
inputs:
GCP_CREDENTIALS:
required: true

OS_SSH_KEY_FILE:
required: true

OS_APPLICATION_CREDENTIAL_ID:
required: true

OS_APPLICATION_CREDENTIAL_SECRET:
required: true

runs:
using: 'composite'
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: ${{ inputs.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: ${{ inputs.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: ${{ inputs.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ inputs.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

- name: (PREPARE) Install Vintner
run: curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -
101 changes: 8 additions & 93 deletions .github/workflows/night.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,121 +22,40 @@ jobs:
#
###################################################

- name: (PREPARE) Checkout Repository
uses: actions/checkout@v3
- name: (PREPARE) Prepare environment
uses: ./.github/actions/prepare-integration-test
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
- 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
- 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
- name: Abort
run: exit 1
if: always()

###################################################
#
# Unfurl Motivation Production
Expand Down Expand Up @@ -175,10 +94,6 @@ jobs:
run: vintner instances undeploy --instance motivation
if: always()

- name: Abort
run: exit 1
if: always()

###################################################
#
# Vintner
Expand Down

0 comments on commit 2a92c3f

Please sign in to comment.