Compare commits
2 Commits
main
...
5080-m365-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d1fa661bf | ||
|
|
6d2027d6c2 |
83
.github/workflows/ci.yml
vendored
83
.github/workflows/ci.yml
vendored
@ -139,17 +139,28 @@ jobs:
|
|||||||
AZURE_CLIENT_ID_NAME: ${{ needs.SetM365App.outputs.client_id_env }}
|
AZURE_CLIENT_ID_NAME: ${{ needs.SetM365App.outputs.client_id_env }}
|
||||||
AZURE_CLIENT_SECRET_NAME: ${{ needs.SetM365App.outputs.client_secret_env }}
|
AZURE_CLIENT_SECRET_NAME: ${{ needs.SetM365App.outputs.client_secret_env }}
|
||||||
CLIENT_APP_SLOT: ${{ needs.SetM365App.outputs.client_app_slot }}
|
CLIENT_APP_SLOT: ${{ needs.SetM365App.outputs.client_app_slot }}
|
||||||
CORSO_LOG_FILE: ${{ github.workspace }}/src/testlog/run-ci.log
|
CORSO_LOG_FILE: /tmp/corso-trusted-testlog/run-ci.log
|
||||||
LOG_GRAPH_REQUESTS: true
|
LOG_GRAPH_REQUESTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Golang with cache
|
- name: Setup Golang with cache
|
||||||
uses: magnetikonline/action-golang-cache@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: src/go.mod
|
go-version: 1.21
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Setup Golang caches
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-golang-trusted-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-golang-trusted-
|
||||||
|
|
||||||
- run: mkdir testlog
|
- run: mkdir -p /tmp/corso-trusted-testlog
|
||||||
|
|
||||||
# Install gotestfmt
|
# Install gotestfmt
|
||||||
- name: Set up gotestfmt
|
- name: Set up gotestfmt
|
||||||
@ -166,8 +177,8 @@ jobs:
|
|||||||
# run the tests
|
# run the tests
|
||||||
- name: Integration Tests
|
- name: Integration Tests
|
||||||
env:
|
env:
|
||||||
AZURE_CLIENT_ID: ${{ secrets[env.AZURE_CLIENT_ID_NAME] }}
|
AZURE_CLIENT_ID: ${{ secrets[CLIENT_ID] }},${{ secrets[CLIENT_ID_2] }},${{ secrets[CLIENT_ID_3] }},${{ secrets[CLIENT_ID_4] }}
|
||||||
AZURE_CLIENT_SECRET: ${{ secrets[env.AZURE_CLIENT_SECRET_NAME] }}
|
AZURE_CLIENT_SECRET: ${{ secrets[CLIENT_SECRET] }},${{ secrets[CLIENT_SECRET_2] }},${{ secrets[CLIENT_SECRET_3] }},${{ secrets[CLIENT_SECRET_4] }}
|
||||||
AZURE_TENANT_ID: ${{ secrets.TENANT_ID }}
|
AZURE_TENANT_ID: ${{ secrets.TENANT_ID }}
|
||||||
CORSO_CI_TESTS: true
|
CORSO_CI_TESTS: true
|
||||||
CORSO_M365_TEST_USER_ID: ${{ vars.CORSO_M365_TEST_USER_ID }}
|
CORSO_M365_TEST_USER_ID: ${{ vars.CORSO_M365_TEST_USER_ID }}
|
||||||
@ -184,15 +195,15 @@ jobs:
|
|||||||
-p 1 \
|
-p 1 \
|
||||||
-timeout 20m \
|
-timeout 20m \
|
||||||
./... \
|
./... \
|
||||||
2>&1 | tee ./testlog/gotest-ci.log | gotestfmt -hide successful-tests
|
2>&1 | tee /tmp/corso-trusted-testlog/gotest-ci.log | gotestfmt -hide successful-tests
|
||||||
|
|
||||||
# Upload the original go test output as an artifact for later review.
|
# Upload the original go test output as an artifact for later review.
|
||||||
- name: Upload test log
|
- name: Upload test log
|
||||||
if: failure()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ci-test-log
|
name: ci-test-log
|
||||||
path: src/testlog/*
|
path: /tmp/corso-trusted-testlog/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
@ -210,17 +221,28 @@ jobs:
|
|||||||
AZURE_CLIENT_ID_NAME: ${{ needs.SetM365App.outputs.client_id_env }}
|
AZURE_CLIENT_ID_NAME: ${{ needs.SetM365App.outputs.client_id_env }}
|
||||||
AZURE_CLIENT_SECRET_NAME: ${{ needs.SetM365App.outputs.client_secret_env }}
|
AZURE_CLIENT_SECRET_NAME: ${{ needs.SetM365App.outputs.client_secret_env }}
|
||||||
CLIENT_APP_SLOT: ${{ needs.SetM365App.outputs.client_app_slot }}
|
CLIENT_APP_SLOT: ${{ needs.SetM365App.outputs.client_app_slot }}
|
||||||
CORSO_LOG_FILE: ${{ github.workspace }}/src/testlog/run-ci-retention.log
|
CORSO_LOG_FILE: /tmp/corso-retention-testlog/run-ci-retention.log
|
||||||
LOG_GRAPH_REQUESTS: true
|
LOG_GRAPH_REQUESTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Golang with cache
|
- name: Setup Golang with cache
|
||||||
uses: magnetikonline/action-golang-cache@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: src/go.mod
|
go-version: 1.21
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Setup Golang caches
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-golang-retention-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-golang-retention-
|
||||||
|
|
||||||
- run: mkdir testlog
|
- run: mkdir -p /tmp/corso-retention-testlog
|
||||||
|
|
||||||
# Install gotestfmt
|
# Install gotestfmt
|
||||||
- name: Set up gotestfmt
|
- name: Set up gotestfmt
|
||||||
@ -237,8 +259,8 @@ jobs:
|
|||||||
# run the tests
|
# run the tests
|
||||||
- name: Retention Tests
|
- name: Retention Tests
|
||||||
env:
|
env:
|
||||||
AZURE_CLIENT_ID: ${{ secrets[env.AZURE_CLIENT_ID_NAME] }}
|
AZURE_CLIENT_ID: ${{ secrets[CLIENT_ID] }},${{ secrets[CLIENT_ID_2] }},${{ secrets[CLIENT_ID_3] }},${{ secrets[CLIENT_ID_4] }}
|
||||||
AZURE_CLIENT_SECRET: ${{ secrets[env.AZURE_CLIENT_SECRET_NAME] }}
|
AZURE_CLIENT_SECRET: ${{ secrets[CLIENT_SECRET] }},${{ secrets[CLIENT_SECRET_2] }},${{ secrets[CLIENT_SECRET_3] }},${{ secrets[CLIENT_SECRET_4] }}
|
||||||
AZURE_TENANT_ID: ${{ secrets.TENANT_ID }}
|
AZURE_TENANT_ID: ${{ secrets.TENANT_ID }}
|
||||||
CORSO_RETENTION_TESTS: true
|
CORSO_RETENTION_TESTS: true
|
||||||
CORSO_M365_TEST_USER_ID: ${{ vars.CORSO_M365_TEST_USER_ID }}
|
CORSO_M365_TEST_USER_ID: ${{ vars.CORSO_M365_TEST_USER_ID }}
|
||||||
@ -255,15 +277,15 @@ jobs:
|
|||||||
-p 1 \
|
-p 1 \
|
||||||
-timeout 10m \
|
-timeout 10m \
|
||||||
./... \
|
./... \
|
||||||
2>&1 | tee ./testlog/gotest-ci.log | gotestfmt -hide successful-tests
|
2>&1 | tee /tmp/corso-retention-testlog/gotest-ci.log | gotestfmt -hide successful-tests
|
||||||
|
|
||||||
# Upload the original go test output as an artifact for later review.
|
# Upload the original go test output as an artifact for later review.
|
||||||
- name: Upload test log
|
- name: Upload test log
|
||||||
if: failure()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ci-retention-test-log
|
name: ci-retention-test-log
|
||||||
path: src/testlog/*
|
path: /tmp/corso-trusted-testlog/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
@ -277,17 +299,28 @@ jobs:
|
|||||||
run:
|
run:
|
||||||
working-directory: src
|
working-directory: src
|
||||||
env:
|
env:
|
||||||
CORSO_LOG_FILE: ${{ github.workspace }}/src/testlog/run-unit.log
|
CORSO_LOG_FILE: /tmp/corso-unit-testlog/run-unit.log
|
||||||
LOG_GRAPH_REQUESTS: true
|
LOG_GRAPH_REQUESTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Golang with cache
|
- name: Setup Golang with cache
|
||||||
uses: magnetikonline/action-golang-cache@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: src/go.mod
|
go-version: 1.21
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Setup Golang caches
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-golang-unit-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-golang-unit-
|
||||||
|
|
||||||
- run: mkdir testlog
|
- run: mkdir -p /tmp/corso-unit-testlog
|
||||||
|
|
||||||
# Install gotestfmt
|
# Install gotestfmt
|
||||||
- name: Set up gotestfmt
|
- name: Set up gotestfmt
|
||||||
@ -310,15 +343,15 @@ jobs:
|
|||||||
-p 1 \
|
-p 1 \
|
||||||
-timeout 20m \
|
-timeout 20m \
|
||||||
./... \
|
./... \
|
||||||
2>&1 | tee ./testlog/gotest-unit.log | gotestfmt -hide successful-tests
|
2>&1 | tee /tmp/corso-unit-testlog/gotest-unit.log | gotestfmt -hide successful-tests
|
||||||
|
|
||||||
# Upload the original go test output as an artifact for later review.
|
# Upload the original go test output as an artifact for later review.
|
||||||
- name: Upload test log
|
- name: Upload test log
|
||||||
if: failure()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: unit-test-log
|
name: unit-test-log
|
||||||
path: src/testlog/*
|
path: /tmp/corso-unit-testlog/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package credentials
|
package credentials
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
)
|
)
|
||||||
@ -25,6 +27,18 @@ func GetM365() M365 {
|
|||||||
AzureClientID := os.Getenv(AzureClientID)
|
AzureClientID := os.Getenv(AzureClientID)
|
||||||
AzureClientSecret := os.Getenv(AzureClientSecret)
|
AzureClientSecret := os.Getenv(AzureClientSecret)
|
||||||
|
|
||||||
|
randomNumber := rand.Intn(4) + 1
|
||||||
|
|
||||||
|
if strings.Contains(AzureClientID, ",") {
|
||||||
|
AzureClientIDs := strings.Split(AzureClientID, ",")
|
||||||
|
AzureClientID = AzureClientIDs[randomNumber]
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(AzureClientID, ",") {
|
||||||
|
AzureClientSecrets := strings.Split(AzureClientSecret, ",")
|
||||||
|
AzureClientSecret = AzureClientSecrets[randomNumber]
|
||||||
|
}
|
||||||
|
|
||||||
return M365{
|
return M365{
|
||||||
AzureClientID: AzureClientID,
|
AzureClientID: AzureClientID,
|
||||||
AzureClientSecret: AzureClientSecret,
|
AzureClientSecret: AzureClientSecret,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user