diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 728b67d..3d1a205 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -26,9 +26,6 @@ jobs: id: docker with: images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }} - tags: | - type=sha,prefix= - type=ref,event=tag - name: Login to registry uses: docker/login-action@v3 diff --git a/.forgejo/workflows/createapp.yaml b/.forgejo/workflows/createapp.yaml new file mode 100644 index 0000000..beb83a6 --- /dev/null +++ b/.forgejo/workflows/createapp.yaml @@ -0,0 +1,136 @@ +name: createapp + +on: + workflow_dispatch: + inputs: + a_app_region: + type: string + description: "Application Region e.g. EU" + default: EU + required: true + b_app_flavor: + type: string + description: "Application Flavor e.g. EU.small" + default: EU.small + required: true + c_cloudlet: + type: choice + options: + - Amsterdam-OTC + - Hamburg + - Leipzig + - Munich + - Berlin + - Frankfurt + - Magdeburg-OTC + - Bonn + - Magdeburg + - crm-vm-2 + description: "Cloudlet location" + default: Munich + required: true + +env: + EDGEXR_PLATFORM_USERNAME: ${{ secrets.EDGEXR2_PLATFORM_USERNAME }} + EDGEXR_PLATFORM_PASSWORD: ${{ secrets.EDGEXR2_PLATFORM_PASSWORD }} + APP_REGION: ${{ inputs.a_app_region }} + APP_FLAVOR: ${{ inputs.b_app_flavor }} + CLOUDLET: ${{ inputs.c_cloudlet }} + +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 Dependencies + run: | + sudo apt update + sudo apt install -y curl jq + - + name: Create Edge Connect App + run: | + set -e + echo login + EDGEXR_TOKEN="$(curl -X POST https://mc.orca.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 <> "$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 Dependencies + run: | + sudo apt update + sudo apt install -y curl jq + - + name: Delete Edge Connect App Instance + 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)" + + DELETEAPPINSTANCE_JSON=$(cat <