From 750e86f2143ee83524889ac3cea056d1ef7cac77 Mon Sep 17 00:00:00 2001 From: Wilfried Michel Date: Wed, 13 Nov 2024 14:43:38 +0100 Subject: [PATCH 1/3] Add AppTek hashtest pipeline --- .github/workflows/apptek_hashes.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/apptek_hashes.yml diff --git a/.github/workflows/apptek_hashes.yml b/.github/workflows/apptek_hashes.yml new file mode 100644 index 0000000..48a2ac9 --- /dev/null +++ b/.github/workflows/apptek_hashes.yml @@ -0,0 +1,47 @@ +name: AppTek hashes +env: + api_url: "https://api.bitbucket.org/2.0/repositories/omnifluent/apptek_asr/pipelines/" + auth_token: "-H 'Authorization: Bearer ${{ secrets.APPTEK_BITBUCKET_AUTHENTICATION }}'" + get_header: "-X GET -s -H 'Accept: application/json'" + post_header: "-X POST -s -H 'Content-Type: application/json'" + post_content: '{"target": {"ref_type": "branch", "ref_name": "main", "type": "pipeline_ref_target", "selector": {"type": "custom", "pattern": "hashes+tests_sis"}}, "variables": [{"key": "sisyphus_branch", "value": "' +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + test-hashes: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Start Bitbucket Pipeline + run: | + curl ${{ env.post_header }} ${{ env.auth_token}} ${{ env.api_url }} -d '${{ env.post_content }}'${GITHUB_HEAD_REF:-main}'"}]}' |\ + jq -r '.uuid' | sed 's/{/%7B/' | sed 's/}/%7D/' > pipeline_uuid.txt + - name: Verify Start + run: | + [ $(cat pipeline_uuid.txt) != "null" ] + - name: Wait for Results + run: | + sleep 300 + while [ COMPLETED != $(\ + curl ${{ env.get_header }} ${{ env.auth_token}} ${{ env.api_url }}$(cat pipeline_uuid.txt) |\ + jq -r '.state.name') \ + ]; do sleep 30 ; done + [ SUCCESSFUL == $(\ + curl ${{ env.get_header }} ${{ env.auth_token}} ${{ env.api_url }}$(cat pipeline_uuid.txt) |\ + jq -r '.state.result.name') \ + ] + - name: Report Error + if: failure() + run: | + echo "::error ::The AppTek hashtest pipeline #"$(\ + curl ${{ env.get_header }} ${{ env.auth_token}} ${{ env.api_url }}$(cat pipeline_uuid.txt) |\ + jq -r '.build_number') \ + "failed. Please contact {wmichel,ebeck}@apptek.com to find out why." + exit 1 \ No newline at end of file From a632a8c6bbc5c7f7fb62b8007aad38659f41eeda Mon Sep 17 00:00:00 2001 From: michelwi Date: Thu, 21 Nov 2024 11:29:54 +0100 Subject: [PATCH 2/3] fix branchname --- .github/workflows/apptek_hashes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/apptek_hashes.yml b/.github/workflows/apptek_hashes.yml index 48a2ac9..b6b962c 100644 --- a/.github/workflows/apptek_hashes.yml +++ b/.github/workflows/apptek_hashes.yml @@ -8,10 +8,10 @@ env: on: push: branches: - - main + - master pull_request: branches: - - main + - master jobs: test-hashes: runs-on: ubuntu-latest From 24c6ccaa625a0655c2608308fb132dba769b147e Mon Sep 17 00:00:00 2001 From: michelwi Date: Thu, 21 Nov 2024 11:46:03 +0100 Subject: [PATCH 3/3] fix default value branch name --- .github/workflows/apptek_hashes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/apptek_hashes.yml b/.github/workflows/apptek_hashes.yml index b6b962c..8d2dcf7 100644 --- a/.github/workflows/apptek_hashes.yml +++ b/.github/workflows/apptek_hashes.yml @@ -21,7 +21,7 @@ jobs: python-version: 3.8 - name: Start Bitbucket Pipeline run: | - curl ${{ env.post_header }} ${{ env.auth_token}} ${{ env.api_url }} -d '${{ env.post_content }}'${GITHUB_HEAD_REF:-main}'"}]}' |\ + curl ${{ env.post_header }} ${{ env.auth_token}} ${{ env.api_url }} -d '${{ env.post_content }}'${GITHUB_HEAD_REF:-master}'"}]}' |\ jq -r '.uuid' | sed 's/{/%7B/' | sed 's/}/%7D/' > pipeline_uuid.txt - name: Verify Start run: | @@ -44,4 +44,4 @@ jobs: curl ${{ env.get_header }} ${{ env.auth_token}} ${{ env.api_url }}$(cat pipeline_uuid.txt) |\ jq -r '.build_number') \ "failed. Please contact {wmichel,ebeck}@apptek.com to find out why." - exit 1 \ No newline at end of file + exit 1