Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize naming of common pipeline-related artifacts #3088

Merged
merged 4 commits into from
Oct 1, 2021

Conversation

mthalman
Copy link
Member

@mthalman mthalman commented Aug 30, 2021

The common infrastructure located in the eng/common folder had names of projects, repositories, variables, branches, and paths that were specific to the .NET implementation. In order to make the infrastructure suitable for general purpose, these names need to be generalized.

  • Defined parameters for internal/public AzDO project names.
  • Defined parameters for a reference to the internal/public pipeline repository resource. This allows the pipeline implementer to be able to declare their own repository resource that represents a versions repo and pass in its identifying name as a parameter to the build-test-publish-repo.yml template.
  • Replace all usages of variables derived from secrets of the .NET key vault with generalized names (e.g. app-dotnetdockerbuild-client-secret => acr.servicePrincipalPassword).
  • Defined a new officialRepoPrefix so that the pipeline logic can know whether a given publishRepoPrefix value represents an official repo location.
  • Defined a new azdoVersionsRepoInfo.path and gitHubVersionsRepoInfo.path variable to provide a way to specify the directory path where image info files are located in those respective repos.
  • Added parameters allowing pipeline implementers to inject custom init steps and custom publish variables in order to customize the logic in the build and publish stages. Specifically, this allows .NET to customize the publicSourceBranch and additionalPublishMcrDogsArgs variables and reference a .NET-specific variable group in the publish stage.
  • Create a new build-test-publish-repo.yml in the eng/pipelines/stages folder (outside of common) to act as a wrapper around the same-named template in the common folder. This allows for a shared implementation of many of the common settings that are used amongst the .NET pipelines.

Related to dotnet/docker-tools#843

@dagood
Copy link
Member

dagood commented Aug 30, 2021

Related to #843

Meant to be a link to dotnet/docker-tools#843 (vs. dotnet/dotnet-docker#843)?

Is this PR in the right repo to change the common files? It does make sense to test the results in this repo though.

@mthalman
Copy link
Member Author

Related to #843

Meant to be a link to dotnet/docker-tools#843 (vs. dotnet/dotnet-docker#843)?

Is this PR in the right repo to change the common files? It does make sense to test the results in this repo though.

Yes, thanks. I've fixed the link. I'm making these changes in the nightly branch here because I feel it gives better context to the changes to see what changes are necessary to the consuming pipelines which aren't in the docker-tools repo.

Copy link
Member

@dagood dagood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't dug through the entire thing, but the bits being pulled out make sense to me. A few suggestions.

- name: acr.servicePrincipalPassword
value: $(app-dotnetdockerbuild-client-secret)
- name: acr.password
value: $(BotAccount-dotnet-docker-acr-bot-password)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems kind of questionable to me to manually maintain this file in each .NET repo--would it make sense to add a common dotnet configuration template that repos can opt into? (Also for publicProjectName / internalProjectName.)

eng/pipelines/dotnet-core-size-validation.yml Outdated Show resolved Hide resolved
@mthalman
Copy link
Member Author

One thing not being addressed in this PR is the usage of DotNet in the names for agent pools. Fixing that will require more changes than I wanted to mix in here.

@mthalman mthalman requested a review from dagood August 31, 2021 19:05
Comment on lines -66 to +73
if ($env:SYSTEM_TEAMPROJECT -eq "internal") {
$imageBuilderBuildArgs = "$imageBuilderBuildArgs --registry-override $(acr.server) --repo-prefix $(stagingRepoPrefix) --source-repo-prefix $(mirrorRepoPrefix) --push --registry-creds ""$(acr.server)=$(acr.userName);$(BotAccount-dotnet-docker-acr-bot-password)"""
if ($env:SYSTEM_TEAMPROJECT -eq "${{ parameters.internalProjectName }}") {
$imageBuilderBuildArgs = "$imageBuilderBuildArgs --registry-override $(acr.server) --repo-prefix $(stagingRepoPrefix) --source-repo-prefix $(mirrorRepoPrefix) --push --registry-creds ""$(acr.server)=$(acr.userName);$(acr.password)"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fixes dotnet/docker-tools#835 too. (Well, sort of: it opens up a workaround-seeming fix that looks good enough to me!) For an internal build that I want to prevent from pushing tags to my ACR (like a PR validation build), I can make the pipeline file leave internalProjectName as null, so this never evaluates to true. 👍

Comment on lines +6 to +11
if ("$(System.TeamProject)" -eq "$(publicProjectName)") {
$basePath = "$(gitHubVersionsRepoInfo.path)"
}
else {
$publicSourceBranch = "main"
$basePath= "$(azdoVersionsRepoInfo.path)"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the file again, is this saying that internal builds can only publish image info to the AzDO/internal repo? Don't we want to publish it to the public dotnet/versions repo, as long as we aren't doing a truly private build? (We can't publish anywhere at all in public-project builds, right?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template sets the variable for the purposes of reading the image info file. It's not relevant to the publishing of the image info file. For publish, it publishes to both the public and internal repos. It pushes the commit to both to avoid latency issues (see dotnet/docker-tools#642). For public project builds, it runs with the dry-run option, so nothing actually gets published.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mthalman mthalman merged commit 81fe9d7 into dotnet:nightly Oct 1, 2021
@mthalman mthalman deleted the dt-issue843 branch October 1, 2021 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants