Skip to content

Commit

Permalink
*: refactor Dockerfiles and Makefiles (operator-framework#4069)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Stroczynski committed Oct 21, 2020
1 parent 5776ba2 commit 09c3aa1
Show file tree
Hide file tree
Showing 45 changed files with 297 additions and 484 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ website/tech-doc-hugo
# samples bin
testdata/go/memcached-operator/bin/*


# Trash files
*\.DS_Store

# Created by https://www.toptal.com/developers/gitignore/api/go,vim,emacs,visualstudiocode
Expand Down
99 changes: 38 additions & 61 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,28 @@
os: linux
language: go
go_import_path: github.com/operator-framework/operator-sdk
dist: xenial

# Python 3.6 is the default Python when language: python.
# But when not language: python, Python 3 can not be used by default.
# There is pip (/usr/bin/pip), but not pip3.
# Because of it the global env is required.
env:
global:
- PATH=/opt/python/3.6.7/bin:$PATH

# Install python3 and utilities dependencies
addons:
apt:
packages:
- "python3"
- "python3-pip"
language: go
go:
- 1.15.x
go_import_path: github.com/operator-framework/operator-sdk

cache:
directories:
- $HOME/.cache/go-build

go:
- 1.15.x
- ${HOME}/.cache/go-build
- $(go env GOPATH)/pkg/mod

# The `x_base_steps` top-level key is unknown to travis,
# so we can use it to create a bunch of common build step
# YAML anchors which we use in our build jobs.
x_base_steps:
# Base go, ansbile, and helm job
- &test
env:
# before_install for jobs that require go builds and do not run for doc-only changes
before_install:
# hack/ci/check-doc-only-update.sh needs to be sourced so
# that it can properly exit the test early with success
- source hack/ci/check-doc-only-update.sh
- git fetch origin --unshallow --tags
after_success:
- echo "Tests passed"
after_failure:
- echo "Tests failed"
- kubectl get all --all-namespaces
- kubectl get events --all-namespaces --field-selector=type=Warning
services:
Expand All @@ -51,10 +32,6 @@ x_base_steps:
- &deploy
before_install:
- git fetch origin --unshallow --tags
after_success:
- echo "Image build succeeded, and docker image tagged and pushed to repository"
after_failure:
- echo "Image build, docker image tagging, or docker image pushing to repository failed"
services:
- docker

Expand All @@ -66,10 +43,6 @@ x_base_steps:
# We need /etc/docker to be accessible to non-root users.
# See https://github.com/moby/moby/pull/37847.
- sudo chmod 0755 /etc/docker
after_success:
- echo "Manifest list push to registry succeeded"
after_failure:
- echo "Manifest list creation or push to registry failed"
services:
- docker

Expand All @@ -88,38 +61,42 @@ jobs:

# Run the sanity tests
- stage: check
name: Sanity Tests
name: sanity
before_install:
- git fetch origin --unshallow --tags
script:
- make test-sanity

# Run website checks
- name: Doc Checks
- name: doc links
script:
- make test-links

## Operator test stage jobs ##

# Build and test ansible and test ansible using molecule
- stage: test
name: ansible e2e
<<: *test
name: Ansible on Kubernetes
env:
# Required to set python3 as the default python interpreter.
- PATH=/opt/python/3.6.7/bin:${PATH}
before_script:
- sudo apt-get install python3 python3-pip
- pip3 install --upgrade setuptools pip
- pip install --user ansible~=2.9.13
script:
- make test-e2e-ansible test-e2e-ansible-molecule

# Test subcommands
- <<: *test
name: Subcommands and Integration on Kubernetes
- name: subcommand and integration
<<: *test
script:
- make test-e2e-integration

# Build and test go
- <<: *test
name: Go on Kubernetes
- name: go unit and e2e
<<: *test
before_script:
- (cd / && go get github.com/mattn/goveralls)
script:
Expand All @@ -129,48 +106,48 @@ jobs:
- $GOPATH/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken=$COVERALLS_TOKEN

# Build and test helm
- <<: *test
name: Helm on Kubernetes
- name: helm e2e
<<: *test
script: make test-e2e-helm

## Image deploy/push stage jobs ##

# Build and deploy arm64 docker images
- stage: deploy
<<: *deploy
name: Docker images for arm64
name: build and push images
arch: arm64
<<: *deploy
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
- make image-build
- make -f release/Makefile image-push

# Build and deploy amd64 docker images
- <<: *deploy
name: Docker images for amd64
- name: build and push images
arch: amd64
<<: *deploy
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
- make image-build
- make -f release/Makefile image-push

# Build and deploy ppc64le docker images
- <<: *deploy
name: Docker images for ppc64le
- name: build and push images
arch: ppc64le
<<: *deploy
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
- make image-build
- make -f release/Makefile image-push

# Build and deploy s390x docker images
- <<: *deploy
name: Docker images for s390x
- name: build and push images
arch: s390x
<<: *deploy
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-sdk
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-sdk
# Use targets directly since kuttl doesn't support s390x.
- make image/ansible-operator image/helm-operator image/operator-sdk image/scorecard-test
- make -f release/Makefile image-push/ansible-operator image-push/helm-operator image-push/operator-sdk image-push/scorecard-test

# Build and deploy ansible multi-arch manifest list
- stage: deploy-manifest-multiarch
name: push manifest lists
<<: *manifest-deploy
name: Manifest lists
script:
- make image-push-ansible-multiarch image-push-helm-multiarch image-push-scorecard-test-multiarch image-push-scorecard-test-kuttl-multiarch image-push-sdk-multiarch
script: make -f release/Makefile image-push-multiarch
Loading

0 comments on commit 09c3aa1

Please sign in to comment.