From 952a25164e527cf893d065b8a0e6022564ed6ccc Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Fri, 30 Jul 2021 16:48:37 +0100 Subject: [PATCH 1/6] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..34edff5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,22 @@ +# Maven +# Build your Java project and run tests with Apache Maven. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- master + +pool: + vmImage: ubuntu-latest + +steps: +- task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'package' From ff67f7abb5148552ca1203bd2e717418c68c1a9c Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Tue, 3 Aug 2021 14:46:53 +0100 Subject: [PATCH 2/6] Set missing url property, use mariadb etc --- azure-pipelines.yml | 48 +++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 34edff5..490ed10 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,20 +3,44 @@ # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/java +variables: # pipeline-level + MYSQL_ROOT_PASSWORD: mysql_root_pwd + trigger: - master +resources: + containers: + - container: mariadb + image: mariadb:10.5 + env: + MYSQL_DATABASE: ispybtest + MYSQL_ROOT_PASSWORD: $(MYSQL_ROOT_PASSWORD) + ports: + - 3306:3306 + pool: - vmImage: ubuntu-latest + vmImage: ubuntu-20.04 -steps: -- task: Maven@3 - inputs: - mavenPomFile: 'pom.xml' - mavenOptions: '-Xmx3072m' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.8' - jdkArchitectureOption: 'x64' - publishJUnitResults: true - testResultsFiles: '**/surefire-reports/TEST-*.xml' - goals: 'package' +stages: +- stage: build + displayName: Build + dependsOn: + jobs: + - job: build + displayName: build package + pool: + vmImage: ubuntu-20.04 + services: + db: mariadb + steps: + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m -Dispyb.url="jdbc:mariadb://localhost:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=localhost' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'package' From 11249d2447088cc809cba2c24867627905c61a50 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Tue, 3 Aug 2021 15:04:08 +0100 Subject: [PATCH 3/6] Move cmd-line options to options tag --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 490ed10..40c8f66 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,7 +37,8 @@ stages: - task: Maven@3 inputs: mavenPomFile: 'pom.xml' - mavenOptions: '-Xmx3072m -Dispyb.url="jdbc:mariadb://localhost:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=localhost' + mavenOptions: '-Xmx3072m' + options: '-Dispyb.url="jdbc:mariadb://localhost:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=localhost' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.8' jdkArchitectureOption: 'x64' From 15dd2f24a62090d5402679b09a767e4a2cdf7961 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Tue, 3 Aug 2021 15:26:56 +0100 Subject: [PATCH 4/6] Attempt using 'db' (docker network-alias) instead of 'localhost' --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 40c8f66..052deb9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,7 +38,7 @@ stages: inputs: mavenPomFile: 'pom.xml' mavenOptions: '-Xmx3072m' - options: '-Dispyb.url="jdbc:mariadb://localhost:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=localhost' + options: '-Dispyb.url="jdbc:mariadb://db:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=db' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.8' jdkArchitectureOption: 'x64' From 05e4988275b55ab9dbe77f3edefc6d89fb1f6e17 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Tue, 3 Aug 2021 15:34:19 +0100 Subject: [PATCH 5/6] Attempt using '127.0.01' instead of 'db' as host name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 052deb9..1c4c1fa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,7 +38,7 @@ stages: inputs: mavenPomFile: 'pom.xml' mavenOptions: '-Xmx3072m' - options: '-Dispyb.url="jdbc:mariadb://db:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=db' + options: '-Dispyb.url="jdbc:mariadb://127.0.0.1:3306" -Dispyb.user=root -Dispyb.pw="$(MYSQL_ROOT_PASSWORD)" -Dispyb.host=127.0.0.1' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.8' jdkArchitectureOption: 'x64' From ec8424b9455aaa14ec05248fdc702cf2d7cadbf2 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Tue, 3 Aug 2021 15:49:43 +0100 Subject: [PATCH 6/6] Use Azure Pipelines badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf8482e..9ba005b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/DiamondLightSource/gda-ispyb-api.svg?branch=master)](https://travis-ci.org/DiamondLightSource/gda-ispyb-api) +[![Build Status](https://dev.azure.com/diamond-lims/gda-ispyb-api/_apis/build/status/DiamondLightSource.gda-ispyb-api?branchName=master)](https://dev.azure.com/diamond-lims/gda-ispyb-api/_build/latest?definitionId=1&branchName=master) # GDA ISPyB API