Add timeouts to CI steps (#4563)

This should help us catch any CI steps that stall. The timeouts should set should be more than enough for most cases and is more than 4x the average time it takes.

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepstimeout-minutes

Quick tasks: 10m
Medium tasks (eg: linting website, code): 30m
Integration tests: 120m

<!-- PR description-->

---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [x] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-10-27 21:49:40 +05:30 committed by GitHub
parent be07a04f66
commit fd887f4d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View File

@ -110,6 +110,7 @@ jobs:
needs: [Precheck, Checkout, SetEnv] needs: [Precheck, Checkout, SetEnv]
environment: Testing environment: Testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.websitefileschanged == 'true' # websitefileschanged also includes srcfileschanged if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.websitefileschanged == 'true' # websitefileschanged also includes srcfileschanged
steps: steps:
@ -128,6 +129,7 @@ jobs:
needs: [Precheck, Checkout, SetM365App] needs: [Precheck, Checkout, SetM365App]
environment: Testing environment: Testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 120
if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || (needs.precheck.outputs.srcfileschanged == 'true' && github.event.pull_request.head.repo.full_name == github.repository) if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || (needs.precheck.outputs.srcfileschanged == 'true' && github.event.pull_request.head.repo.full_name == github.repository)
defaults: defaults:
run: run:
@ -198,6 +200,7 @@ jobs:
needs: [Precheck, Checkout, SetM365App] needs: [Precheck, Checkout, SetM365App]
environment: Testing environment: Testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || (needs.precheck.outputs.srcfileschanged == 'true' && github.event.pull_request.head.repo.full_name == github.repository) if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') || (needs.precheck.outputs.srcfileschanged == 'true' && github.event.pull_request.head.repo.full_name == github.repository)
defaults: defaults:
run: run:
@ -268,6 +271,7 @@ jobs:
needs: [Precheck, Checkout] needs: [Precheck, Checkout]
environment: Testing environment: Testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: needs.precheck.outputs.srcfileschanged == 'true' if: needs.precheck.outputs.srcfileschanged == 'true'
defaults: defaults:
run: run:
@ -445,6 +449,7 @@ jobs:
needs: [Precheck, Checkout] needs: [Precheck, Checkout]
environment: Testing environment: Testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
defaults: defaults:
run: run:

View File

@ -77,6 +77,7 @@ jobs:
git checkout ${{ github.ref }} -- .github git checkout ${{ github.ref }} -- .github
- run: go build -o corso - run: go build -o corso
timeout-minutes: 10
- run: mkdir ${CORSO_LOG_DIR} - run: mkdir ${CORSO_LOG_DIR}
@ -84,6 +85,7 @@ jobs:
# runs haven't been taking long. # runs haven't been taking long.
- name: Configure AWS credentials from Test account - name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v4 uses: aws-actions/configure-aws-credentials@v4
timeout-minutes: 10
with: with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE }} role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
role-session-name: integration-testing role-session-name: integration-testing
@ -93,11 +95,13 @@ jobs:
# Repository commands # Repository commands
- name: Version Test - name: Version Test
timeout-minutes: 10
run: | run: |
./corso --version | grep -c 'Corso version:' ./corso --version | grep -c 'Corso version:'
- name: Repo init test - name: Repo init test
id: repo-init id: repo-init
timeout-minutes: 10
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nRepo init test\n" >> ${{ env.CORSO_LOG_FILE }} echo -e "\nRepo init test\n" >> ${{ env.CORSO_LOG_FILE }}
@ -119,6 +123,7 @@ jobs:
fi fi
- name: Repo connect test - name: Repo connect test
timeout-minutes: 10
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }} echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }}
@ -140,6 +145,7 @@ jobs:
- name: Backup exchange test - name: Backup exchange test
id: exchange-test id: exchange-test
timeout-minutes: 30
run: | run: |
echo -e "\nBackup Exchange test\n" >> ${CORSO_LOG_FILE} echo -e "\nBackup Exchange test\n" >> ${CORSO_LOG_FILE}
./corso backup create exchange \ ./corso backup create exchange \
@ -164,6 +170,7 @@ jobs:
- name: Backup onedrive test - name: Backup onedrive test
id: onedrive-test id: onedrive-test
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nBackup OneDrive test\n" >> ${CORSO_LOG_FILE} echo -e "\nBackup OneDrive test\n" >> ${CORSO_LOG_FILE}
@ -188,6 +195,7 @@ jobs:
# Sharepoint test # Sharepoint test
- name: Backup sharepoint test - name: Backup sharepoint test
id: sharepoint-test id: sharepoint-test
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nBackup SharePoint test\n" >> ${CORSO_LOG_FILE} echo -e "\nBackup SharePoint test\n" >> ${CORSO_LOG_FILE}
@ -213,6 +221,7 @@ jobs:
# Backup Exchange Deletion test # Backup Exchange Deletion test
- name: Backup Delete exchange test - name: Backup Delete exchange test
id: delete-exchange-test id: delete-exchange-test
timeout-minutes: 30
env: env:
SERVICE: "exchange" SERVICE: "exchange"
DELETION_DAYS: 10 DELETION_DAYS: 10
@ -225,6 +234,7 @@ jobs:
# Backup Onedrive Deletion test # Backup Onedrive Deletion test
- name: Backup Delete onedrive test - name: Backup Delete onedrive test
id: delete-onedrive-test id: delete-onedrive-test
timeout-minutes: 30
env: env:
SERVICE: "onedrive" SERVICE: "onedrive"
DELETION_DAYS: 10 DELETION_DAYS: 10
@ -237,6 +247,7 @@ jobs:
# Backup Sharepoint Deletion test # Backup Sharepoint Deletion test
- name: Backup Delete Sharepoint test - name: Backup Delete Sharepoint test
id: delete-sharepoint-test id: delete-sharepoint-test
timeout-minutes: 30
env: env:
SERVICE: "sharepoint" SERVICE: "sharepoint"
DELETION_DAYS: 5 DELETION_DAYS: 5
@ -248,6 +259,7 @@ jobs:
########################################################################## ##########################################################################
# Export OneDrive Test # Export OneDrive Test
- name: OneDrive Export test - name: OneDrive Export test
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\Export OneDrive test\n" >> ${CORSO_LOG_FILE} echo -e "\Export OneDrive test\n" >> ${CORSO_LOG_FILE}
@ -275,6 +287,7 @@ jobs:
########################################################################## ##########################################################################
# Export SharePoint Test # Export SharePoint Test
- name: SharePoint Export test - name: SharePoint Export test
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\Export SharePoint test\n" >> ${CORSO_LOG_FILE} echo -e "\Export SharePoint test\n" >> ${CORSO_LOG_FILE}
@ -303,6 +316,7 @@ jobs:
# Maintenance test # Maintenance test
- name: Maintenance test Daily - name: Maintenance test Daily
id: maintenance-test-daily id: maintenance-test-daily
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\n Maintenance test Daily\n" >> ${CORSO_LOG_FILE} echo -e "\n Maintenance test Daily\n" >> ${CORSO_LOG_FILE}
@ -319,6 +333,7 @@ jobs:
- name: Maintenance test Weekly - name: Maintenance test Weekly
id: maintenance-test-weekly id: maintenance-test-weekly
timeout-minutes: 30
run: | run: |
if [[ $(date +%A) == "Saturday" ]]; then if [[ $(date +%A) == "Saturday" ]]; then
set -euo pipefail set -euo pipefail

View File

@ -57,7 +57,10 @@ jobs:
go-version-file: src/go.mod go-version-file: src/go.mod
- run: go build -o corso - run: go build -o corso
timeout-minutes: 10
- run: go build -o sanity-test ./cmd/sanity_test - run: go build -o sanity-test ./cmd/sanity_test
timeout-minutes: 10
- run: mkdir ${CORSO_LOG_DIR} - run: mkdir ${CORSO_LOG_DIR}
@ -77,6 +80,7 @@ jobs:
echo "NOW=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV echo "NOW=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
- name: Purge CI-Produced Folders for Users - name: Purge CI-Produced Folders for Users
timeout-minutes: 30
uses: ./.github/actions/purge-m365-data uses: ./.github/actions/purge-m365-data
with: with:
user: ${{ env.TEST_USER }} user: ${{ env.TEST_USER }}
@ -89,6 +93,7 @@ jobs:
m365-admin-password: ${{ secrets.M365_TENANT_ADMIN_PASSWORD }} m365-admin-password: ${{ secrets.M365_TENANT_ADMIN_PASSWORD }}
- name: Purge CI-Produced Folders for Sites - name: Purge CI-Produced Folders for Sites
timeout-minutes: 30
if: always() if: always()
uses: ./.github/actions/purge-m365-data uses: ./.github/actions/purge-m365-data
with: with:
@ -107,10 +112,12 @@ jobs:
# Repository commands # Repository commands
- name: Version Test - name: Version Test
timeout-minutes: 10
run: | run: |
./corso --version | grep -c 'Corso version:' ./corso --version | grep -c 'Corso version:'
- name: Repo init test - name: Repo init test
timeout-minutes: 10
id: repo-init id: repo-init
run: | run: |
set -euo pipefail set -euo pipefail
@ -132,6 +139,7 @@ jobs:
echo result="$prefix" >> $GITHUB_OUTPUT echo result="$prefix" >> $GITHUB_OUTPUT
- name: Repo connect test - name: Repo connect test
timeout-minutes: 10
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }} echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }}
@ -151,6 +159,7 @@ jobs:
# Run maintenance on an empty repo just to make sure the command still # Run maintenance on an empty repo just to make sure the command still
# works. # works.
- name: Repo maintenance test - name: Repo maintenance test
timeout-minutes: 30
run: | run: |
set -euo pipefail set -euo pipefail
echo -e "\nRepo maintenance test\n" >> ${{ env.CORSO_LOG_FILE }} echo -e "\nRepo maintenance test\n" >> ${{ env.CORSO_LOG_FILE }}
@ -167,6 +176,7 @@ jobs:
# generate new entries to roll into the next load test # generate new entries to roll into the next load test
# only runs if the test was successful # only runs if the test was successful
- name: Exchange - Create new data - name: Exchange - Create new data
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
go run . exchange emails \ go run . exchange emails \
@ -176,6 +186,7 @@ jobs:
--count 4 --count 4
- name: Exchange - Backup - name: Exchange - Backup
timeout-minutes: 30
id: exchange-backup id: exchange-backup
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
@ -187,6 +198,7 @@ jobs:
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
- name: Exchange - Incremental backup - name: Exchange - Incremental backup
timeout-minutes: 30
id: exchange-backup-incremental id: exchange-backup-incremental
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
@ -199,6 +211,7 @@ jobs:
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
- name: Exchange - Non delta backup - name: Exchange - Non delta backup
timeout-minutes: 30
id: exchange-backup-non-delta id: exchange-backup-non-delta
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
@ -211,6 +224,7 @@ jobs:
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
- name: Exchange - Incremental backup after non-delta - name: Exchange - Incremental backup after non-delta
timeout-minutes: 30
id: exchange-backup-incremental-after-non-delta id: exchange-backup-incremental-after-non-delta
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
@ -230,6 +244,7 @@ jobs:
# generate new entries for test # generate new entries for test
- name: OneDrive - Create new data - name: OneDrive - Create new data
id: new-data-creation-onedrive id: new-data-creation-onedrive
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
suffix=$(date +"%Y-%m-%d_%H-%M-%S") suffix=$(date +"%Y-%m-%d_%H-%M-%S")
@ -245,6 +260,7 @@ jobs:
- name: OneDrive - Backup - name: OneDrive - Backup
id: onedrive-backup id: onedrive-backup
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: onedrive service: onedrive
@ -257,6 +273,7 @@ jobs:
# generate some more enteries for incremental check # generate some more enteries for incremental check
- name: OneDrive - Create new data (for incremental) - name: OneDrive - Create new data (for incremental)
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
go run . onedrive files \ go run . onedrive files \
@ -268,6 +285,7 @@ jobs:
- name: OneDrive - Incremental backup - name: OneDrive - Incremental backup
id: onedrive-incremental id: onedrive-incremental
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: onedrive service: onedrive
@ -285,6 +303,7 @@ jobs:
# generate new entries for test # generate new entries for test
- name: SharePoint - Create new data - name: SharePoint - Create new data
id: new-data-creation-sharepoint id: new-data-creation-sharepoint
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
suffix=$(date +"%Y-%m-%d_%H-%M-%S") suffix=$(date +"%Y-%m-%d_%H-%M-%S")
@ -301,6 +320,7 @@ jobs:
- name: SharePoint - Backup - name: SharePoint - Backup
id: sharepoint-backup id: sharepoint-backup
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: sharepoint service: sharepoint
@ -313,6 +333,7 @@ jobs:
# generate some more enteries for incremental check # generate some more enteries for incremental check
- name: SharePoint - Create new data (for incremental) - name: SharePoint - Create new data (for incremental)
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
go run . sharepoint files \ go run . sharepoint files \
@ -325,6 +346,7 @@ jobs:
- name: SharePoint - Incremental backup - name: SharePoint - Incremental backup
id: sharepoint-incremental id: sharepoint-incremental
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: sharepoint service: sharepoint
@ -342,6 +364,7 @@ jobs:
# generate new entries for test # generate new entries for test
- name: Groups - Create new data - name: Groups - Create new data
id: new-data-creation-groups id: new-data-creation-groups
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
suffix=$(date +"%Y-%m-%d_%H-%M-%S") suffix=$(date +"%Y-%m-%d_%H-%M-%S")
@ -358,6 +381,7 @@ jobs:
- name: Groups - Backup - name: Groups - Backup
id: groups-backup id: groups-backup
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: groups service: groups
@ -369,6 +393,7 @@ jobs:
# generate some more enteries for incremental check # generate some more enteries for incremental check
- name: Groups - Create new data (for incremental) - name: Groups - Create new data (for incremental)
timeout-minutes: 30
working-directory: ./src/cmd/factory working-directory: ./src/cmd/factory
run: | run: |
go run . sharepoint files \ go run . sharepoint files \
@ -381,6 +406,7 @@ jobs:
- name: Groups - Incremental backup - name: Groups - Incremental backup
id: groups-incremental id: groups-incremental
timeout-minutes: 30
uses: ./.github/actions/backup-restore-test uses: ./.github/actions/backup-restore-test
with: with:
service: groups service: groups