From bc250139f3f08ce7e63e42691c68282535bae216 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Wed, 2 Jan 2019 17:08:50 -0800 Subject: [PATCH] feat: Azure DevOps PR E2E pipeline (#135) --- .circleci/config.yml | 2 +- .pipelines/e2e-job-template.yaml | 37 ++++++ .pipelines/e2e-step-template.yaml | 27 +++++ .pipelines/pr-e2e.yaml | 120 +++++++++++++++++++ .vsts-ci.yaml => .pipelines/vhd-builder.yaml | 0 Makefile | 2 +- makedev.ps1 | 2 +- 7 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 .pipelines/e2e-job-template.yaml create mode 100644 .pipelines/e2e-step-template.yaml create mode 100644 .pipelines/pr-e2e.yaml rename .vsts-ci.yaml => .pipelines/vhd-builder.yaml (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f76cb271c..bd716bad6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 defaults: &defaults working_directory: /go/src/github.com/Azure/aks-engine docker: - - image: quay.io/deis/go-dev:v1.18.1 + - image: quay.io/deis/go-dev:v1.18.2 environment: GOPATH: /go diff --git a/.pipelines/e2e-job-template.yaml b/.pipelines/e2e-job-template.yaml new file mode 100644 index 0000000000..3a9d93a4b6 --- /dev/null +++ b/.pipelines/e2e-job-template.yaml @@ -0,0 +1,37 @@ +parameters: + name: '' # defaults for any parameters that aren't specified + k8sRelease: '' + apimodel: 'examples/e2e-tests/kubernetes/release/default/definition.json' + createVNET: false + +jobs: +- job: ${{ parameters.name }} + dependsOn: unit_tests + timeoutInMinutes: 90 + cancelTimeoutInMinutes: 5 + strategy: + maxParallel: 0 + pool: + vmImage: ubuntu-16.04 + + container: dev1 + + variables: + GOBIN: '$(GOPATH)/bin' # Go binaries path + GOROOT: '/usr/local/go' # Go installation path + GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path + modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code + TIMEOUT: 20m + CLUSTER_DEFINITION: ${{ parameters.apimodel }} + ORCHESTRATOR_RELEASE: ${{ parameters.k8sRelease }} + CREATE_VNET: ${{ parameters.createVNET }} + CLEANUP_ON_EXIT: true + CLEANUP_IF_FAIL: true + RETAIN_SSH: false + ENABLE_KMS_ENCRYPTION: true + SUBSCRIPTION_ID: '$(SUBSCRIPTION_ID_E2E_KUBERNETES)' + + steps: + - template: e2e-step-template.yaml + parameters: + job: ${{ parameters.name }} \ No newline at end of file diff --git a/.pipelines/e2e-step-template.yaml b/.pipelines/e2e-step-template.yaml new file mode 100644 index 0000000000..874396988c --- /dev/null +++ b/.pipelines/e2e-step-template.yaml @@ -0,0 +1,27 @@ +parameters: + job: '' + +steps: + - script: | + mkdir -p '$(GOBIN)' + mkdir -p '$(GOPATH)/pkg' + mkdir -p '$(modulePath)' + shopt -s extglob + mv !(gopath) '$(modulePath)' + echo '##vso[task.prependpath]$(GOBIN)' + echo '##vso[task.prependpath]$(GOROOT)/bin' + displayName: 'Set up the Go workspace' + - script: make build-binary + displayName: compile + workingDirectory: $(modulePath) + - script: | + export CLIENT_ID=$(SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES) + export CLIENT_SECRET=$(SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES) + export CLIENT_OBJECTID=$(SERVICE_PRINCIPAL_OBJECT_ID_E2E_KUBERNETES) + make test-kubernetes + displayName: ginkgo k8s e2e tests + workingDirectory: $(modulePath) + - task: PublishPipelineArtifact@0 + inputs: + artifactName: '${{ parameters.job }}_logs' + targetPath: '$(modulePath)/_logs' diff --git a/.pipelines/pr-e2e.yaml b/.pipelines/pr-e2e.yaml new file mode 100644 index 0000000000..8a2424f08c --- /dev/null +++ b/.pipelines/pr-e2e.yaml @@ -0,0 +1,120 @@ +trigger: + branches: + include: + - master + paths: + exclude: + - docs/* + +pr: + branches: + include: + - master + paths: + exclude: + - docs/* + +resources: + containers: + - container: dev1 + image: quay.io/deis/go-dev:v1.18.2 + +jobs: +- job: unit_tests + timeoutInMinutes: 60 + cancelTimeoutInMinutes: 5 + strategy: + maxParallel: 0 + pool: + vmImage: 'Ubuntu 16.04' + + container: dev1 + + variables: + GOBIN: '$(GOPATH)/bin' # Go binaries path + GOROOT: '/usr/local/go' # Go installation path + GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path + modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code + + steps: + - script: | + mkdir -p '$(GOBIN)' + mkdir -p '$(GOPATH)/pkg' + mkdir -p '$(modulePath)' + shopt -s extglob + mv !(gopath) '$(modulePath)' + echo '##vso[task.prependpath]$(GOBIN)' + echo '##vso[task.prependpath]$(GOROOT)/bin' + displayName: 'Set up the Go workspace' + - script: make bootstrap + displayName: Install dependencies + workingDirectory: $(modulePath) + - script: make test-style + displayName: Run linting rules + workingDirectory: $(modulePath) + - script: make validate-dependencies + displayName: Check if imports, Gopkg.toml, and Gopkg.lock are in sync + workingDirectory: $(modulePath) + - script: make build-cross + displayName: Build cross-architectural binaries + workingDirectory: $(modulePath) + - script: make coverage + displayName: Run unit tests and calculate coverage + workingDirectory: $(modulePath) + +- template: e2e-job-template.yaml + parameters: + name: 'default_linux_e2e' + apimodel: 'examples/kubernetes.json' + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_1_10_release_e2e' + k8sRelease: '1.10' + apimodel: 'examples/e2e-tests/kubernetes/release/default/definition.json' + createVNET: true + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_1_11_release_e2e' + k8sRelease: '1.11' + apimodel: 'examples/e2e-tests/kubernetes/release/default/definition.json' + createVNET: true + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_1_12_release_e2e' + k8sRelease: '1.12' + apimodel: 'examples/e2e-tests/kubernetes/release/default/definition.json' + createVNET: true + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_1_13_release_e2e' + k8sRelease: '1.13' + apimodel: 'examples/e2e-tests/kubernetes/release/default/definition.json' + createVNET: true + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_windows_1_10_release_e2e' + k8sRelease: '1.10' + apimodel: 'examples/e2e-tests/kubernetes/windows/hybrid/definition.json' + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_windows_1_11_release_e2e' + k8sRelease: '1.11' + apimodel: 'examples/e2e-tests/kubernetes/windows/hybrid/definition.json' + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_windows_1_12_release_e2e' + k8sRelease: '1.12' + apimodel: 'examples/e2e-tests/kubernetes/windows/hybrid/definition.json' + +- template: e2e-job-template.yaml + parameters: + name: 'k8s_windows_1_13_release_e2e' + k8sRelease: '1.13' + apimodel: 'examples/e2e-tests/kubernetes/windows/hybrid/definition.json' diff --git a/.vsts-ci.yaml b/.pipelines/vhd-builder.yaml similarity index 100% rename from .vsts-ci.yaml rename to .pipelines/vhd-builder.yaml diff --git a/Makefile b/Makefile index be3375a2ea..3f1b3ed40a 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ GITTAG := $(VERSION_SHORT) endif REPO_PATH := github.com/Azure/aks-engine -DEV_ENV_IMAGE := quay.io/deis/go-dev:v1.18.1 +DEV_ENV_IMAGE := quay.io/deis/go-dev:v1.18.2 DEV_ENV_WORK_DIR := /go/src/${REPO_PATH} DEV_ENV_OPTS := --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} ${DEV_ENV_VARS} DEV_ENV_CMD := docker run ${DEV_ENV_OPTS} ${DEV_ENV_IMAGE} diff --git a/makedev.ps1 b/makedev.ps1 index 416d71460a..d6510ac415 100644 --- a/makedev.ps1 +++ b/makedev.ps1 @@ -1,5 +1,5 @@ $REPO_PATH = "github.com/Azure/aks-engine" -$DEV_ENV_IMAGE = "quay.io/deis/go-dev:v1.18.1" +$DEV_ENV_IMAGE = "quay.io/deis/go-dev:v1.18.2" $DEV_ENV_WORK_DIR = "/go/src/$REPO_PATH" docker.exe run -it --rm -w $DEV_ENV_WORK_DIR -v `"$($PWD)`":$DEV_ENV_WORK_DIR $DEV_ENV_IMAGE bash