From 1917eb1421a7c449f0c980ee5f70d5103db35e89 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Thu, 15 Dec 2022 14:33:36 -0800 Subject: [PATCH 1/4] Add pipeline to mirror branches between repos Typo Formatting Template expression formatting Remove job name try simpler case for debugging Try different formatting Try different formatting Formatting and hosted images More debugging, print json Why are old variable names in my output add back mirroring scripts incorrect job and branch names fix working directory fully specify git directory debug pat in url use correct variable for url debug url once again no at sign in github urls fix sed pattern use pat git push typo try tagging add git config name and email combine scripts in case we fail early Try follow tags Try it on the real thing production ready pool and branches --- eng/security-partners-dotnet-mirror.yml | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 eng/security-partners-dotnet-mirror.yml diff --git a/eng/security-partners-dotnet-mirror.yml b/eng/security-partners-dotnet-mirror.yml new file mode 100644 index 0000000000..ef46729c1e --- /dev/null +++ b/eng/security-partners-dotnet-mirror.yml @@ -0,0 +1,69 @@ +trigger: none +pr: none + +pool: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals 1es-ubuntu-2004 + +parameters: + - name: mirrors + type: object + default: + - sourceUrl: https://dnceng@dev.azure.com/dnceng/internal/_git/security-partners-dotnet + destinationUrl: https://dotnet-security-partners@dev.azure.com/dotnet-security-partners/dotnet/_git/dotnet + branches: + - name: release/6.0.1xx + sdkVersion: 6.0.1xx + - name: release/7.0.1xx + sdkVersion: 7.0.1xx + +variables: +- group: DotNet-Source-Build-All-Orgs-Source-Access +- name: RepoDir + value: 'vmr' +- name: GitUser + value: 'dn-bot' +- name: GitEmail + value: 'dn-bot@microsoft.com' + +jobs: +- ${{ each mirror in parameters.mirrors }}: + - job: + steps: + - checkout: none + + - script: | + set -euo pipefail + + repo_dir=$(Pipeline.Workspace)/$(RepoDir) + git init "${repo_dir}" + cd "${repo_dir}" + + git config --global user.name "${{ variables.GitUser }}" + git config --global user.email "${{ variables.GitEmail }}" + + source_url=$(echo "${{ mirror.sourceUrl }}" | sed "s,https://.*@,https://${{ variables.GitUser }}:${AZDO_PAT}@,g") + destination_url=$(echo "${{ mirror.destinationUrl }}" | sed "s,https://.*@,https://${{ variables.GitUser }}:${AZDO_PAT}@,g") + + git remote add source "${source_url}" + git remote add destination "${destination_url}" + displayName: Setup Git Repo + env: + AZDO_PAT: $(dn-bot-all-orgs-build-rw-code-rw) + + - ${{ each branch in mirror.branches }}: + - script: | + set -euxo pipefail + + git fetch source "${{ branch.name }}" + git checkout "${{ branch.name }}" + + tag_name="v${{ branch.sdkVersion }}-SDK" + message=".NET Source-build ${{ branch.sdkVersion }}-SDK" + git tag "${tag_name}" HEAD -m "${message}" + + git fetch destination "${{ branch.name }}" + + git push --follow-tags destination "${{ branch.name }}" + workingDirectory: $(Pipeline.Workspace)/$(RepoDir) + displayName: Mirror and tag ${{ branch.sdkVersion }} From be0cb75373509db4d3b470ea500f4338fb0fa679 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Fri, 16 Dec 2022 12:06:10 -0800 Subject: [PATCH 2/4] Rename new pipeline --- ...partners-dotnet-mirror.yml => source-build-release-mirror.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename eng/{security-partners-dotnet-mirror.yml => source-build-release-mirror.yml} (100%) diff --git a/eng/security-partners-dotnet-mirror.yml b/eng/source-build-release-mirror.yml similarity index 100% rename from eng/security-partners-dotnet-mirror.yml rename to eng/source-build-release-mirror.yml From ee1d4df9c964b2fea31670fb57d75f542cd7cba5 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Fri, 16 Dec 2022 16:33:41 -0800 Subject: [PATCH 3/4] Update doc --- .../releases/release_checklist.md | 42 ++++++++++--------- eng/source-build-release-mirror.yml | 4 +- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/releases/release_checklist.md b/.github/ISSUE_TEMPLATE/releases/release_checklist.md index 703bd1053f..42cd2ae349 100644 --- a/.github/ISSUE_TEMPLATE/releases/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/releases/release_checklist.md @@ -1,5 +1,5 @@