From f34367be676c6107e511b4a39d9d48f7325a9b73 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Thu, 13 Aug 2020 18:13:22 +0200 Subject: [PATCH] Start work --- .azure-pipelines/main.yml | 5 ++ .azure-pipelines/release.yml | 18 +++++++ .../templates/integration-jobs.yml | 48 +++++++++++++++++++ .azure-pipelines/templates/release-jobs.yml | 0 4 files changed, 71 insertions(+) create mode 100644 .azure-pipelines/main.yml create mode 100644 .azure-pipelines/release.yml create mode 100644 .azure-pipelines/templates/integration-jobs.yml create mode 100644 .azure-pipelines/templates/release-jobs.yml diff --git a/.azure-pipelines/main.yml b/.azure-pipelines/main.yml new file mode 100644 index 0000000..d3427ed --- /dev/null +++ b/.azure-pipelines/main.yml @@ -0,0 +1,5 @@ +trigger: + - master + +jobs: + - template: templates/integration-jobs.yml diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml new file mode 100644 index 0000000..68445da --- /dev/null +++ b/.azure-pipelines/release.yml @@ -0,0 +1,18 @@ +trigger: + branches: + exclude: + - "*" + tags: + include: + - "3.*" + - "4.*" + +pr: none + +stages: + - stage: Test + jobs: + - template: templates/integration-jobs.yml + - stage: Release + jobs: + - template: templates/release-jobs.yml diff --git a/.azure-pipelines/templates/integration-jobs.yml b/.azure-pipelines/templates/integration-jobs.yml new file mode 100644 index 0000000..c0f46e4 --- /dev/null +++ b/.azure-pipelines/templates/integration-jobs.yml @@ -0,0 +1,48 @@ +jobs: + - job: build + pool: + vmImage: ubuntu-18.04 + steps: + - script: | + docker pull adferrand/backuppc || true + docker build --pull --cache-from adferrand/backuppc -t adferrand/backuppc . + docker save adferrand/backuppc | gzip -c -1 > $(Build.ArtifactStagingDirectory)/docker-backuppc.tar.gz + displayName: Build container + - task: PublishPipelineArtifact@1 + inputs: + path: $(Build.ArtifactStagingDirectory) + artifact: docker + displayName: Store Docker artifact + - job: unit-tests + dependsOn: build + pool: + vmImage: ubuntu-18.04 + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: docker + path: $(Build.SourcesDirectory) + displayName: Retrieve Docker artifact + - script: | + docker load < docker-backuppc.tar.gz + mkdir -p ./bin + curl -fsSL https://goss.rocks/install | GOSS_DST=./bin sh + GOSS_PATH=./bin/goss GOSS_SLEEP=2 GOSS_FILES_PATH=./tests ./bin/dgoss run adferrand/backuppc + - job: integration-tests + dependsOn: build + pool: + vmImage: ubuntu-18.04 + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: docker + path: $(Build.SourcesDirectory) + displayName: Retrieve Docker artifact + - script: | + docker load < docker-backuppc.tar.gz + docker run --name backuppc-integration --detach -p 8080:8080 adferrand/backuppc + sleep 5 + output=`curl http://backuppc:password@localhost:8080/BackupPC_Admin` + echo "Expect the backupp configuration page without errors" + grep "The servers PID is" <(echo $output) + docker rm -f backuppc-integration diff --git a/.azure-pipelines/templates/release-jobs.yml b/.azure-pipelines/templates/release-jobs.yml new file mode 100644 index 0000000..e69de29