Skip to content

Commit

Permalink
Merge commit '1e1c45093e3baa5fcba160e56261404d81a4fc37'
Browse files Browse the repository at this point in the history
  • Loading branch information
dunnevan committed Feb 13, 2020
2 parents 3633cad + 1e1c450 commit 2907ae6
Show file tree
Hide file tree
Showing 64 changed files with 675 additions and 978 deletions.
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
run:
timeout: 3m

linters-settings:

funlen:
Expand Down Expand Up @@ -101,4 +104,4 @@ issues:
- gosec
exclude-use-default: true
max-issues-per-linter: 0
max-same-issues: 0
max-same-issues: 0
120 changes: 0 additions & 120 deletions .travis-pub.yml

This file was deleted.

164 changes: 109 additions & 55 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,53 @@ go:

env:
global:
# Shared ENV
- REPO_OWNER=$(dirname $TRAVIS_REPO_SLUG)
# REPO_NAME should normally be 'ibm-spectrum-scale-csi'
- REPO_NAME=$(basename $TRAVIS_REPO_SLUG)
- REPO_NAME_DRIVER="${REPO_NAME}-driver"
- REPO_NAME_OPERATOR="${REPO_NAME}-operator"

# Grab quay username from 'user+bot_token'
- IMAGE_REPO_OWNER=${QUAY_BOT_USERNAME%%\+*}
# Format quay image target
- IMAGE_REPO_DRIVER=quay.io/${IMAGE_REPO_OWNER}/${REPO_NAME_DRIVER}
- IMAGE_REPO_OPERATOR=quay.io/${IMAGE_REPO_OWNER}/${REPO_NAME_OPERATOR}
# Add image tag
- IMAGE_TAG=$(
if [[ $TRAVIS_EVENT_TYPE == 'cron' ]];
then
echo "nightly-${TRAVIS_BUILD_ID}-`date -u +%F`";
else
echo $TRAVIS_BRANCH;
fi
)
# Add image repo and tag
- IMAGE_FQN_DRIVER=${IMAGE_REPO_DRIVER}:${IMAGE_TAG}
- IMAGE_FQN_OPERATOR=${IMAGE_REPO_OPERATOR}:${IMAGE_TAG}
- IMAGE_VERSION=${IMAGE_TAG}
# Add image label to expire nightlies
- IMAGE_LABEL=$(
if [[ $TRAVIS_EVENT_TYPE == 'cron' ]];
then
echo "--label version=${IMAGE_VERSION} --label quay.expires-after=2w";
else
echo "--label version=${IMAGE_VERSION}";
fi
)
- BUILD_DIR_OPERATOR="${TRAVIS_BUILD_DIR}/operator"
- BUILD_DIR_DRIVER="${TRAVIS_BUILD_DIR}/driver"


# Operator ENV
- OCTOKIT_API_ENDPOINT="https://github.ibm.com/api/v3/"
- PATH=/opt/python/3.6.7/bin:$PATH
- GO111MODULE=on
- KUBE_VERSION="v1.16.2"
- OP_VER="v0.11.0"
- CSI_OP_VER="${TRAVIS_BRANCH}.${TRAVIS_OS_NAME}"
- QUAY_USERNAME="mew2057"
- DOCKER_REPO="quay.io/${QUAY_USERNAME}/ibm-spectrum-scale-csi-operator-test:${CSI_OP_VER}"
- LOCAL_IMAGE="csi.ibm.com/csi-scale-operator:testing"

- OPERATOR_LOCAL_IMAGE="csi.ibm.com/${REPO_NAME_OPERATOR}:testing"
- OPERATOR_SDK="https://github.com/operator-framework/operator-sdk/releases/download/${OP_VER}/operator-sdk-${OP_VER}-x86_64-linux-gnu"
- CSI_OP_BUILD_DIR="${TRAVIS_BUILD_DIR}/operator"


- OPERATOR_NAME=ibm-spectrum-scale-csi-operator
- OLM_MANIFEST="${CSI_OP_BUILD_DIR}/deploy/olm-catalog/${OPERATOR_NAME}/"

- OLM_MANIFEST="${BUILD_DIR_OPERATOR}/deploy/olm-catalog/${REPO_NAME_OPERATOR}/"
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
Expand All @@ -35,7 +65,7 @@ addons:
packages:
- "python3"
- "python3-dev"
- "python3-pip"
- "python3-pip"
stages:
- lint
- build
Expand All @@ -46,17 +76,29 @@ jobs:

# Install operator-courier and run the lint on the manifest.
- stage: lint
name: "Lint: Run linters and bundle automation."
name: "Lint - Driver: run golangci-lint"
before_install:
- >-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
sh -s -- -b $(go env GOPATH)/bin v1.21.0 # pinned
before_script:
- cd ${BUILD_DIR_DRIVER}
script:
- golangci-lint run

# stage: lint
- name: "Lint - Operator: run linters and bundle automation."
script:
- pip install ansible
# Testing that the generated files match the deploy/*.yaml files, it they do not match, fail Travis
- ansible-playbook ${TRAVIS_BUILD_DIR}/tools/ansible/generate-playbook.yaml --extra-vars "travis_testing=true"
- pip install operator-courier
- cd ${CSI_OP_BUILD_DIR}
- cd ${BUILD_DIR_OPERATOR}
- python hacks/package_operator.py -d ${OLM_MANIFEST} -o /tmp/operator --nozip
- operator-courier --verbose verify --ui_validate_io /tmp/operator

- name: "Lint: CASE"

# stage: lint
- name: "Lint - Operator: CASE"
if: env.HELM_REPO_SSH_LOCATION!=""
before_install:
- if [[ -z "$HELM_REPO_SSH_LOCATION" ]] ; then exit 0;fi
Expand Down Expand Up @@ -92,68 +134,80 @@ jobs:
file: repo/stable/*
on:
tags: true
# end stage: lint


- stage: build
name: "Build: operator"
name: "Build - Driver: image and push to registry"
env:
- GOFLAGS="-mod=vendor" #this should not be required in Go 1.14, see https://github.com/golang/go/issues/33848
before_script:
- cd ${BUILD_DIR_DRIVER}
- go mod vendor
script:
- sudo pip install docker
- go test -v -race ./...
- docker build ${IMAGE_LABEL} --build-arg GOFLAGS=${GOFLAGS} -f Dockerfile -t ${REPO_NAME_DRIVER} .
before_deploy:
- echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io
- docker tag ${REPO_NAME_DRIVER} ${IMAGE_FQN_DRIVER}
deploy:
- provider: script
script: docker push ${IMAGE_FQN_DRIVER}
on:
all_branches: true
condition: -n "$QUAY_BOT_USERNAME" && -n "$QUAY_BOT_PASSWORD"

# stage: build
- name: "Build - Operator: image and push to registry"
install:
- docker version
before_script:
- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/install_operator-sdk.sh
- cd ${CSI_OP_BUILD_DIR}
- operator-sdk version
- go version
- operator-sdk build csi-scale-operator
- docker tag csi-scale-operator ${DOCKER_REPO}
#- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io; docker push ${DOCKER_REPO}; fi'
script:
- cd ${BUILD_DIR_OPERATOR}
- operator-sdk build ${REPO_NAME_OPERATOR} --image-build-args "${IMAGE_LABEL}"
before_deploy:
- echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io
- docker tag ${REPO_NAME_OPERATOR} ${IMAGE_FQN_OPERATOR}
deploy:
- provider: script
script: docker push ${IMAGE_FQN_OPERATOR}
on:
all_branches: true
condition: -n "$QUAY_BOT_USERNAME" && -n "$QUAY_BOT_PASSWORD"

- name: "Build: docs"
# stage: build
- name: "Build - Operator: docs"
script:
- pip install sphinx sphinx_rtd_theme recommonmark
- cd ${TRAVIS_BUILD_DIR}/docs
- make html
# end stage: build


# Install minikube, build the image and run the scorecard.
# Install minikube, build the image and run the scorecard then execute molecule testing.
- stage: test
name: "Test: scorecard"
name: "Test - Operator: scorecard and molecule"
before_install:
- sudo pip install docker
- pip install openshift
- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/install_minikube.sh
- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/install_operator-sdk.sh
- kubectl version
- cd ${CSI_OP_BUILD_DIR}
- eval $(minikube docker-env) # Popping this out, because I don't think the script is working.
- operator-sdk build csi-scale-operator
- docker tag csi-scale-operator ${DOCKER_REPO}
script:
# Print environment
# Build the image, clear and restore the finalizers.
- python hacks/clear_finalizers.py
- python hacks/change_deploy_image.py -i ${DOCKER_REPO} --ifnotpresent
- kubectl create -f deploy/namespace.yaml
- operator-sdk scorecard --config .osdk-scorecard.yaml
- python hacks/clear_finalizers.py --restore

- before_install:
- sudo pip install docker
- pip install pyyaml molecule openshift docker jmespath kubernetes-validate
- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/install_minikube.sh
- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/install_operator-sdk.sh
- kubectl version
- cd ${CSI_OP_BUILD_DIR}
- cd ${BUILD_DIR_OPERATOR}
- eval $(minikube docker-env) # Popping this out, because I don't think the script is working.
- operator-sdk build csi-scale-operator
- docker tag csi-scale-operator ${LOCAL_IMAGE}
name: "Test: molecule"
script:
# This needs to be built before we can test with molecule for reasons.
- python hacks/change_deploy_image.py -i ${LOCAL_IMAGE} --ifnotpresent
- operator-sdk build ${REPO_NAME_OPERATOR}
- docker tag ${REPO_NAME_OPERATOR} ${OPERATOR_LOCAL_IMAGE}
script:
# molecule
- python hacks/change_deploy_image.py -i ${OPERATOR_LOCAL_IMAGE} --ifnotpresent
- kubectl create -f deploy/namespace.yaml
- molecule test -s test-local
# sc
- python hacks/clear_finalizers.py
- operator-sdk scorecard --config .osdk-scorecard.yaml
- python hacks/clear_finalizers.py --restore


#- ${TRAVIS_BUILD_DIR}/tools/scripts/ci/fold_ouput.sh cluster.info.2 "cluster information" kubectl cluster-info dump
notifications:
email: false
Loading

0 comments on commit 2907ae6

Please sign in to comment.