From 25b546208b25bebcc49d93a3a21b846c42deb939 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Singh Date: Wed, 8 Jul 2020 17:04:00 -0400 Subject: [PATCH 1/2] creating yml file for ctl image build ci --- .../ctl-image-build.yml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml diff --git a/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml new file mode 100644 index 000000000000..b13e31951683 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml @@ -0,0 +1,45 @@ +pool: + name: Azure Pipelines + demands: maven + + timeoutInMinutes: 20 + +#Your build pipeline references a secret variable named ‘ContainerRegistryPwd’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 +variables: + ContainerRegistryName: 'javactl' + ContainerRegistryUserName: 'javactl' + ContainerRegistryUrl: 'javactl.azurecr.io' + +steps: +- task: Maven@3 + displayName: 'Maven pom.xml' + inputs: + options: '-Ppackage-assembly -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl ,com.azure:azure-cosmos,com.azure:azure-cosmos-benchmark' + +- task: CopyFiles@2 + displayName: 'Copy benchmark jar' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/target' + Contents: '*' + TargetFolder: /tmp/ctl + +- task: CopyFiles@2 + displayName: 'Copy docker config files' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/ctl' + TargetFolder: /tmp/ctl + +- powershell: | + # Below will build the image and push it to azure container registry + + cd /tmp/ctl + + docker build . -t java-ctl + + az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(ContainerRegistryPwd) + + docker tag java-ctl $(ContainerRegistryUrl)/javactl/benchmark + + docker push $(ContainerRegistryUrl)/javactl/benchmark + + displayName: 'Build and push image' From 3e9c67b34cc5301c84b206a9342b28b72989bae5 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Wed, 8 Jul 2020 15:29:13 -0700 Subject: [PATCH 2/2] Update ctl-image-build.yml --- .../ctl-image-build.yml | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml index b13e31951683..e49bb7f1634c 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml +++ b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml @@ -1,45 +1,45 @@ -pool: - name: Azure Pipelines - demands: maven +jobs: + - job: Cosmos CTL + timeoutInMinutes: 20 + variables: + - template: /eng/pipelines/templates/variables/globals.yml + pool: + vmImage: 'ubuntu-18.04' - timeoutInMinutes: 20 + # java-cosmos-container-registry-pwd + variables: + ContainerRegistryName: 'javactl' + ContainerRegistryUserName: 'javactl' + ContainerRegistryUrl: 'javactl.azurecr.io' -#Your build pipeline references a secret variable named ‘ContainerRegistryPwd’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 -variables: - ContainerRegistryName: 'javactl' - ContainerRegistryUserName: 'javactl' - ContainerRegistryUrl: 'javactl.azurecr.io' + steps: + - task: Maven@3 + displayName: 'Build Cosmos and Benchmark' + inputs: + mavenPomFile: pom.xml + jdkVersionOption: $(JavaBuildVersion) + jdkArchitectureOption: 'x64' + # The -Ppackage-assembly profile packages up both libraries into one package + options: '$(DefaultOptions) -Ppackage-assembly -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl com.azure:azure-cosmos,com.azure:azure-cosmos-benchmark' -steps: -- task: Maven@3 - displayName: 'Maven pom.xml' - inputs: - options: '-Ppackage-assembly -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl ,com.azure:azure-cosmos,com.azure:azure-cosmos-benchmark' + - task: CopyFiles@2 + displayName: 'Copy benchmark jar' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/target' + Contents: '*' + TargetFolder: $(Agent.TempDirectory)/ctl -- task: CopyFiles@2 - displayName: 'Copy benchmark jar' - inputs: - SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/target' - Contents: '*' - TargetFolder: /tmp/ctl + - task: CopyFiles@2 + displayName: 'Copy docker config files' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/ctl' + TargetFolder: $(Agent.TempDirectory)/ctl -- task: CopyFiles@2 - displayName: 'Copy docker config files' - inputs: - SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/ctl' - TargetFolder: /tmp/ctl - -- powershell: | - # Below will build the image and push it to azure container registry - - cd /tmp/ctl - - docker build . -t java-ctl - - az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(ContainerRegistryPwd) - - docker tag java-ctl $(ContainerRegistryUrl)/javactl/benchmark - - docker push $(ContainerRegistryUrl)/javactl/benchmark - - displayName: 'Build and push image' + # Below will build the image and push it to azure container registry + - pwsh: | + cd $(Agent.TempDirectory)/ctl + docker build . -t java-ctl + az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(java-cosmos-container-registry-pwd) + docker tag java-ctl $(ContainerRegistryUrl)/javactl/benchmark + docker push $(ContainerRegistryUrl)/javactl/benchmark + displayName: 'Build and push docker image to registry'