-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for pushing image in registry
- Loading branch information
Showing
13 changed files
with
692 additions
and
125 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 14 additions & 14 deletions
28
Tasks/ContainerBuildV0/Strings/resources.resjson/en-US/resources.resjson
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
{ | ||
"loc.friendlyName": "Container Build", | ||
"loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=851275) or [see the Kubernetes documentation](https://kubernetes.io/docs/home/)", | ||
"loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=2107300)", | ||
"loc.description": "Build Task", | ||
"loc.instanceNameFormat": "Container Build Task", | ||
"loc.group.displayName.containerRepository": "Container Repository", | ||
"loc.group.displayName.commands": "Commands", | ||
"loc.input.label.dockerRegistryServiceConnection": "Docker registry service connection", | ||
"loc.input.help.dockerRegistryServiceConnection": "Select a Docker registry service connection. Required for commands that need to authenticate with a registry.", | ||
"loc.input.help.dockerRegistryServiceConnection": "Select a Docker registry service connection.", | ||
"loc.input.label.repository": "Container repository", | ||
"loc.input.help.repository": "Name of the repository.", | ||
"loc.input.help.repository": "Name of the repository within the container registry.", | ||
"loc.input.label.Dockerfile": "Dockerfile", | ||
"loc.input.help.Dockerfile": "Path to the Dockerfile.", | ||
"loc.input.help.Dockerfile": "Path to Dockerfile.", | ||
"loc.input.label.buildContext": "Build context", | ||
"loc.input.help.buildContext": "Path to the Build context.", | ||
"loc.input.help.buildContext": "Path to Build context.", | ||
"loc.input.label.tags": "Tags", | ||
"loc.input.help.tags": "A list of tags in separate lines. These tags are used in build, push and buildAndPush commands. Ex:<br><br>beta1.1<br>latest", | ||
"loc.input.help.tags": "A list of tags in separate lines. Tags are used while building and pushing the image to container registry.", | ||
"loc.input.label.arguments": "Arguments", | ||
"loc.input.help.arguments": "Docker command options. Ex:<br> For build command,<br>--build-arg HTTP_PROXY=http://10.20.30.2:1234 --quiet", | ||
"loc.input.label.addPipelineData": "Add Pipeline metadata to image(s)", | ||
"loc.input.help.addPipelineData": "By default pipeline data like source branch name, build id are added which helps with traceability. For example you can inspect an image to find out which pipeline built the image. You can opt out of this default behavior by using this input.", | ||
"loc.messages.NotAValidSemverVersion": "Version not specified in correct format. E.g: 1.8.2, v1.8.2, 2.8.2, v2.8.2.", | ||
"loc.messages.VerifyBuildctlInstallation": "Verifying Buildctl installation...", | ||
"loc.input.help.arguments": "Arguments used while building the image.", | ||
"loc.input.label.addPipelineMetadata": "Add Pipeline metadata to image(s)", | ||
"loc.input.help.addPipelineMetadata": "By default pipeline data like source branch name, build id are added which helps with traceability. For example you can inspect an image to find out which pipeline built the image. You can opt out of this default behavior by using this input.", | ||
"loc.messages.ContainerPatternNotFound": "No pattern found in Docker filepath parameter", | ||
"loc.messages.BuildctlLatestNotKnown": "Cannot get the latest Buildctl info from %s. Error %s. Using default Buildctl version %s.", | ||
"loc.messages.BuildctlDownloadFailed": "Failed to download Buildctl from location %s. Error %s", | ||
"loc.messages.BuildctlNotFoundInFolder": "Buildctl executable not found in path %s" | ||
"loc.messages.BuildctlNotFoundInFolder": "Buildctl executable not found in path %s", | ||
"loc.messages.FileContentSynced": "Synced the file content to the disk. The content is %s.", | ||
"loc.messages.VerifyBuildctlInstallation": "Verifying Buildctl installation...", | ||
"loc.messages.WritingDockerConfigToTempFile": "Writing Docker config to temp file. File path: %s, Docker config: %s" | ||
} |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
|
||
import tl = require('azure-pipelines-task-lib/task'); | ||
import path = require('path'); | ||
import docker = require("./docker"); | ||
import buildctl = require("./buildctl"); | ||
|
||
tl.setResourcePath(path.join(__dirname, '..', 'task.json')); | ||
|
||
async function buildContainer() { | ||
if(process.env["RUNNING_ON"] == "KUBERNETES") { | ||
tl.debug("Building image using buildctl"); | ||
buildctl.buildctlBuildAndPush(); | ||
} | ||
else { | ||
tl.debug("Building image using docker"); | ||
docker.dockerBuildAndPush(); | ||
} | ||
} | ||
|
||
buildContainer() | ||
.then(() => { | ||
tl.setResult(tl.TaskResult.Succeeded, ""); | ||
}).catch((error) => { | ||
tl.setResult(tl.TaskResult.Failed, error) | ||
}); |
Oops, something went wrong.