Skip to content

Commit d7008de

Browse files
authored
Run Smoke Tests on Windows (getporter#1321)
* Run Smoke Tests on Windows * Setup windows agent for smoke tests * Use pipeline artifacts in CI * save the bin directory after cross compiling * split the build into stages: doc check, build, test, smoke test * pass the bin directory to latest stages instead of rebuilding * run the smoke tests against windows, linux and macos * Rename test-cli to smoke tests and moved logic for it into mage so that we can call it on Windows * Add .gitattributes so that windows doesn't alter line endings Signed-off-by: Carolyn Van Slyck <[email protected]> * Update release pipeline to use mage Signed-off-by: Carolyn Van Slyck <[email protected]> * Pin wordpress chart version A new version was just released that doesn't work with the helm2 mixin Signed-off-by: Carolyn Van Slyck <[email protected]>
1 parent d64b09d commit d7008de

24 files changed

+780
-346
lines changed

.gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* text=auto eol=lf
2+
*.png binary
3+
*.jpg binary
4+
*.jpeg binary
5+
*.svg binary
6+

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ Here are the most common Makefile tasks
265265
* `test-integration` runs the integration tests. This requires a kubernetes
266266
cluster setup with credentials located at **~/.kube/config**. Expect this to
267267
take 20 minutes.
268-
* `test-cli` runs a small suite of end-to-end tests using the Porter CLI.
268+
* `teste2e` runs a small suite of end-to-end tests using the Porter CLI.
269269
* `docs-preview` hosts the docs site. See [Preview
270270
Documentation](#preview-documentation).
271271
* `test` runs all the tests.

Makefile

+10-11
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ SHELL = bash
33
# --no-print-directory avoids verbose logging when invoking targets that utilize sub-makes
44
MAKE_OPTS ?= --no-print-directory
55

6-
REGISTRY ?= $(USER)
76
VERSION ?= $(shell git describe --tags 2> /dev/null || echo v0)
87
PERMALINK ?= $(shell git describe --tags --exact-match &> /dev/null && echo latest || echo canary)
98

10-
KUBECONFIG ?= $(HOME)/.kube/config
119
export PORTER_HOME = ${CURDIR}/bin
1210

1311
CLIENT_PLATFORM = $(shell go env GOOS)
@@ -19,6 +17,12 @@ BASEURL_FLAG ?=
1917

2018
GO = GO111MODULE=on go
2119

20+
# Add ~/go/bin to PATH, works for everything _except_ shell commands
21+
HAS_GOBIN_IN_PATH := $(shell re='(:|^)$(CLIENT_GOPATH)/bin/?(:|$$)'; if [[ "$${PATH}" =~ $${re} ]];then echo $${GOPATH}/bin;fi)
22+
ifndef HAS_GOBIN_IN_PATH
23+
export PATH := ${CLIENT_GOPATH}/bin:${PATH}
24+
endif
25+
2226
ifeq ($(CLIENT_PLATFORM),windows)
2327
FILE_EXT=.exe
2428
else ifeq ($(RUNTIME_PLATFORM),windows)
@@ -79,22 +83,17 @@ get-mixins:
7983
verify:
8084
@echo 'verify does nothing for now but keeping it as a placeholder for a bit'
8185

82-
test: clean-last-testrun test-unit test-integration test-cli
86+
test: clean-last-testrun build test-unit test-integration teste2e
8387

8488
test-unit:
8589
$(GO) test ./...
8690

87-
test-integration: clean-last-testrun build start-local-docker-registry
91+
test-integration: clean-last-testrun start-local-docker-registry
8892
$(GO) build -o $(PORTER_HOME)/testplugin ./cmd/testplugin
8993
PROJECT_ROOT=$(shell pwd) $(GO) test -timeout 30m -tags=integration ./...
9094

91-
test-cli: clean-last-testrun build init-porter-home-for-ci start-local-docker-registry
92-
REGISTRY=$(REGISTRY) KUBECONFIG=$(KUBECONFIG) ./scripts/test/test-cli.sh
93-
94-
init-porter-home-for-ci:
95-
cp -R build/testdata/credentials $(PORTER_HOME)
96-
sed -i.bak 's|KUBECONFIGPATH|$(KUBECONFIG)|g' $(PORTER_HOME)/credentials/ci.json
97-
cp -R build/testdata/bundles $(PORTER_HOME)
95+
teste2e: clean-last-testrun start-local-docker-registry
96+
go run mage.go teste2e
9897

9998
.PHONY: docs
10099
docs:

build/azure-pipelines.pr-automatic.yml

+128-105
Original file line numberDiff line numberDiff line change
@@ -6,110 +6,133 @@
66
trigger: none
77

88
pool:
9-
vmImage: 'Ubuntu 16.04'
9+
vmImage: "Ubuntu 16.04"
1010

1111
variables:
12-
GOVERSION: '1.13.10'
13-
System.Debug: false
14-
15-
jobs:
16-
- job: setup
17-
steps:
18-
- script: ./build/doc-only-build.sh
19-
name: BUILD
20-
displayName: 'Check Doc Only Build'
21-
22-
- job: test
23-
dependsOn: setup
24-
condition: eq(dependencies.setup.outputs['BUILD.DOCS_ONLY'], 'false')
25-
steps:
26-
- task: GoTool@0
27-
inputs:
28-
version: '$(GOVERSION)'
29-
- script: build/azure-pipelines.setup-go-workspace.sh
30-
displayName: 'Set up the Go workspace'
31-
32-
- script: |
33-
make verify
34-
workingDirectory: '$(System.DefaultWorkingDirectory)'
35-
displayName: 'Verify'
36-
37-
- script: |
38-
make test-unit
39-
workingDirectory: '$(System.DefaultWorkingDirectory)'
40-
displayName: 'Unit Test'
41-
42-
- job: compile
43-
dependsOn: setup
44-
condition: eq(dependencies.setup.outputs['BUILD.DOCS_ONLY'], 'false')
45-
steps:
46-
- task: GoTool@0
47-
inputs:
48-
version: '$(GOVERSION)'
49-
- script: build/azure-pipelines.setup-go-workspace.sh
50-
displayName: 'Set up the Go workspace'
51-
52-
- script: |
53-
make xbuild-all
54-
workingDirectory: '$(System.DefaultWorkingDirectory)'
55-
displayName: 'Cross Compile'
56-
57-
- job: validate_example_bundles
58-
dependsOn: setup
59-
condition: eq(dependencies.setup.outputs['BUILD.DOCS_ONLY'], 'false')
60-
steps:
61-
- task: GoTool@0
62-
inputs:
63-
version: '$(GOVERSION)'
64-
- script: build/azure-pipelines.setup-go-workspace.sh
65-
displayName: 'Set up the Go workspace'
66-
67-
- script: |
68-
make build
69-
workingDirectory: '$(System.DefaultWorkingDirectory)'
70-
displayName: 'Build'
71-
72-
- script: |
73-
sudo make ajv
74-
make build-bundle validate-bundle
75-
workingDirectory: '$(System.DefaultWorkingDirectory)'
76-
displayName: 'Validate Example Bundles'
77-
78-
- job: integration_test
79-
dependsOn: setup
80-
condition: eq(dependencies.setup.outputs['BUILD.DOCS_ONLY'], 'false')
81-
steps:
82-
- task: GoTool@0
83-
inputs:
84-
version: '$(GOVERSION)'
85-
- script: build/azure-pipelines.setup-go-workspace.sh
86-
displayName: 'Set up the Go workspace'
87-
88-
- script: |
89-
make build
90-
workingDirectory: '$(System.DefaultWorkingDirectory)'
91-
displayName: 'Build'
92-
93-
- script: ./build/run-integration-tests.sh
94-
workingDirectory: '$(System.DefaultWorkingDirectory)'
95-
displayName: 'Integration Test'
96-
97-
- job: cli_test
98-
dependsOn: setup
99-
condition: eq(dependencies.setup.outputs['BUILD.DOCS_ONLY'], 'false')
100-
steps:
101-
- task: GoTool@0
102-
inputs:
103-
version: '$(GOVERSION)'
104-
- script: build/azure-pipelines.setup-go-workspace.sh
105-
displayName: 'Set up the Go workspace'
106-
107-
- script: |
108-
make build
109-
workingDirectory: '$(System.DefaultWorkingDirectory)'
110-
displayName: 'Build'
111-
112-
- script: |
113-
make test-cli
114-
workingDirectory: '$(System.DefaultWorkingDirectory)'
115-
displayName: 'CLI Test'
12+
GOVERSION: "1.13.10"
13+
14+
stages:
15+
- stage: Setup
16+
jobs:
17+
- job: pr_type
18+
displayName: "Determine PR Type"
19+
steps:
20+
- bash: ./build/doc-only-build.sh
21+
name: BUILD
22+
displayName: "Is Doc Only?"
23+
24+
- stage: Validate
25+
dependsOn: Setup
26+
condition: eq(dependencies.Setup.outputs['pr_type.BUILD.DOCS_ONLY'], 'false')
27+
jobs:
28+
- job: build
29+
displayName: "Native Compile"
30+
steps:
31+
- task: GoTool@0
32+
displayName: "Set Go Version"
33+
inputs:
34+
version: "$(GOVERSION)"
35+
- script: go run mage.go ConfigureAgent
36+
displayName: "Configure Agent"
37+
- bash: make build
38+
displayName: "Native Build"
39+
- task: PublishPipelineArtifact@0
40+
displayName: "Publish Native Binaries"
41+
inputs:
42+
targetPath: $(System.DefaultWorkingDirectory)/bin
43+
archiveFilePatterns: "**"
44+
artifactName: "build-bin"
45+
- job: xbuild
46+
displayName: "Cross Compile"
47+
steps:
48+
- task: GoTool@0
49+
displayName: "Set Go Version"
50+
inputs:
51+
version: "$(GOVERSION)"
52+
- script: go run mage.go ConfigureAgent
53+
displayName: "Configure Agent"
54+
- bash: make xbuild-all
55+
displayName: "Cross Compile"
56+
- task: PublishPipelineArtifact@0
57+
displayName: "Publish Release Binaries"
58+
inputs:
59+
targetPath: $(System.DefaultWorkingDirectory)/bin
60+
archiveFilePatterns: "**"
61+
artifactName: "xbuild-bin"
62+
- job: unit_test
63+
displayName: "Unit Test"
64+
steps:
65+
- task: GoTool@0
66+
displayName: "Set Go Version"
67+
inputs:
68+
version: "$(GOVERSION)"
69+
- script: go run mage.go ConfigureAgent
70+
displayName: "Configure Agent"
71+
- bash: make verify
72+
displayName: "Verify"
73+
- bash: make test-unit
74+
displayName: "Unit Test"
75+
- job: integration_test
76+
displayName: "Integration Test"
77+
dependsOn: build
78+
steps:
79+
- task: DownloadPipelineArtifact@2
80+
displayName: "Download Bin"
81+
inputs:
82+
source: current
83+
artifact: build-bin
84+
path: bin
85+
- task: GoTool@0
86+
displayName: "Set Go Version"
87+
inputs:
88+
version: "$(GOVERSION)"
89+
- script: go run mage.go ConfigureAgent SetBinExecutable
90+
displayName: "Configure Agent"
91+
- bash: ./build/run-integration-tests.sh
92+
displayName: "Integration Test"
93+
- job: build_examples
94+
displayName: "Build Examples"
95+
dependsOn: build
96+
steps:
97+
- task: DownloadPipelineArtifact@2
98+
displayName: "Download Native Porter Binaries"
99+
inputs:
100+
source: current
101+
artifact: build-bin
102+
path: bin
103+
- script: go run mage.go SetBinExecutable
104+
displayName: "Setup Bin"
105+
- bash: |
106+
set -e
107+
sudo make ajv
108+
make build-bundle validate-bundle
109+
displayName: "Validate Examples"
110+
- job: e2e_test
111+
displayName: "Run E2E tests on"
112+
dependsOn: xbuild
113+
strategy:
114+
matrix:
115+
windows:
116+
poolName: "windows"
117+
vmImage: ""
118+
linux:
119+
poolName: "Azure Pipelines"
120+
vmImage: "ubuntu-latest"
121+
pool:
122+
name: $(poolName)
123+
vmImage: $(vmImage)
124+
steps:
125+
- task: DownloadPipelineArtifact@2
126+
displayName: "Download Cross-Compiled Porter Binaries"
127+
inputs:
128+
source: current
129+
artifact: xbuild-bin
130+
path: bin
131+
- task: GoTool@0
132+
displayName: "Set Go Version"
133+
inputs:
134+
version: "$(GOVERSION)"
135+
- script: go run mage.go ConfigureAgent UseXBuildBinaries
136+
displayName: "Configure Agent"
137+
- script: mage TestE2E
138+
displayName: "Run E2E Tests"

0 commit comments

Comments
 (0)