feat: add deleteapp pipeline
This commit is contained in:
parent
c69b2407e9
commit
ade331b1b2
1 changed files with 67 additions and 0 deletions
|
|
@ -0,0 +1,67 @@
|
|||
name: deleteapp
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
a_app_region:
|
||||
type: string
|
||||
description: "Application Region e.g. EU"
|
||||
default: EU
|
||||
|
||||
env:
|
||||
EDGEXR_PLATFORM_USERNAME: ${{ secrets.EDGEXR_PLATFORM_USERNAME }}
|
||||
EDGEXR_PLATFORM_PASSWORD: ${{ secrets.EDGEXR_PLATFORM_PASSWORD }}
|
||||
APP_REGION: ${{ inputs.a_app_region }}
|
||||
|
||||
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: Delete 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": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')",
|
||||
"version": "${{ steps.docker.outputs.version }}"
|
||||
}
|
||||
},
|
||||
"Region": "${APP_REGION}"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $CREATEAPP_JSON
|
||||
|
||||
echo create app
|
||||
curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/DeleteApp -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -S --data "$CREATEAPP_JSON" --fail-with-body
|
||||
Loading…
Add table
Add a link
Reference in a new issue