Skip to content

Commit

Permalink
build docker ci (#5589)
Browse files Browse the repository at this point in the history
* docker ci

* docker ci

* docker ci

* docker ci
  • Loading branch information
dw511214992 authored Mar 1, 2023
1 parent 7d92b7b commit 6e2620f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
69 changes: 69 additions & 0 deletions tools/sdk-generation-pipeline/build-publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
trigger: none

pr: none

parameters:
- name: dockerImage
displayName: Docker Image
type: string
default: sdkgeneration.azurecr.io/sdk-generation:beta-1.0
- name: dockerContainerRegistry
displayName: Docker Container Registry
type: string
default: sdkgeneration.azurecr.io

variables:
- template: ../../eng/pipelines/templates/variables/globals.yml
- name: NodeVersion
value: '16.x'
- name: VAR_ARTIFACT_NAME
value: 'packages'
- name: VAR_DOCKER_IMAGE_ARTIFACT_NAME
value: 'dockerImages'
- name: VAR_BUILD_ARTIFACT_STAGING_DIRECTORY
value: $(Build.ArtifactStagingDirectory)

pool:
name: "azsdk-pool-mms-ubuntu-2004-general"
vmImage: "MMSUbuntu20.04"

stages:
- stage: Build
jobs:
- job: Build
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Install Node.js'

- bash: |
npm install -g @microsoft/rush
npm install -g [email protected]
displayName: 'Install dependencies'
- script: |
rush update
displayName: 'rush update'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/sdk-generation-pipeline
- script: |
rush build
displayName: 'rush build'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/sdk-generation-pipeline
- script: |
rushx pack
displayName: 'Pack @azure-tools/sdk-generation-cli'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/sdk-generation-pipeline/packages/sdk-generation-cli
- script: |
docker build -t ${{ parameters.dockerImage }} .
displayName: 'Build docker image'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/sdk-generation-pipeline
- script: |
docker login -u $(DockerUserName) -p $(DockerPassword) ${{ parameters.dockerContainerRegistry }}
docker push ${{ parameters.dockerImage }}
displayName: 'Publish docker image'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/sdk-generation-pipeline
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
If you want to rebuild the docker image, you only can do it in your local. It's suggested to create a release pipeline to build it. (Previously we find that sometimes it will be timeout because the pipeline costs much time in building and pushing docker image, but now the agent pool should be very fast.)

## Rebuild docker In Local
Steps to rebuild the docker image:
1. `cd tools/sdk-generation-pipeline`
2. `rush update`
Expand All @@ -8,3 +7,6 @@ Steps to rebuild the docker image:
5. `rushx pack`
6. `cd ../.. # go to tools/sdk-generation-pipeline`
7. `docker build -t sdkgeneration.azurecr.io/sdk-generation:beta-1.0 .`
7. `docker push sdkgeneration.azurecr.io/sdk-generation:beta-1.0`
## Rebuild docker In Pipeline
https://dev.azure.com/azure-sdk/internal/_build?definitionId=5980

0 comments on commit 6e2620f

Please sign in to comment.