-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using latest BCArtifact instead of hardcoded version (#1743)
<!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> #### Summary <!-- Provide a general summary of your changes --> * Allow the "artifact" setting to use latest available version instead of a hardcoded version * Run stability jobs on all official branches #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes [AB#543528](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/543528)
- Loading branch information
1 parent
9c4f554
commit b656871
Showing
8 changed files
with
108 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
$runParameters | ||
) | ||
|
||
$repository = $runParameters.Repository | ||
$targetBranch = $runParameters.TargetBranch | ||
$workflowName = " CI/CD" | ||
$workflowRunTime = Get-Date -AsUTC | ||
|
||
Write-Host "Running the workflow '$workflowName' on branch $targetBranch" | ||
gh workflow run --repo $repository --ref $targetBranch $workflowName | ||
|
||
# Get the workflow run URL to display in the message | ||
|
||
while((Get-Date -AsUTC) -lt $workflowRunTime.AddMinutes(1)) { | ||
Start-Sleep -Seconds 5 # wait for 5 seconds for the workflow to start | ||
$workflowRun = gh run list --branch $targetBranch --event workflow_dispatch --workflow $workflowName --repo $repository --json createdAt,url --limit 1 | ConvertFrom-Json | ||
|
||
if ($workflowRun -and ($workflowRun.createdAt -gt $workflowRunTime)) { | ||
break | ||
} | ||
} | ||
|
||
|
||
$result = @{ | ||
'Files' = @() | ||
'Message' = "Could not start the '$workflowName' workflow. Please check the workflow status." | ||
} | ||
|
||
if ($workflowRun.createdAt -gt $workflowRunTime) { | ||
$result.Message = "'$workflowName' workflow started: $($workflowRun.url)" | ||
} | ||
|
||
return $result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Submit Stability Job On Official Branches | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 04 * * *" # Run at 04:00 UTC every day | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
GetBranches: | ||
name: Get Official Branches | ||
if: github.repository_owner == 'microsoft' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
officialBranches: ${{ steps.getOfficialBranches.outputs.branchesJson }} | ||
steps: | ||
- name: Get Official Branches | ||
id: getOfficialBranches | ||
uses: microsoft/BCApps/.github/actions/GetGitBranches@main | ||
with: | ||
include: "['releases/*']" | ||
|
||
SubmitStabilityJobs: | ||
name: "[${{ matrix.branch }}] Submit Stability Job" | ||
if: github.repository_owner == 'microsoft' | ||
runs-on: ubuntu-latest | ||
environment: Official-Build | ||
needs: GetBranches | ||
strategy: | ||
matrix: | ||
branch: ${{ fromJson(needs.GetBranches.outputs.officialBranches) }} | ||
fail-fast: false | ||
steps: | ||
- name: Submit Stability Job | ||
env: | ||
GH_TOKEN: ${{ secrets.GHTOKENWORKFLOW }} | ||
uses: microsoft/BCApps/.github/actions/RunAutomation@main | ||
with: | ||
automations: SubmitStabilityJob | ||
targetBranch: ${{ matrix.branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters