Skip to content

update csi for 1.30 #808

update csi for 1.30

update csi for 1.30 #808

Workflow file for this run

# Copyright 2022 DigitalOcean
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
### Run unit as well as end-to-end tests on PRs and master pushes. For the
### latter, we also push a new CSI plugin master image to the container
### registry.
name: test
env:
DOCKER_ORG: digitalocean
DOCKER_USER: ${{ secrets.DockerHubUser }}
on:
push:
branches:
- master
pull_request:
branches:
jobs:
unit-test:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 1
- name: Go setup
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
- name: Run unit tests
run: make all
push-images:
runs-on: ubuntu-20.04
needs: unit-test
steps:
- name: checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 1
- name: Log into container registry
run: echo "${{ secrets.DockerHubToken }}" | docker login --username ${DOCKER_USER} --password-stdin
# Github Actions provides a limited amount of disk space only that we
# exceed during the Docker build (https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources).
# Free up as much disk space as possible.
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker system prune -af --volumes
df -h
- name: build and push runner image
env:
# ${{ github.head_ref }} is empty for non-pull requests, which is
# exactly what we want on master.
RUNNER_IMAGE_TAG_PREFIX: ${{ github.head_ref }}
run: RUNNER_IMAGE=${DOCKER_ORG}/k8s-e2e-test-runner make runner-push
- name: Build and push development plugin image
env:
VERSION: ${{ github.head_ref }}
run: |
VERSION="${VERSION:-latest}"
DOCKER_REPO=${DOCKER_ORG}/do-csi-plugin-dev make publish
e2e-test:
runs-on: ubuntu-20.04
needs: push-images
strategy:
fail-fast: false
matrix:
kube-release: ['1.30', '1.29', '1.28', '1.27']
steps:
- name: checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 1
- name: Go setup
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
- name: Install kustomize
env:
KUSTOMIZE_VERSION: '4.4.1'
run: curl -fL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | sudo tar xzv -C /usr/local/bin kustomize
- name: Run end-to-end tests
env:
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.CSIDigitalOceanAccessToken }}
# ${{ github.head_ref }} will be empty for pull requests and non-empty
# for pushes. Handle the cases in "run" below to parameterize our e2e
# test invocation accordingly.
BRANCH: ${{ github.head_ref }}
# Use less ginkgo nodes to avoid running into the DO API rate limit.
# The upstream end-to-end tests are quite demanding in terms of API
# request volume, and we run them concurrently.
NUM_GINKGO_NODES: "8"
run: |
BRANCH=$(echo -n ${BRANCH} | tr -c '[:alnum:]._-' '-')
NAME_SUFFIX="${BRANCH}"
TAG="${BRANCH}"
if [[ $BRANCH != "" ]]; then
# Hash name suffix which goes into the cluster name to ensure we do
# not exceed any name constraints.
NAME_SUFFIX=$(echo -n ${BRANCH} | sha256sum | cut -c1-7)
RUNNER_IMAGE_TAG_PREFIX=${BRANCH}-
else
NAME_SUFFIX=master
TAG=latest
fi
TIMEOUT=60m make test-e2e E2E_ARGS="-ginkgo-nodes ${NUM_GINKGO_NODES} -driver-image ${DOCKER_ORG}/do-csi-plugin-dev:${TAG} -runner-image ${DOCKER_ORG}/k8s-e2e-test-runner:${RUNNER_IMAGE_TAG_PREFIX}latest -name-suffix ${NAME_SUFFIX} -retain ${{ matrix.kube-release }}"
tag-new-master-image:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
needs: e2e-test
steps:
- name: checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 1
- name: Log into container registry
run: echo "${{ secrets.DockerHubToken }}" | docker login --username ${DOCKER_USER} --password-stdin
- name: tag new CSI plugin master image
run: |
docker pull ${DOCKER_ORG}/do-csi-plugin-dev:latest
docker tag ${DOCKER_ORG}/do-csi-plugin-dev:latest ${DOCKER_ORG}/do-csi-plugin:master
docker push ${DOCKER_ORG}/do-csi-plugin:master