forked from actions/runner
-
-
Notifications
You must be signed in to change notification settings - Fork 17
AZP: Service Connections
ChristopherHX edited this page Jan 30, 2023
·
2 revisions
Requires Runner.Server version 3.11.3
Upload a GitHub Release:
Sample secret file
system.runner.server.ServiceEndpoint.<name>: |-
{
"Url": "https://github.com",
"Type": "Github",
"Authorization": {
"scheme": "Token",
"Parameters": { "AccessToken": "<PAT_TOKEN>" },
}
}
Sample workflow
steps:
# GitHub Release v1
# Create, edit, or delete a GitHub release.
- pwsh: |
echo "hello World" > $(Build.ArtifactStagingDirectory)/MyAsset.txt
- task: GitHubRelease@1
inputs:
gitHubConnection: <name> # string. Required. GitHub connection (OAuth or PAT).
repositoryName: '<owner>/<reponame>' # string. Required. Repository. Default: $(Build.Repository.Name).
action: 'create' # 'create' | 'edit' | 'delete'. Required. Action. Default: create.
target: '<sha>' # string. Required when action = create || action = edit. Target. Default: $(Build.SourceVersion).
tagSource: 'userSpecifiedTag' # 'gitTag' | 'userSpecifiedTag'. Required when action = create. Tag source. Default: gitTag.
#tagPattern: test # string. Optional. Use when tagSource = gitTag. Tag Pattern.
tag: <tag> # string. Required when action = edit || action = delete || tagSource = userSpecifiedTag. Tag.
#title: # string. Optional. Use when action = create || action = edit. Release title.
#releaseNotesSource: 'filePath' # 'filePath' | 'inline'. Optional. Use when action = create || action = edit. Release notes source. Default: filePath.
#releaseNotesFilePath: # string. Optional. Use when releaseNotesSource = filePath. Release notes file path.
#releaseNotesInline: # string. Optional. Use when releaseNotesSource = inline. Release notes.
#assets: '$(Build.ArtifactStagingDirectory)/*' # string. Optional. Use when action = create || action = edit. Assets. Default: $(Build.ArtifactStagingDirectory)/*.
#assetUploadMode: 'delete' # 'delete' | 'replace'. Optional. Use when action = edit. Asset upload mode. Default: delete.
isDraft: 'true' # boolean. Optional. Use when action = create || action = edit. Draft release. Default: false.
#isPreRelease: false # boolean. Optional. Use when action = create || action = edit. Pre-release. Default: false.
addChangeLog: 'false' # boolean. Optional. Use when action = create || action = edit. Add changelog. Default: true.
# Changelog configuration
changeLogCompareToRelease: 'lastFullRelease' # 'lastFullRelease' | 'lastNonDraftRelease' | 'lastNonDraftReleaseByTag'. Required when addChangeLog = true. Compare to. Default: lastFullRelease.
#changeLogCompareToReleaseTag: # string. Required when changeLogCompareToRelease = lastNonDraftReleaseByTag. Release Tag.
changeLogType: 'commitBased' # 'commitBased' | 'issueBased'. Required when addChangeLog = true. Changelog type. Default: commitBased.
#changeLogLabels: '[{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }]' # string. Optional. Use when changeLogType = issueBased. Categories. Default: [{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }].
Download a private GitHub Repository:
Sample secret file
system.runner.server.ServiceEndpoint.<name>: |-
{
"Url": "https://github.com",
"Type": "Github",
"Authorization": {
"scheme": "Token",
"Parameters": { "AccessToken": "<PAT_TOKEN>" },
}
}
system.runner.server.RepositoryResource.self: |
{
"Endpoint": { "Name": "<name>" },
"properties": {
"type": "GitHub",
"url": "https://github.com/<owner>/<reponame>",
"version": "<sha>"
}
}
Sample workflow
steps:
- checkout: self
Download a nuget package from GitHub:
Sample secret file
system.runner.server.ServiceEndpoint.<name>: |-
{
"Url": "https://github.com",
"Type": "Github",
"Authorization": {
"scheme": "Token",
"Parameters": { "AccessToken": "<PAT_TOKEN>" },
}
}
Sample Workflow
steps:
- task: DownloadGitHubNugetPackage@1
inputs:
packageName: <owner>/<packageName>
version: <version>
externalEndpoints: <name>
Sample secret file
system.runner.server.ServiceEndpoint.<name>: |-
{
"Data": {
"host": "<host>"
},
"Authorization": {
"scheme": "SSH",
"Parameters": {
"username": "<username>",
"password": "<password>"
},
}
}
Sample workflow
steps:
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: <name> # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
commands: |
uname -a
ls -a
# string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script path.
#inline: # string. Required when runOptions = inline. Inline Script.
#interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions = inline. Interpreter command. Default: /bin/bash.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
#interactiveSession: false # boolean. Enable interactive session. Default: false.
readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
#interactiveKeyboardAuthentication: false # boolean. Use interactive-keyboard authentication. Default: false.