Skip to content
1 change: 1 addition & 0 deletions .azure-pipelines/run-test-scheduler-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ steps:
--kvm-build-id $(KVM_BUILD_ID) \
--deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" \
--mgmt-branch ${{ parameters.MGMT_BRANCH }} \
--HEHE
--common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}"

TEST_PLAN_ID=`cat new_test_plan_id.txt`
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/ms_conflict_detect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: MSConflictDetect
on:
pull_request_target:
branches:
- 'master'
- '202[0-9][0-9][0-9]'

jobs:
MSConflictDetect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Debug
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
USER: mssonicbld
PAT: ${{ secrets.GH_PAT }}
TOKEN: ${{ secrets.AZURE_DEVOPS_EXT_PAT }}
run: |
set -e
echo $GITHUB_CONTEXT | jq
git config --global user.email "sonicbld@microsoft.com"
git config --global user.name "Sonic Build Admin"
git remote add ms https://$TOKEN@dev.azure.com/msazure/One/_git/Networking-acs-buildimage
git fetch ms 2>/dev/null

echo ${PAT} | gh auth login --with-token

cd ..
git clone https://$USER:$PAT@github.com/Azure/sonic-pipelines-internal
cd sonic-pipelines-internal
git checkout test
cp azure-pipelines/azdevops_git_api.sh ../
- name: Main
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
AZURE_DEVOPS_EXT_PAT: ${{ secrets.AZURE_DEVOPS_EXT_PAT }}
run: |
set -e
branch_base=$(echo $GITHUB_CONTEXT | jq -r ".base_ref")
pr_id=$(echo $GITHUB_CONTEXT | jq -r ".event.number")

echo PRID: $pr_id
export PAT=$AZURE_DEVOPS_EXT_PAT
. ../azdevops_git_api.sh

# check conflict
[[ $branch_base =~ ^202[0-9]{3}$ ]] && branch_int=internal-$branch_base
[[ $branch_base == master ]] && branch_int=internal
[[ -z "$branch_int" ]] && echo "bypass branch: $branch_base" && exit 0

git branch -D test &>/dev/null || true
git checkout -b test
git branch -D $branch_int &>/dev/null || true
git checkout -b $branch_int --track ms/$branch_int

git merge test && echo "No merge conflicts." && exit 0

PRID=$(listPR sonicbld/conflict_prefix/$pr_id-fix sonicbld/conflict_prefix/$pr_id-base 2>/dev/null | tee tmp | jq -r .value[0].pullRequestId)
echo "PRID: $PRID"
# if no this branch or branch is out of date.
if [[ "$(git log ms/sonicbld/conflict_prefix/$pr_id-base --format=%at -n 1)" < "$(git log test --format=%at -n 1)" ]];then
echo "MS PR is out of date!"
conflict_commit=$(git log $branch_int..HEAD --merge --format=%H)
git merge --abort
git merge $conflict_commit~
git push -f ms $branch_int:sonicbld/conflict_prefix/$pr_id-base

git merge $conflict_commit || true
git add .
GIT_EDITOR=/bin/true git merge --continue
git push -f ms HEAD:sonicbld/conflict_prefix/$pr_id-fix

# no active PR
if [[ "$(cat tmp | jq -r .value[0].status)" != "active" ]];then
echo "No active MS PR found."
echo "sonicbld/conflict_prefix/$pr_id-fix --> sonicbld/conflict_prefix/$pr_id-base"
createPR sonicbld/conflict_prefix/$pr_id-fix sonicbld/conflict_prefix/$pr_id-base "Please approve and complete the PR after resolving conflict!!!" > tmp
PRID=$(cat tmp | jq -r .pullRequestId)
echo "Please resolve conflict and complete:"
echo "https://dev.azure.com/msazure/One/_git/Networking-acs-buildimage/pullrequest/$PRID"
else
echo "Please resolve conflict and complete:"
echo "https://dev.azure.com/msazure/One/_git/Networking-acs-buildimage/pullrequest/$PRID"
fi
exit 1
fi


ts_base=$(git log ms/sonicbld/conflict_prefix/$pr_id-base --format=%at -n 1)
ts_pr=$(git log test --format=%at -n 1)
[[ $ts_base < $ts_pr ]] && echo "PR updated, but conflict resolving PR not updated." && exit 1
[[ "$(cat tmp | jq -r .value[0].status)" != "completed" ]] && echo "Please resolve conflict and complete:" && echo "https://dev.azure.com/msazure/One/_git/Networking-acs-buildimage/pullrequest/$PRID" && exit 1
exit 0

31 changes: 31 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,37 @@ stages:
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
jobGroups:
- name: vs
- job:
condition: eq(variables['Build.Reason'], 'PullRequest')
steps:
- checkout: none
- task: TriggerBuild@4
inputs:
definitionIsInCurrentTeamProject: false
tfsServer: 'https://dev.azure.com/msazure/'
teamProject: 'b32aa71e-8ed2-41b2-9d77-5bc261222004'
buildDefinition: '329541'
queueBuildForUserThatTriggeredBuild: false
ignoreSslCertificateErrors: true
useSameSourceVersion: false
useCustomSourceVersion: false
useSameBranch: false
branchToUse: 'test'
waitForQueuedBuildsToFinish: true
waitForQueuedBuildsToFinishRefreshTime: '60'
failTaskIfBuildsNotSuccessful: true
cancelBuildsIfAnyFails: false
treatPartiallySucceededBuildAsSuccessful: false
downloadBuildArtifacts: false
storeInEnvironmentVariable: false
templateParameters: 'prid: $(System.PullRequest.PullRequestNumber)'
authenticationMethod: 'Personal Access Token'
password: '$(PAT)'
enableBuildInQueueCondition: false
dependentOnSuccessfulBuildCondition: false
dependentOnFailedBuildCondition: false
checkbuildsoncurrentbranch: false
failTaskIfConditionsAreNotFulfilled: false

- stage: Build
pool: sonicbld
Expand Down
1 change: 1 addition & 0 deletions files/image_config/constants/constants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ constants:
deployment_id_asn_map:
"1" : 65432
"2" : 65433
"3" : "HH"
bgp:
traffic_shift_community: 12345:12345
families:
Expand Down