From 4a45321788ec685f03e07aa3ca84416bb2b0911d Mon Sep 17 00:00:00 2001 From: Kirill Sizov Date: Wed, 8 Feb 2023 13:41:24 +0200 Subject: [PATCH] Fix Helm tests (#5579) --- .github/workflows/cache.yml | 33 ++++++++------------------------- .github/workflows/full.yml | 26 +------------------------- .github/workflows/helm.yml | 2 +- .github/workflows/main.yml | 28 +--------------------------- .github/workflows/schedule.yml | 30 +----------------------------- 5 files changed, 12 insertions(+), 107 deletions(-) diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 226a7d04..79dc6949 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -5,7 +5,11 @@ on: - 'develop' jobs: + get-sha: + uses: ./.github/workflows/search-cache.yml + Caching_CVAT: + needs: search_cache env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} @@ -13,34 +17,13 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Getting SHA with cache from the default branch - id: get-sha - run: | - DEFAULT_BRANCH=$(gh api /repos/$REPO | jq -r '.default_branch') - for sha in $(gh api "/repos/$REPO/commits?per_page=100&sha=${DEFAULT_BRANCH}" | jq -r '.[].sha'); - do - RUN_status=$(gh api /repos/${REPO}/actions/workflows/cache.yml/runs | \ - jq -r ".workflow_runs[]? | select((.head_sha == \"${sha}\") and (.conclusion == \"success\")) | .status") - - if [[ ${RUN_status} == "completed" ]]; then - SHA=$sha - break - fi - done - - echo Default branch is ${DEFAULT_BRANCH} - echo Workflow will try to get cache from commit: ${SHA} - - echo "default_branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT - echo "sha=${SHA}" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 id: server-cache-action with: path: /tmp/cvat_cache_server key: ${{ runner.os }}-build-server-${{ github.sha }} restore-keys: | - ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }} + ${{ runner.os }}-build-server-${{ needs.get-sha.outputs.sha }} ${{ runner.os }}-build-server- - uses: actions/cache@v3 @@ -49,7 +32,7 @@ jobs: path: /tmp/cvat_cache_ui key: ${{ runner.os }}-build-ui-${{ github.sha }} restore-keys: | - ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }} + ${{ runner.os }}-build-ui-${{ needs.get-sha.outputs.sha }} ${{ runner.os }}-build-ui- - uses: actions/cache@v3 @@ -58,7 +41,7 @@ jobs: path: /tmp/cvat_cache_elasticsearch key: ${{ runner.os }}-build-elasticsearch-${{ github.sha }} restore-keys: | - ${{ runner.os }}-build-elasticsearch-${{ steps.get-sha.outputs.sha }} + ${{ runner.os }}-build-elasticsearch-${{ needs.get-sha.outputs.sha }} ${{ runner.os }}-build-elasticsearch- - uses: actions/cache@v3 @@ -67,7 +50,7 @@ jobs: path: /tmp/cvat_cache_logstash key: ${{ runner.os }}-build-logstash-${{ github.sha }} restore-keys: | - ${{ runner.os }}-build-logstash-${{ steps.get-sha.outputs.sha }} + ${{ runner.os }}-build-logstash-${{ needs.get-sha.outputs.sha }} ${{ runner.os }}-build-logstash- - name: Set up Docker Buildx diff --git a/.github/workflows/full.yml b/.github/workflows/full.yml index 30afdc64..bad9da6e 100644 --- a/.github/workflows/full.yml +++ b/.github/workflows/full.yml @@ -17,31 +17,7 @@ env: jobs: search_cache: - runs-on: ubuntu-latest - outputs: - sha: ${{ steps.get-sha.outputs.sha}} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - steps: - - name: Getting SHA with cache from the default branch - id: get-sha - run: | - DEFAULT_BRANCH=$(gh api /repos/$REPO | jq -r '.default_branch') - for sha in $(gh api "/repos/$REPO/commits?per_page=100&sha=$DEFAULT_BRANCH" | jq -r '.[].sha'); - do - RUN_status=$(gh api /repos/${REPO}/actions/workflows/cache.yml/runs | \ - jq -r ".workflow_runs[]? | select((.head_sha == \"${sha}\") and (.conclusion == \"success\")) | .status") - if [[ ${RUN_status} == "completed" ]]; then - SHA=$sha - break - fi - done - echo Default branch is ${DEFAULT_BRANCH} - echo Workflow will try to get cache from commit: ${SHA} - - echo "default_branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT - echo "sha=${SHA}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/search-cache.yml build: needs: search_cache diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index 2a0f8050..f936e8eb 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -87,4 +87,4 @@ jobs: # They are still tested without Helm run: | kubectl cp tests/mounted_file_share/images $(kubectl get pods -l component=server -o jsonpath='{.items[0].metadata.name}'):/home/django/share - pytest --platform=kube -m "not with_external_services" tests/python + pytest --timeout 30 --platform=kube -m "not with_external_services" tests/python diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d961034..968a0e13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,33 +20,7 @@ jobs: github.event.pull_request.draft == false && !startsWith(github.event.pull_request.title, '[WIP]') && !startsWith(github.event.pull_request.title, '[Dependent]') - runs-on: ubuntu-latest - outputs: - sha: ${{ steps.get-sha.outputs.sha}} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - steps: - - name: Getting SHA with cache from the default branch - id: get-sha - run: | - DEFAULT_BRANCH=$(gh api /repos/$REPO | jq -r '.default_branch') - for sha in $(gh api "/repos/$REPO/commits?per_page=100&sha=$DEFAULT_BRANCH" | jq -r '.[].sha'); - do - RUN_status=$(gh api /repos/${REPO}/actions/workflows/cache.yml/runs | \ - jq -r ".workflow_runs[]? | select((.head_sha == \"${sha}\") and (.conclusion == \"success\")) | .status") - - if [[ ${RUN_status} == "completed" ]]; then - SHA=$sha - break - fi - done - - echo Default branch is ${DEFAULT_BRANCH} - echo Workflow will try to get cache from commit: ${SHA} - - echo "default_branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT - echo "sha=${SHA}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/search-cache.yml build: needs: search_cache diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml index 7a4ee37a..9ecf7333 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -40,35 +40,7 @@ jobs: search_cache: needs: check_updates - if: - needs.check_updates.outputs.last_commit_time > needs.check_updates.outputs.last_night_time - runs-on: ubuntu-latest - outputs: - sha: ${{ steps.get-sha.outputs.sha}} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - steps: - - name: Getting SHA with cache from the default branch - id: get-sha - run: | - DEFAULT_BRANCH=$(gh api /repos/$REPO | jq -r '.default_branch') - for sha in $(gh api "/repos/$REPO/commits?per_page=100&sha=$DEFAULT_BRANCH" | jq -r '.[].sha'); - do - RUN_status=$(gh api /repos/${REPO}/actions/workflows/cache.yml/runs | \ - jq -r ".workflow_runs[]? | select((.head_sha == \"${sha}\") and (.conclusion == \"success\")) | .status") - - if [[ ${RUN_status} == "completed" ]]; then - SHA=$sha - break - fi - done - - echo Default branch is ${DEFAULT_BRANCH} - echo Workflow will try to get cache from commit: ${SHA} - - echo "default_branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT - echo "sha=${SHA}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/search-cache.yml build: needs: search_cache