Repository navigation
feat(azuredevops): run a hub on Azure Pipelines - #25
Merged
Merged
Conversation
A hub can live in Azure Repos of Azure DevOps Services and run in Azure Pipelines. hubch detects it (TF_BUILD=True, a TfsGit repository of an organization on dev.azure.com or <org>.visualstudio.com); its fingerprint is dev.azure.com/<repository id>, the GUID lowercase. The hub channel uses the job access token mapped into SYSTEM_ACCESSTOKEN: it reads the default branch, its tip and the project's visibility, and keeps plan's comment as a closed thread, plain Markdown, found by the token's own identity. distribute and doctor need a deployment job to the environment touchmark-distribute and the default branch read by the channel. The write key lives in the variable group touchmark-distribute behind a Branch control check, which a job cannot read: write_isolation platform needs security.reason there, as on Bitbucket. doctor --hub-token reads the hub's pipeline variables, the project's variable groups with their checks and pipeline permissions, and the project's pipeline settings; a key in a pipeline variable fails, a group without a check admitting the default branch alone fails, an open group without Verify branch protection fails, and variables settable at queue time fail. Under TF_BUILD=True everything touchmark prints goes through a writer that breaks every "##vso[", so that no text of a platform or a target becomes a logging command of the agent. Outside CI a hub without providers takes its organization from the origin remote. TestTemplateAzurePipelines plays the template's azure-pipelines.yml without Azure. Docs: a hub on Azure DevOps, CI, security, providers, environment, references, threat model.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A hub can now live in Azure Repos of Azure DevOps Services and run in Azure Pipelines, as a hub on Bitbucket Cloud runs in Bitbucket Pipelines. Built from Microsoft's documentation and tested against stand-ins; nothing here has run on a live organization (the guide lists what a first live run must confirm).
Detection and the hub channel
hubchdetects Azure Pipelines (TF_BUILD=True). Only a build of an Azure Repos repository (Build.Repository.ProviderTfsGit) of Azure DevOps Services (System.CollectionUrion dev.azure.com or<org>.visualstudio.com) has a hub; anything else has no fingerprint, and distribute refuses.dev.azure.com/<repository id>, the GUID lowercase. Repository ids are unique across organizations and survive renames, so it names no organization;--hub-fpandprevious_fingerprintstake it as they take a Bitbucket UUID.System.AccessToken, which the step maps intoSYSTEM_ACCESSTOKEN. No variable names the default branch, so it reads the branch, its tip and the project's visibility (from the repository, else the project) before any guard.plan --commentcreates a closed comment thread, so that a policy requiring resolved comments never waits on it. It is plain Markdown with the link reference definition marker, as on Bitbucket, and touchmark edits only the comment of its own identity (connectionData).Guards and doctor
distributeanddoctorneed a deployment job to the environmenttouchmark-distribute(ENVIRONMENT_NAME) and the default branch read by the channel.touchmark-distribute, kept to the default branch by a Branch control check. A job's token is not known to read checks, sowrite_isolation: platformneedssecurity.reasonthere, like Bitbucket's.doctor --hub-tokenreads the variables of the hub's pipelines, the project's variable groups with the checks and pipeline permissions of each, and the project's pipeline settings. A key in a pipeline variable fails. A key in a group is ok only behind a Branch control check that admits the default branch alone; it warns without Verify branch protection.refs/heads/warns;pipeline-settingsfails while "Limit variables that can be set at queue time" is off (a queue-timeBASH_ENVorDOCKER_HOSTreaches the steps that hold the key) and warns on a job token scope wider than the project.https://dev.azure.com/<org>/…, the SSH form,<org>.visualstudio.com).doctor --hub-tokenpicks the hub's organization the same way whenhub.ymllists several.Output
##vso[…]it finds in a step's output. UnderTF_BUILD=Trueeverything touchmark prints goes through a writer that breaks every##vso[, also one split across writes.Config, tests and docs
System.CollectionUriin CI.setup azure-devopspoints at the manual steps.TestTemplateAzurePipelineschecks the template'sazure-pipelines.ymland its step template without Azure. It plays a pull request, pushes, both schedules and both manual runs, with a small evaluator of the stages' conditions; it runs in CI next toTestTemplatePipelines.