diff --git a/.github/actions/acc_test/action.yaml b/.github/actions/acc_test/action.yaml index 857f3e35..23bcd84e 100644 --- a/.github/actions/acc_test/action.yaml +++ b/.github/actions/acc_test/action.yaml @@ -65,20 +65,9 @@ inputs: description: "testfile to run" default: '' - -#outputs: -# random-number: -# description: "Random number" -# value: ${{ steps.random-number-generator.outputs.random-number }} - runs: using: "composite" steps: -# - name: Random Number Generator -# id: random-number-generator -# run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT -# shell: bash - - name: Install needed tools shell: bash run: | diff --git a/.github/actions/notify/action.yaml b/.github/actions/notify/action.yaml new file mode 100644 index 00000000..f260d087 --- /dev/null +++ b/.github/actions/notify/action.yaml @@ -0,0 +1,132 @@ +name: Send notification via Google Chat +description: "Sends a notification to a Google Chat room when a pull request is opened." + +inputs: + webhook_url: + description: "The URL of the Google Chat webhook." + required: true + + title: + description: "The title of the notification." + required: true + default: 'no title provided' + + event_author: + description: "The author of the event." + required: true + default: 'unknown' + + event_title: + description: "The title of the event." + required: true + + event_body: + description: "The body of the event." + required: true + default: 'no body provided' + + event_number: + description: "The number of the event." + required: true + default: 'no number provided' + + event_url: + description: "The url of the event." + required: true + default: 'none' + +runs: + using: "composite" + steps: +# - name: event list +# shell: bash +# run: | +# cat <<'EOF' +# ${{ toJSON(github) }} +# EOF +# +# - name: print env +# shell: bash +# run: | +# env +# exit 1 + + - name: Install prerequisites + shell: bash + run: | + echo "::group::apt install" + set -e + apt update + apt install -y curl jq + echo "::endgroup::" + + - name: Notify via Google Chat Webhook + shell: bash + env: + WEBHOOK: ${{ inputs.webhook_url }} + run: | + set -e + + PAYLOAD=$(jq -n -r \ + --arg header "${{ inputs.title }}" \ + --arg repo "${{ github.repository || '' }}" \ + --arg title "${{ inputs.event_title || 'no event title given' }}" \ + --arg body "${{ inputs.event_body || 'no event body given' }}" \ + --arg author "${{ inputs.event_author || 'no event author given' }}" \ + --arg url "${{ inputs.event_url || github.repositoryUrl || github.server_url }}" \ + '{ "cardsV2": [ { "cardId": "notify-${{ github.run_id }}", "card": { + "header": { + "title": "\($header)", + "subtitle": "Repo: \($repo)", + "imageUrl": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/git.png", + "imageType": "SQUARE" + }, + "sections": [ + { + "header": "\($title)", + "collapsible": false, + "widgets": [ + { + "decoratedText": { + "icon": { + "knownIcon": "PERSON" + }, + "text": "Opened by: \($author)" + } + }, + { + "textParagraph": { + "text": "\($body)", + "maxLines": 2 + } + } + ] + }, + { + "widgets": [ + { + "buttonList": { + "buttons": [ + { + "text": "View Source Event", + "type": "FILLED", + "onClick": { + "openLink": { + "url": "\($url)" + } + } + } + ] + } + } + ] + } + ] + }} ] }') + + curl \ + --fail-with-body \ + -X POST \ + -H 'Content-Type: application/json' \ + "${{ inputs.webhook_url }}" \ + -d "${PAYLOAD}" diff --git a/.github/workflows/notify_pr.yaml b/.github/workflows/notify_pr.yaml new file mode 100644 index 00000000..fd84a220 --- /dev/null +++ b/.github/workflows/notify_pr.yaml @@ -0,0 +1,25 @@ +name: Notify on new PR + +on: + pull_request: + types: + - opened + +jobs: + notify: + name: Notify via Google Chat + runs-on: stackit-docker + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Notify + uses: ./.github/actions/notify + with: + webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }} + title: "New Pull Request" + event_title: "${{ github.event.pull_request.title }}" + event_author: "${{ github.event.pull_request.user.login }}" + event_body: "${{ github.event.pull_request.body || 'No description provided.' }}" + event_number: "${{ github.event.pull_request.number }}" + event_url: "${{ github.event.pull_request.html_url }}" diff --git a/.github/workflows/tf-acc-test.yaml b/.github/workflows/tf-acc-test.yaml index 473ad815..93c7832c 100644 --- a/.github/workflows/tf-acc-test.yaml +++ b/.github/workflows/tf-acc-test.yaml @@ -30,6 +30,17 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Notify + uses: ./.github/actions/notify + with: + webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }} + title: Terraform Acceptance Tests started + event_title: ${{ github.event.type }} + event_author: ${{ github.event.actor.login }} + event_body: 'No event body.' + event_number: ${{ github.event.id }} + event_url: "${{ github.repositoryUrl }}" + - name: Run Test (workflow dispatch) if: ${{ github.event_name == 'workflow_dispatch' }} uses: ./.github/actions/acc_test @@ -59,3 +70,14 @@ jobs: tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }} tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }} tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }} + + - name: Notify + uses: ./.github/actions/notify + with: + webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }} + title: Terraform Acceptance Tests finished + event_title: ${{ github.event.type }} + event_author: ${{ github.event.actor.login }} + event_body: 'No event body.' + event_number: ${{ github.event.id }} + event_url: "${{ github.repositoryUrl }}" diff --git a/stackit/internal/wait/postgresflexalpha/wait.go b/stackit/internal/wait/postgresflexalpha/wait.go index 71877f76..930fe501 100644 --- a/stackit/internal/wait/postgresflexalpha/wait.go +++ b/stackit/internal/wait/postgresflexalpha/wait.go @@ -58,7 +58,7 @@ func CreateInstanceWaitHandler( ) *wait.AsyncActionHandler[v3alpha1api.GetInstanceResponse] { instanceCreated := false var instanceGetResponse *v3alpha1api.GetInstanceResponse - maxWait := time.Minute * 45 + maxWait := time.Minute * 90 startTime := time.Now() extendedTimeout := 0 maxFailedCount := 3