Removed registry deployment from taskruns (#309)
* Add simple examples for docker build on existing registry Signed-off-by: Sajay Antony <sajaya@microsoft.com> * Moved to tasks2 * move tasks * Adding to doc Signed-off-by: Sajay Antony <sajaya@microsoft.com>
This commit is contained in:
Родитель
6dd2a29fbc
Коммит
968c1344ba
|
@ -28,7 +28,7 @@ module.exports = {
|
|||
{
|
||||
title: 'Tasks',
|
||||
collapsible: true,
|
||||
children: ['/tasks/container-registry-tasks-overview']
|
||||
children: ['/tasks/container-registry-tasks-overview', '/tasks/run-as-deployment/']
|
||||
},
|
||||
{
|
||||
title: 'Authentication',
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: Deploy with ARM templates
|
||||
---
|
||||
|
||||
# Running ACR Tasks as a deployment
|
||||
|
||||
The following set of samples show how to use an ARM template to execute various Task workflows.
|
||||
|
||||
1. [Deploy a docker build on an existing registry](https://github.com/azure/acr/tasks/run-as-deployment/quickdockerbuild-on-existing-registry)
|
||||
1. [Create a Registry and perform a docker build from a GitHub repository](https://github.com/azure/acr/tasks/run-as-deployment/quickdockerbuild)
|
||||
1. [Create a Registry and perform a docker build from a GitHub repository with a Managed Identity](https://github.com/azure/acr/tasks/run-as-deployment/quickdockerbuild)
|
||||
1. [Create a registry and schedule a quick task with task definition as an argument](https://github.com/azure/acr/tasks/run-as-deployment/quickrun)
|
||||
1. [Create a registry and schedule a predefined task](https://github.com/azure/acr/tasks/run-as-deployment/taskrun)
|
|
@ -0,0 +1,22 @@
|
|||
# Quick docker build on an existing registry
|
||||
|
||||
The sample shows how to schedule a deployment which will perform a quick docker build on an existing registry from a source located in a GitHub repository. The tag of the image is derived from the `taskRunName` provided during deployment.
|
||||
|
||||
## Deploy the Task
|
||||
|
||||
```bash
|
||||
registry=$(az group deployment create \
|
||||
-g mytaskrunrg \
|
||||
--template-file azuredeploy.json \
|
||||
--parameters azuredeploy.parameters.json \
|
||||
--parameters taskRunName=mytaskrunwithidentity \
|
||||
--query 'properties.outputs.registry.value' \
|
||||
-o tsv)
|
||||
```
|
||||
##
|
||||
|
||||
```bash
|
||||
export registry=mytaskrunregistry
|
||||
export repository=helloworld-node
|
||||
az acr repository show-tags -n $registry --repository $repository --detail -o table
|
||||
```
|
|
@ -0,0 +1,104 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().location]",
|
||||
"metadata": {
|
||||
"description": "Location for all resources."
|
||||
}
|
||||
},
|
||||
"registryName": {
|
||||
"type": "string",
|
||||
"minLength": 5,
|
||||
"maxLength": 50,
|
||||
"metadata": {
|
||||
"description": "Name of your Azure Container Registry"
|
||||
}
|
||||
},
|
||||
"taskRunName": {
|
||||
"type": "string",
|
||||
"minLength": 5,
|
||||
"maxLength": 50,
|
||||
"metadata": {
|
||||
"description": "Name of your Task Run and tag generated"
|
||||
}
|
||||
},
|
||||
"userAssignedIdentity": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The user assigned identity to be bound to the task run"
|
||||
},
|
||||
"defaultValue": ""
|
||||
},
|
||||
"sourceLocation": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The location of the source to build the image"
|
||||
}
|
||||
},
|
||||
"dockerFilePath": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The relative path of the dockerfile in the source location"
|
||||
},
|
||||
"defaultValue": "Dockerfile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Repository name for the the build output"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"tag": "parameters('taskRunName')",
|
||||
"imageName": "[concat(parameters('repository'), ':', parameters('taskRunName'))]",
|
||||
"identity": {
|
||||
"type": "UserAssigned",
|
||||
"userAssignedIdentities": {
|
||||
"[parameters('userAssignedIdentity')]": {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.ContainerRegistry/registries/taskRuns",
|
||||
"apiVersion": "2019-06-01-preview",
|
||||
"name": "[concat(parameters('registryName'), '/', parameters('taskRunName'))]",
|
||||
"location": "[parameters('location')]",
|
||||
"identity": "[if(not(empty(parameters('userAssignedIdentity'))), variables('identity'), '')]",
|
||||
"properties": {
|
||||
"runRequest": {
|
||||
"type": "DockerBuildRequest",
|
||||
"dockerFilePath": "[parameters('dockerFilePath')]",
|
||||
"imageNames": [
|
||||
"[variables('imageName')]"
|
||||
],
|
||||
"sourceLocation": "[parameters('sourceLocation')]",
|
||||
"isPushEnabled": true,
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
"architecture": "amd64"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"registry": {
|
||||
"type": "string",
|
||||
"value": "[parameters('registryName')]"
|
||||
},
|
||||
"repository": {
|
||||
"type": "string",
|
||||
"value": "[parameters('repository')]"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"value": "[variables('tag')]"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"registryName": {
|
||||
"value": "mytaskrunregistry"
|
||||
},
|
||||
"taskRunName": {
|
||||
"value": "myquickdockerbuildrun"
|
||||
},
|
||||
"repository": {
|
||||
"value": "helloworld-node"
|
||||
},
|
||||
"sourceLocation": {
|
||||
"value": "https://github.com/Azure-Samples/acr-build-helloworld-node.git"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
|
@ -41,7 +41,7 @@
|
|||
"minLength": 5,
|
||||
"maxLength": 50,
|
||||
"metadata": {
|
||||
"description": "Name of your Task Run"
|
||||
"description": "Name of your Task Run and tag generated"
|
||||
}
|
||||
},
|
||||
"userAssignedIdentity": {
|
||||
|
@ -63,19 +63,26 @@
|
|||
"description": "The relative path of the dockerfile in the source location"
|
||||
},
|
||||
"defaultValue": "Dockerfile"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"repository": "hello-world-node",
|
||||
"tag": "parameters('taskRunName')",
|
||||
"imageName": "[concat(variables('repository'), ':', parameters('taskRunName'))]",
|
||||
"identity": {
|
||||
"type": "UserAssigned",
|
||||
"userAssignedIdentities": {
|
||||
"[parameters('userAssignedIdentity')]": {}
|
||||
},
|
||||
"repository": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Repository name for the the build output"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"tag": "parameters('taskRunName')",
|
||||
"imageName": "[concat(parameters('repository'), ':', parameters('taskRunName'))]",
|
||||
"identity": {
|
||||
"type": "UserAssigned",
|
||||
"userAssignedIdentities": {
|
||||
"[parameters('userAssignedIdentity')]": {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.ContainerRegistry/registries",
|
||||
|
@ -130,7 +137,7 @@
|
|||
},
|
||||
"repository": {
|
||||
"type": "string",
|
||||
"value": "[variables('repository')]"
|
||||
"value": "[parameters('repository')]"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"registryName": {
|
||||
"value": "mytaskrunregistry"
|
||||
},
|
||||
"taskRunName": {
|
||||
"value": "myquickdockerbuildrun"
|
||||
},
|
||||
"sourceLocation": {
|
||||
"value": "https://github.com/Azure-Samples/acr-build-helloworld-node.git"
|
||||
}
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"registryName": {
|
||||
"value": "mytaskrunregistry"
|
||||
},
|
||||
"taskRunName": {
|
||||
"value": "myquickdockerbuildrun"
|
||||
},
|
||||
"repository": {
|
||||
"value": "helloworld-node"
|
||||
},
|
||||
"sourceLocation": {
|
||||
"value": "https://github.com/Azure-Samples/acr-build-helloworld-node.git"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче