mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
b6ea4ecdf0
The `deploy:` section is executed as part of each successful job. That means the container images and Helm charts are built and pushed many times during testing after a push/merge event. By creating a deploy stage and listing it after the tests, it is guaranteed to run only once after all tests have succeeded. By adding a condition to only run the stage for push events, the images and Helm charts should only get built+pushed after a PR has been merged. See-also: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions Signed-off-by: Niels de Vos <ndevos@redhat.com>
143 lines
4.4 KiB
YAML
143 lines
4.4 KiB
YAML
---
|
|
# need for docker build
|
|
sudo: true
|
|
dist: xenial
|
|
|
|
addons:
|
|
apt:
|
|
packages:
|
|
- realpath
|
|
- ruby
|
|
- socat
|
|
services:
|
|
- docker
|
|
|
|
language: go
|
|
branches:
|
|
only:
|
|
- master
|
|
|
|
go: 1.13.x
|
|
|
|
env:
|
|
global:
|
|
- GOLANGCI_VERSION=v1.21.0
|
|
- GO111MODULE=on
|
|
- GOSEC_VERSION=2.0.0
|
|
- TEST_COVERAGE=stdout
|
|
- GO_METALINTER_THREADS=1
|
|
- GO_COVER_DIR=_output
|
|
- HELM_VERSION=v3.1.2
|
|
- VM_DRIVER=none
|
|
- MINIKUBE_VERSION=v1.6.0
|
|
- CHANGE_MINIKUBE_NONE_USER=true
|
|
- KUBECONFIG=$HOME/.kube/config
|
|
# set CEPH_CSI_RUN_ALL_TESTS to non-empty to run all tests
|
|
- CEPH_CSI_RUN_ALL_TESTS=true
|
|
|
|
before_install:
|
|
- mkdir -p $GOPATH/bin
|
|
|
|
before_script:
|
|
- curl https://download.ceph.com/keys/release.asc | sudo apt-key add -
|
|
- sudo apt-add-repository
|
|
"deb https://download.ceph.com/debian-nautilus xenial main"
|
|
# Ceph does not guarantee arm64 builds, fallback to ceph 14.2.5
|
|
# yamllint disable rule:line-length
|
|
- test "$(arch)" != "aarch64" || sudo apt-add-repository
|
|
"deb https://chacra.ceph.com/r/ceph/nautilus/af06652dc9b2da8c6aadbbecdfafdc7e235abe7d/ubuntu/xenial/flavors/default/ xenial main"
|
|
# yamllint enable rule:line-length
|
|
- sudo apt-get -qq update
|
|
# only the arm64 fallback repo is unsigned and needs --allow-unauthenticated
|
|
- sudo apt-get -y --allow-unauthenticated install librados-dev librbd-dev
|
|
|
|
# Two stages for testing, each stage runs its jobs in parallel, but stages are
|
|
# run after each other, unless the last stage fails.
|
|
# Only run the deploy stage on push (not pull_request) events.
|
|
stages:
|
|
- build testing
|
|
- e2e testing
|
|
- name: deploy
|
|
if: type = push
|
|
|
|
jobs:
|
|
include:
|
|
- stage: build testing
|
|
name: static-check-make
|
|
install:
|
|
- gem install mdl
|
|
- pip install --user --upgrade pip
|
|
- pip install --user yamllint
|
|
# install golangci-lint
|
|
- curl -sf
|
|
"https://install.goreleaser.com/github.com/golangci/golangci-lint.sh"
|
|
| bash -s -- -b $GOPATH/bin "${GOLANGCI_VERSION}"
|
|
# install gosec
|
|
- curl -sfL
|
|
"https://raw.githubusercontent.com/securego/gosec/master/install.sh"
|
|
| sh -s -- -b $GOPATH/bin "${GOSEC_VERSION}"
|
|
# install helm for helm lint
|
|
- curl -L https://git.io/get_helm.sh
|
|
| bash -s -- -v "${HELM_VERSION}"
|
|
script:
|
|
- make go-lint
|
|
- make go-lint-text
|
|
- make gosec
|
|
- make go-test
|
|
- make mod-check
|
|
|
|
- stage: build testing
|
|
name: Build multi-architecture image for amd64 and arm64
|
|
script:
|
|
- ./scripts/build-multi-arch-image.sh || travis_terminate 1;
|
|
|
|
- stage: build testing
|
|
name: containerized test (Fedora) and build (CentOS)
|
|
script:
|
|
- make containerized-test || travis_terminate 1;
|
|
- make containerized-build || travis_terminate 1;
|
|
|
|
- stage: build testing
|
|
name: cephcsi on Arm64
|
|
arch: arm64
|
|
script:
|
|
- scripts/skip-doc-change.sh || travis_terminate 0;
|
|
- make image-cephcsi || travis_terminate 1;
|
|
# No CI test job is availabe for Arm64 now due to below issues
|
|
# - k8s-csi sidecar images for Arm64 are not available
|
|
# - Travis Arm64 CI job runs inside unprivileged LXD which blocks
|
|
# launching minikube test environment
|
|
- travis_terminate 0 # deploy only on x86
|
|
|
|
- stage: e2e testing
|
|
name: cephcsi with kube 1.14.10
|
|
script:
|
|
- scripts/skip-doc-change.sh || travis_terminate 0;
|
|
- make image-cephcsi || travis_terminate 1;
|
|
- scripts/travis-functest.sh v1.14.10 || travis_terminate 1;
|
|
|
|
- stage: e2e testing
|
|
name: cephcsi with kube 1.15.6
|
|
script:
|
|
- scripts/skip-doc-change.sh || travis_terminate 0;
|
|
- make image-cephcsi || travis_terminate 1;
|
|
- scripts/travis-functest.sh v1.15.6 || travis_terminate 1;
|
|
|
|
- stage: e2e testing
|
|
name: cephcsi with kube 1.17.0
|
|
script:
|
|
- scripts/skip-doc-change.sh || travis_terminate 0;
|
|
- make image-cephcsi || travis_terminate 1;
|
|
- scripts/travis-functest.sh v1.17.0 || travis_terminate 1;
|
|
|
|
- stage: e2e testing
|
|
name: cephcsi helm charts with kube 1.17.0
|
|
script:
|
|
- scripts/skip-doc-change.sh || travis_terminate 0;
|
|
- make image-cephcsi || travis_terminate 1;
|
|
- scripts/travis-helmtest.sh v1.17.0 || travis_terminate 1;
|
|
|
|
- stage: deploy
|
|
name: push artifacts to repositories
|
|
script: ./deploy.sh
|