Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run using our own cowsay image #2047

Merged
merged 13 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ commands:
name: Install and start K3S v1.0.0
command: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.0.0 INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
background: true
- run:
name: Pull some Docker images now, to save time later
command: |
docker pull golang:1.11.5
docker pull minio/minio:RELEASE.2019-12-17T23-16-33Z
docker pull docker/whalesay:latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image has started was causing ErrImagePull and EOF errors.

docker pull bitnami/kubectl:1.15.3-ol-7-r165
background: true
- restore_go_cache
- install_golang
- go_junit_report
Expand All @@ -78,17 +70,20 @@ commands:
name: Watch Docker events, to help diagnose failures
command: docker events
background: true
- run:
name: Watch Kubernetes events, to help diagnose failures
command: kubectl -n argo get events --watch
background: true
- run:
name: Start Argo
command: mkdir dist && KUBECONFIG=~/.kube/config make start DB=$DB E2E_EXECUTOR=docker
- run:
name: Establish port forward
command: make pf
background: true
- run:
name: Watch Kubernetes events, to help diagnose failures
command: kubectl -n argo get events --watch
background: true
- run:
name: Sleep for short while
command: sleep 10s
- run:
name: Follow logs, to help diagnose failures
command: make logs
Expand Down
66 changes: 43 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_BRANCH = $(shell git rev-parse --abbrev-ref=loose HEAD | sed 's/heads\///')
GIT_REMOTE ?= upstream
GIT_TAG = $(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE = $(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)

Expand Down Expand Up @@ -84,12 +85,11 @@ else
endif
touch ui/dist/app

.PHONY: staticfiles
staticfiles:
$(HOME)/go/bin/staticfiles:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dtaniwaki FYI - I've changed this as it was always running with your change.

# Install the "staticfiles" tool
go get bou.ke/staticfiles

cmd/server/static/files.go: ui/dist/app staticfiles
cmd/server/static/files.go: $(HOME)/go/bin/staticfiles ui/dist/app
# Pack UI into a Go file.
staticfiles -o cmd/server/static/files.go ui/dist/app

Expand Down Expand Up @@ -198,19 +198,21 @@ verify-codegen:
.PHONY: manifests
manifests: manifests/install.yaml manifests/namespace-install.yaml manifests/quick-start-mysql.yaml manifests/quick-start-postgres.yaml test/e2e/manifests/postgres.yaml test/e2e/manifests/mysql.yaml

manifests/install.yaml: $(MANIFESTS)
# we use a different file to ./VERSION to force updating manifests after a `make clean`
dist/VERSION:
echo $(VERSION) > dist/VERSION

manifests/install.yaml: dist/VERSION $(MANIFESTS)
env VERSION=$(VERSION) ./hack/update-manifests.sh

manifests/namespace-install.yaml: $(MANIFESTS)
manifests/namespace-install.yaml: dist/VERSION $(MANIFESTS)
env VERSION=$(VERSION) ./hack/update-manifests.sh

manifests/quick-start-mysql.yaml: $(MANIFESTS)
# Create MySQL quick-start manifests
kustomize build manifests/quick-start/mysql | ./hack/auto-gen-msg.sh > manifests/quick-start-mysql.yaml
manifests/quick-start-mysql.yaml: dist/VERSION $(MANIFESTS)
env VERSION=$(VERSION) ./hack/update-manifests.sh

manifests/quick-start-postgres.yaml: $(MANIFESTS)
# Create Postgres quick-start manifests
kustomize build manifests/quick-start/postgres | ./hack/auto-gen-msg.sh > manifests/quick-start-postgres.yaml
manifests/quick-start-postgres.yaml: dist/VERSION $(MANIFESTS)
env VERSION=$(VERSION) ./hack/update-manifests.sh

# lint/test/etc

Expand Down Expand Up @@ -266,6 +268,24 @@ else
kubectl -n argo apply -f dist/mysql.yaml
endif

.PHONY: test-images
test-images: dist/cowsay-v1 dist/bitnami-kubectl-1.15.3-ol-7-r165 dist/python-alpine3.6
Copy link
Contributor Author

@alexec alexec Jan 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we build or pull the images we need for our tests prior to running tests


dist/cowsay-v1:
docker build -t cowsay:v1 test/e2e/images/cowsay
ifeq ($(K3D),true)
k3d import-images cowsay:v1
endif
touch dist/cowsay-v1

dist/bitnami-kubectl-1.15.3-ol-7-r165:
docker pull bitnami/kubectl:1.15.3-ol-7-r165
touch dist/bitnami-kubectl-1.15.3-ol-7-r165

dist/python-alpine3.6:
docker pull python:alpine3.6
touch dist/python-alpine3.6

.PHONY: start
start: controller-image cli-image executor-image install
# Start development environment
Expand Down Expand Up @@ -319,24 +339,24 @@ mysql-cli:
kubectl exec -ti `kubectl get pod -l app=mysql -o name|cut -c 5-` -- mysql -u mysql -ppassword argo

.PHONY: test-e2e
test-e2e:
test-e2e: test-images
# Run E2E tests
go test -timeout 20m -v -count 1 -p 1 ./test/e2e/...

.PHONY: smoke
smoke:
smoke: test-images
# Run smoke tests
go test -timeout 1m -v -count 1 -p 1 -run SmokeSuite ./test/e2e
go test -timeout 2m -v -count 1 -p 1 -run SmokeSuite ./test/e2e

.PHONY: test-api
test-api:
test-api: test-images
# Run API tests
go test -timeout 2m -v -count 1 -p 1 -run ArgoServerSuite ./test/e2e
go test -timeout 3m -v -count 1 -p 1 -run ArgoServerSuite ./test/e2e

.PHONY: test-cli
test-cli:
test-cli: test-images
# Run CLI tests
go test -timeout 30s -v -count 1 -p 1 -run CliSuite ./test/e2e
go test -timeout 1m -v -count 1 -p 1 -run CliSuite ./test/e2e

# clean

Expand Down Expand Up @@ -392,14 +412,14 @@ ifeq ($(findstring release,$(GIT_BRANCH)),release)
# Check we have tagged the latest commit
@if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi
# Check the tag is correct
@if [ "$(GIT_TAG)" != "v$(VERSION)" ]; then echo 'git tag ($(GIT_TAG)) does not match VERSION (v$(VERSION))'; exit 1; fi
@if [ "$(GIT_TAG)" != "$(VERSION)" ]; then echo 'git tag ($(GIT_TAG)) does not match VERSION ($(VERSION))'; exit 1; fi
endif

.PHONY: publish
publish:
ifeq ($(VERSION),latest)
ifneq ($(GIT_BRANCH),master)
echo "you cannot publish latest version unless you are on master" >&2
echo "you cannot publish 'latest' unless you are on master" >&2
exit 1
endif
endif
Expand All @@ -408,10 +428,10 @@ endif
docker push $(IMAGE_NAMESPACE)/argocli:$(IMAGE_TAG)
docker push $(IMAGE_NAMESPACE)/argoexec:$(IMAGE_TAG)
docker push $(IMAGE_NAMESPACE)/workflow-controller:$(IMAGE_TAG)
ifeq ($(SNAPSHOT),false)
ifeq ($(findstring release,$(GIT_BRANCH)),release)
# Push changes to Git
git push
git push $(VERSION)
git push $(GIT_REMOTE)
git tag push $(GIT_REMOTE) $(VERSION)
endif

.PHONY: release
Expand Down
3 changes: 3 additions & 0 deletions hack/update-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ rm -f "${SRCROOT}/manifests/install.yaml.bak"
kustomize build "${SRCROOT}/manifests/namespace-install" | ${SRCROOT}/hack/auto-gen-msg.sh > "${SRCROOT}/manifests/namespace-install.yaml"
sed -i.bak "s@- .*/argoexec:.*@- ${IMAGE_NAMESPACE}/argoexec:${VERSION}@" "${SRCROOT}/manifests/namespace-install.yaml"
rm -f "${SRCROOT}/manifests/namespace-install.yaml.bak"

kustomize build ${SRCROOT}/manifests/quick-start/mysql | sed "s/:latest/:$VERSION/" | ${SRCROOT}/hack/auto-gen-msg.sh > ${SRCROOT}/manifests/quick-start-mysql.yaml
kustomize build ${SRCROOT}/manifests/quick-start/postgres | sed "s/:latest/:$VERSION/" | ${SRCROOT}/hack/auto-gen-msg.sh > ${SRCROOT}/manifests/quick-start-postgres.yaml
2 changes: 1 addition & 1 deletion test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Notes:

* Everything runs in the `argo` namespace (including MinIO).
* For speed, please only use `docker/whalesay:latest`.
* For speed, please only use `cowsay:v1`.
* Test can take longer on CI. Adds 5s to timeout values.

## Debugging E2E Tests
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/argo_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (s *ArgoServerSuite) TestPermission() {
{
"name": "run-workflow",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"command": ["sh"],
"args": ["-c", "sleep 10"]
}
Expand Down Expand Up @@ -239,7 +239,7 @@ func (s *ArgoServerSuite) TestPermission() {
{
"name": "run-workflow",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent",
"command": ["sh"],
"args": ["-c", "sleep 10"]
Expand Down Expand Up @@ -279,7 +279,7 @@ func (s *ArgoServerSuite) TestLintWorkflow() {
{
"name": "run-workflow",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -308,7 +308,7 @@ func (s *ArgoServerSuite) TestCreateWorkflowDryRun() {
{
"name": "run-workflow",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -338,7 +338,7 @@ func (s *ArgoServerSuite) TestWorkflowService() {
{
"name": "run-workflow",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent",
"command": ["sh"],
"args": ["-c", "sleep 10"]
Expand Down Expand Up @@ -464,7 +464,7 @@ func (s *ArgoServerSuite) TestCronWorkflowService() {
{
"name": "whalesay",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -525,7 +525,7 @@ func (s *ArgoServerSuite) TestCronWorkflowService() {
{
"name": "whalesay",
"container": {
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -752,7 +752,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() {
"name": "run-workflow",
"container": {
"name": "",
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -781,7 +781,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() {
"name": "run-workflow",
"container": {
"name": "",
"image": "docker/whalesay:latest",
"image": "cowsay:v1",
"imagePullPolicy": "IfNotPresent"
}
}
Expand Down Expand Up @@ -842,7 +842,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() {
"name": "run-workflow",
"container": {
"name": "",
"image": "docker/whalesay:dev",
"image": "cowsay:v2",
"imagePullPolicy": "IfNotPresent"
}
}
Expand All @@ -855,7 +855,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() {
Status(200).
JSON().
Path("$.spec.templates[0].container.image").
Equal("docker/whalesay:dev")
Equal("cowsay:v2")
})

s.Run("Delete", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/expectedfailures/dag-disable-failFast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
templates:
- name: a
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [cowsay]
args: ["hello world"]
- name: b
Expand All @@ -26,7 +26,7 @@ spec:
args: ["echo intentional failure; exit 2"]
- name: d
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [cowsay]
args: ["hello world"]
- name: statis
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/expectedfailures/dag-disbale-failFast-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
templates:
- name: a
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [cowsay]
args: ["hello world"]
- name: b
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/expectedfailures/dag-noroot-branch-failed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
templates:
- name: a
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [cowsay]
args: ["hello world"]
- name: b
Expand All @@ -26,7 +26,7 @@ spec:
args: ["echo intentional failure; exit 2"]
- name: d
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [cowsay]
args: ["hello world"]
- name: statis
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/expectedfailures/failed-step-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ spec:
templates:
- name: exit
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [sh, -c, exit 1]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:

- name: whalesay
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [sh, -c]
args: ["cowsay hello world | tee /tmp/hello_world12.txt"]
outputs:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/expectedfailures/volumes-pvc-fail-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:

- name: whalesay
container:
image: docker/whalesay:latest
image: cowsay:v1
command: [sh, -c]
args: ["echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txt"]
volumeMounts:
Expand Down
Loading