mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-23 14:50:24 +00:00
ci: pushing artifacts using github actions
As Travis CI `https://travis-ci.org/` is getting
shutdown date on June 15th. Either we need to move
to new place https://www.travis-ci.com/ or we can
switch to github action to push image and the helm
charts when a PR is merged.
fixes: #1781
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit c70e46a77c
)
This commit is contained in:
parent
51075bc018
commit
b73e8a676c
35
.github/workflows/publish-artifacts.yaml
vendored
Normal file
35
.github/workflows/publish-artifacts.yaml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: publish artifacts
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Sequence of patterns matched against refs/heads
|
||||||
|
branches:
|
||||||
|
# Push events on default branch
|
||||||
|
- devel
|
||||||
|
# Push events to branches matching refs/heads/release-v*
|
||||||
|
- 'release-v*'
|
||||||
|
jobs:
|
||||||
|
push:
|
||||||
|
name: Publish artifacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to Quay
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: quay.io
|
||||||
|
username: ${{ secrets.QUAY_IO_USERNAME }}
|
||||||
|
password: ${{ secrets.QUAY_IO_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set build environment based on Git branch name
|
||||||
|
if: github.ref == 'refs/heads/devel'
|
||||||
|
run: echo "BRANCH_NAME=devel" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: publish artifacts
|
||||||
|
# podman cannot pull images with both tag and digest
|
||||||
|
# https://github.com/containers/buildah/issues/1407
|
||||||
|
# use docker to build images
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} CONTAINER_CMD=docker ./deploy.sh
|
@ -96,7 +96,6 @@ pull_request_rules:
|
|||||||
- label!=DNM
|
- label!=DNM
|
||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
- "#approved-reviews-by>=1"
|
- "#approved-reviews-by>=1"
|
||||||
- "status-success=continuous-integration/travis-ci/pr"
|
|
||||||
actions:
|
actions:
|
||||||
merge: {}
|
merge: {}
|
||||||
dismiss_reviews: {}
|
dismiss_reviews: {}
|
||||||
@ -117,7 +116,6 @@ pull_request_rules:
|
|||||||
- label!=DNM
|
- label!=DNM
|
||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
- "#approved-reviews-by>=1"
|
- "#approved-reviews-by>=1"
|
||||||
- "status-success=continuous-integration/travis-ci/pr"
|
|
||||||
actions:
|
actions:
|
||||||
merge: {}
|
merge: {}
|
||||||
dismiss_reviews: {}
|
dismiss_reviews: {}
|
||||||
@ -138,7 +136,6 @@ pull_request_rules:
|
|||||||
- label!=DNM
|
- label!=DNM
|
||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
- "#approved-reviews-by>=1"
|
- "#approved-reviews-by>=1"
|
||||||
- "status-success=continuous-integration/travis-ci/pr"
|
|
||||||
actions:
|
actions:
|
||||||
merge: {}
|
merge: {}
|
||||||
dismiss_reviews: {}
|
dismiss_reviews: {}
|
||||||
@ -159,7 +156,6 @@ pull_request_rules:
|
|||||||
- label!=DNM
|
- label!=DNM
|
||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
- "#approved-reviews-by>=1"
|
- "#approved-reviews-by>=1"
|
||||||
- "status-success=continuous-integration/travis-ci/pr"
|
|
||||||
actions:
|
actions:
|
||||||
merge: {}
|
merge: {}
|
||||||
dismiss_reviews: {}
|
dismiss_reviews: {}
|
||||||
@ -181,7 +177,6 @@ pull_request_rules:
|
|||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
- "#approved-reviews-by>=1"
|
- "#approved-reviews-by>=1"
|
||||||
- "status-success=multi-arch-build"
|
- "status-success=multi-arch-build"
|
||||||
- "status-success=continuous-integration/travis-ci/pr"
|
|
||||||
- "status-success=ci/centos/mini-e2e-helm/k8s-1.19"
|
- "status-success=ci/centos/mini-e2e-helm/k8s-1.19"
|
||||||
- "status-success=ci/centos/mini-e2e-helm/k8s-1.20"
|
- "status-success=ci/centos/mini-e2e-helm/k8s-1.20"
|
||||||
- "status-success=ci/centos/mini-e2e/k8s-1.19"
|
- "status-success=ci/centos/mini-e2e/k8s-1.19"
|
||||||
|
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
# need for docker build
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- coreutils
|
|
||||||
- ruby
|
|
||||||
- socat
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
language: go
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- release-v3.3
|
|
||||||
# Only run the deploy stage on push (not pull_request) events.
|
|
||||||
stages:
|
|
||||||
- name: deploy
|
|
||||||
if: type = push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- stage: deploy
|
|
||||||
name: push artifacts to repositories
|
|
||||||
install:
|
|
||||||
- export HELM_VERSION=$(source build.env ; echo ${HELM_VERSION})
|
|
||||||
- curl -L https://git.io/get_helm.sh
|
|
||||||
| bash -s -- -v "${HELM_VERSION}"
|
|
||||||
script: ./deploy.sh
|
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
[![Go Report
|
[![Go Report
|
||||||
Card](https://goreportcard.com/badge/github.com/ceph/ceph-csi)](https://goreportcard.com/report/github.com/ceph/ceph-csi)
|
Card](https://goreportcard.com/badge/github.com/ceph/ceph-csi)](https://goreportcard.com/report/github.com/ceph/ceph-csi)
|
||||||
[![Build
|
|
||||||
Status](https://travis-ci.org/ceph/ceph-csi.svg?branch=devel)](https://travis-ci.org/ceph/ceph-csi)
|
|
||||||
|
|
||||||
- [Ceph CSI](#ceph-csi)
|
- [Ceph CSI](#ceph-csi)
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
125
deploy.sh
125
deploy.sh
@ -1,43 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# shellcheck source=scripts/build_step.inc.sh
|
# shellcheck source=scripts/build_step.inc.sh
|
||||||
source "$(dirname "${0}")/scripts/build_step.inc.sh"
|
source "$(dirname "${0}")/scripts/build_step.inc.sh"
|
||||||
source "$(dirname "${0}")/build.env"
|
source "$(dirname "${0}")/build.env"
|
||||||
|
|
||||||
push_helm_charts() {
|
BRANCH_NAME=${BRANCH_NAME:-""}
|
||||||
PACKAGE=$1
|
GITHUB_TOKEN=${GITHUB_TOKEN:-""}
|
||||||
CHARTDIR=$2
|
GITHUB_USER=${GITHUB_USER:-"autobuild-bot"}
|
||||||
VERSION=${CSI_IMAGE_VERSION//v/} # Set version (without v prefix)
|
GITHUB_EMAIL=${GITHUB_EMAIL:-"ceph-csi-bot@users.noreply.github.com"}
|
||||||
|
|
||||||
# update information in Chart.yaml if the branch is not devel
|
|
||||||
if [ "$TRAVIS_BRANCH" != "devel" ]; then
|
|
||||||
# Replace appVersion: canary and version: *-canary with the actual version
|
|
||||||
sed -i "s/\(\s.*canary\)/ $VERSION/" "charts/ceph-csi-$PACKAGE/Chart.yaml"
|
|
||||||
|
|
||||||
if [[ "$VERSION" == *"canary"* ]]; then
|
|
||||||
# Replace devel with the version branch
|
|
||||||
sed -i "s/devel/$TRAVIS_BRANCH/" "charts/ceph-csi-$PACKAGE/Chart.yaml"
|
|
||||||
else
|
|
||||||
# This is not a canary release, replace devel with the tagged branch
|
|
||||||
sed -i "s/devel/v$VERSION/" "charts/ceph-csi-$PACKAGE/templates/NOTES.txt"
|
|
||||||
sed -i "s/devel/v$VERSION/" "charts/ceph-csi-$PACKAGE/Chart.yaml"
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$CHARTDIR/csi-charts/docs/$PACKAGE"
|
|
||||||
cp -R "./charts/ceph-csi-$PACKAGE" "$CHARTDIR/csi-charts/docs/$PACKAGE"
|
|
||||||
pushd "$CHARTDIR/csi-charts/docs/$PACKAGE" >/dev/null
|
|
||||||
helm package "ceph-csi-$PACKAGE"
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
pushd "$CHARTDIR/csi-charts/docs" >/dev/null
|
|
||||||
helm repo index .
|
|
||||||
git add --all :/ && git commit -m "Update for helm charts $PACKAGE-$VERSION"
|
|
||||||
git push https://"$GITHUB_TOKEN"@github.com/ceph/csi-charts
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build and push images. Steps as below:
|
# Build and push images. Steps as below:
|
||||||
# 1. get base image from ./build.env (BASE_IMAGE=ceph/ceph:v14.2)
|
# 1. get base image from ./build.env (BASE_IMAGE=ceph/ceph:v14.2)
|
||||||
@ -82,41 +54,66 @@ build_push_images() {
|
|||||||
make push-manifest
|
make push-manifest
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${TRAVIS_BRANCH}" != 'release-v3.3' ]; then
|
push_helm_charts() {
|
||||||
echo "!!! Branch ${TRAVIS_BRANCH} is not a deployable branch; exiting"
|
PACKAGE=$1
|
||||||
exit 0 # Exiting 0 so that this isn't marked as failing
|
CHARTDIR=$2
|
||||||
fi
|
VERSION=${CSI_IMAGE_VERSION//v/} # Set version (without v prefix)
|
||||||
|
|
||||||
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
|
# update information in Chart.yaml if the branch is not devel
|
||||||
build_step "log in to quay.io as user ${QUAY_IO_USERNAME}"
|
if [ "${BRANCH_NAME}" != "devel" ]; then
|
||||||
# This is a workaround to fix docker permission denied issue during manifest create in Travis CI.
|
# Replace appVersion: canary and version: *-canary with the actual version
|
||||||
# `docker manifest create` fails due to permission denied on `/etc/docker/certs.d/quay.io`
|
sed -i "s/\(\s.*canary\)/ ${VERSION}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
|
||||||
# (https://github.com/docker/for-linux/issues/396).
|
|
||||||
sudo chmod o+x /etc/docker
|
|
||||||
|
|
||||||
"${CONTAINER_CMD:-docker}" login -u "${QUAY_IO_USERNAME}" -p "${QUAY_IO_PASSWORD}" quay.io
|
if [[ "${VERSION}" == *"canary"* ]]; then
|
||||||
|
# Replace devel with the version branch
|
||||||
|
sed -i "s/devel/${BRANCH_NAME}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
|
||||||
|
else
|
||||||
|
# This is not a canary release, replace devel with the tagged branch
|
||||||
|
sed -i "s/devel/v${VERSION}/" "charts/ceph-csi-${PACKAGE}/templates/NOTES.txt"
|
||||||
|
sed -i "s/devel/v${VERSION}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
|
||||||
|
|
||||||
set -xe
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
build_push_images
|
mkdir -p "${CHARTDIR}/csi-charts/docs/${PACKAGE}"
|
||||||
|
cp -R "./charts/ceph-csi-${PACKAGE}" "${CHARTDIR}/csi-charts/docs/${PACKAGE}"
|
||||||
CSI_CHARTS_DIR=$(mktemp -d)
|
pushd "${CHARTDIR}/csi-charts/docs/${PACKAGE}" >/dev/null
|
||||||
|
helm package "ceph-csi-${PACKAGE}"
|
||||||
pushd "$CSI_CHARTS_DIR" >/dev/null
|
|
||||||
|
|
||||||
curl -L https://git.io/get_helm.sh | bash -s -- --version "${HELM_VERSION}"
|
|
||||||
|
|
||||||
build_step "cloning ceph/csi-charts repository"
|
|
||||||
git clone https://github.com/ceph/csi-charts
|
|
||||||
|
|
||||||
mkdir -p csi-charts/docs
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
build_step "pushing RBD helm charts"
|
pushd "${CHARTDIR}/csi-charts/docs" >/dev/null
|
||||||
push_helm_charts rbd "$CSI_CHARTS_DIR"
|
helm repo index .
|
||||||
build_step "pushing CephFS helm charts"
|
git config user.name "${GITHUB_USER}"
|
||||||
push_helm_charts cephfs "$CSI_CHARTS_DIR"
|
git config user.email "${GITHUB_EMAIL}"
|
||||||
build_step_log "finished deployment!"
|
git add --all :/ && git commit -m "Update for helm charts ${PACKAGE}-${VERSION}"
|
||||||
|
git push https://"${GITHUB_TOKEN}"@github.com/ceph/csi-charts
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
[ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}"
|
}
|
||||||
|
|
||||||
|
if [[ -z "${GITHUB_TOKEN}" ]]; then
|
||||||
|
echo "GITHUB_TOKEN is unset or set to the empty string"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
build_push_images
|
||||||
|
|
||||||
|
CSI_CHARTS_DIR=$(mktemp -d)
|
||||||
|
|
||||||
|
pushd "${CSI_CHARTS_DIR}" >/dev/null
|
||||||
|
|
||||||
|
curl -L https://git.io/get_helm.sh | bash -s -- --version "${HELM_VERSION}"
|
||||||
|
|
||||||
|
build_step "cloning ceph/csi-charts repository"
|
||||||
|
git clone https://github.com/ceph/csi-charts
|
||||||
|
|
||||||
|
mkdir -p csi-charts/docs
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
build_step "pushing RBD helm charts"
|
||||||
|
push_helm_charts rbd "${CSI_CHARTS_DIR}"
|
||||||
|
build_step "pushing CephFS helm charts"
|
||||||
|
push_helm_charts cephfs "${CSI_CHARTS_DIR}"
|
||||||
|
build_step_log "finished deployment!"
|
||||||
|
|
||||||
|
[ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
- [Introduction](#introduction)
|
- [Introduction](#introduction)
|
||||||
- [Versioning](#versioning)
|
- [Versioning](#versioning)
|
||||||
- [Tagging repositories](#tagging-repositories)
|
- [Tagging repositories](#tagging-repositories)
|
||||||
- [Release process](#release-process-tbd)
|
- [Release process [TBD]](#release-process-tbd)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ and it must be backward compatible.
|
|||||||
|
|
||||||
The tag name must begin with "v" followed by the version number, conforming to
|
The tag name must begin with "v" followed by the version number, conforming to
|
||||||
the [versioning](#versioning) requirements (e.g. a tag of `v1.0.0-rc2` for
|
the [versioning](#versioning) requirements (e.g. a tag of `v1.0.0-rc2` for
|
||||||
version `1.0.0-rc2`). This tag format is used by the Travis CI infrastructure to
|
version `1.0.0-rc2`). This tag format is used by the GitHub action
|
||||||
properly upload and tag releases to Quay and Docker Hub.
|
infrastructure to properly upload and tag releases to Quay.
|
||||||
|
|
||||||
## Release process [TBD]
|
## Release process [TBD]
|
||||||
|
|
||||||
@ -74,4 +74,3 @@ of each release:
|
|||||||
2.1.0) can be linked to issues and PRs for better tracking release items.
|
2.1.0) can be linked to issues and PRs for better tracking release items.
|
||||||
|
|
||||||
- Once all steps are complete, close the issue and the milestone.
|
- Once all steps are complete, close the issue and the milestone.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# This script will be used by travis to run functional test
|
# This script will be used by centos CI to run functional test
|
||||||
# against different Kubernetes version
|
# against different Kubernetes version
|
||||||
export KUBE_VERSION=$1
|
export KUBE_VERSION=$1
|
||||||
shift
|
shift
|
||||||
@ -15,7 +15,7 @@ kube_version() {
|
|||||||
# configure global environment variables
|
# configure global environment variables
|
||||||
# shellcheck source=build.env
|
# shellcheck source=build.env
|
||||||
source "$(dirname "${0}")/../build.env"
|
source "$(dirname "${0}")/../build.env"
|
||||||
cat << EOF | sudo tee -a /etc/environment
|
cat <<EOF | sudo tee -a /etc/environment
|
||||||
MINIKUBE_VERSION=${MINIKUBE_VERSION}
|
MINIKUBE_VERSION=${MINIKUBE_VERSION}
|
||||||
VM_DRIVER=${VM_DRIVER}
|
VM_DRIVER=${VM_DRIVER}
|
||||||
CHANGE_MINIKUBE_NONE_USER=${CHANGE_MINIKUBE_NONE_USER}
|
CHANGE_MINIKUBE_NONE_USER=${CHANGE_MINIKUBE_NONE_USER}
|
||||||
@ -27,7 +27,6 @@ sudo scripts/minikube.sh create-block-pool
|
|||||||
# pull docker images to speed up e2e
|
# pull docker images to speed up e2e
|
||||||
sudo scripts/minikube.sh cephcsi
|
sudo scripts/minikube.sh cephcsi
|
||||||
sudo scripts/minikube.sh k8s-sidecar
|
sudo scripts/minikube.sh k8s-sidecar
|
||||||
sudo chown -R travis: "$HOME"/.minikube /usr/local/bin/kubectl
|
|
||||||
KUBE_MAJOR=$(kube_version 1)
|
KUBE_MAJOR=$(kube_version 1)
|
||||||
KUBE_MINOR=$(kube_version 2)
|
KUBE_MINOR=$(kube_version 2)
|
||||||
# skip snapshot operation if kube version is less than 1.17.0
|
# skip snapshot operation if kube version is less than 1.17.0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# This script will be used by travis to run functional test
|
# This script will be used by centos CI to run functional test
|
||||||
# against different Kubernetes version
|
# against different Kubernetes version
|
||||||
export KUBE_VERSION=$1
|
export KUBE_VERSION=$1
|
||||||
shift
|
shift
|
||||||
@ -15,7 +15,7 @@ kube_version() {
|
|||||||
# configure global environment variables
|
# configure global environment variables
|
||||||
# shellcheck source=build.env
|
# shellcheck source=build.env
|
||||||
source "$(dirname "${0}")/../build.env"
|
source "$(dirname "${0}")/../build.env"
|
||||||
cat << EOF | sudo tee -a /etc/environment
|
cat <<EOF | sudo tee -a /etc/environment
|
||||||
HELM_VERSION=${HELM_VERSION}
|
HELM_VERSION=${HELM_VERSION}
|
||||||
MINIKUBE_VERSION=${MINIKUBE_VERSION}
|
MINIKUBE_VERSION=${MINIKUBE_VERSION}
|
||||||
VM_DRIVER=${VM_DRIVER}
|
VM_DRIVER=${VM_DRIVER}
|
||||||
@ -31,7 +31,6 @@ sudo scripts/minikube.sh create-block-pool
|
|||||||
# pull docker images to speed up e2e
|
# pull docker images to speed up e2e
|
||||||
sudo scripts/minikube.sh cephcsi
|
sudo scripts/minikube.sh cephcsi
|
||||||
sudo scripts/minikube.sh k8s-sidecar
|
sudo scripts/minikube.sh k8s-sidecar
|
||||||
sudo chown -R travis: "$HOME"/.minikube /usr/local/bin/kubectl
|
|
||||||
|
|
||||||
NAMESPACE=cephcsi-e2e-$RANDOM
|
NAMESPACE=cephcsi-e2e-$RANDOM
|
||||||
# create ns for e2e
|
# create ns for e2e
|
||||||
|
Loading…
Reference in New Issue
Block a user