67 lines
No EOL
2.2 KiB
YAML
67 lines
No EOL
2.2 KiB
YAML
name: createapp
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
EDGEXR_PLATFORM_USERNAME: ${{ secrets.EDGEXR_PLATFORM_USERNAME }}
|
|
EDGEXR_PLATFORM_PASSWORD: ${{ secrets.EDGEXR_PLATFORM_PASSWORD }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
-
|
|
name: Repository meta
|
|
id: repository
|
|
run: |
|
|
registry=${{ github.server_url }}
|
|
registry=${registry##http*://}
|
|
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
|
echo "registry=${registry}"
|
|
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
|
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
|
echo "repository=${repository}"
|
|
-
|
|
name: Docker meta
|
|
uses: docker/metadata-action@v5
|
|
id: docker
|
|
with:
|
|
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
|
|
-
|
|
name: Install Curl
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y curl jq
|
|
-
|
|
name: Create edgeXR App
|
|
run: |
|
|
set -e
|
|
echo login
|
|
EDGEXR_TOKEN="$(curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/login -H 'Content-Type: application/json' --data '{"password": "'${EDGEXR_PLATFORM_PASSWORD}'","username": "'${EDGEXR_PLATFORM_USERNAME}'"}' -sSf | jq -r .token)"
|
|
|
|
CREATEAPP_JSON=$(cat <<EOF
|
|
{
|
|
"App": {
|
|
"key": {
|
|
"organization": "edp-developer-framework",
|
|
"name": "HelloWorldAuto",
|
|
"version": "1.0"
|
|
},
|
|
"image_path": "edp.buildth.ing/devfw-cicd/fibonacci_pipeline:development",
|
|
"image_type": "Docker",
|
|
"access_ports": "tcp:80",
|
|
"default_flavor": {
|
|
"name": "EU.small"
|
|
},
|
|
"deployment": "docker",
|
|
"required_outbound_connections": null
|
|
},
|
|
"Region": "EU"
|
|
}
|
|
EOF
|
|
)
|
|
|
|
echo create app
|
|
curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/CreateApp -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -Sf --data "$CREATEAPP_JSON" |