mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-23 23:00:19 +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>
This commit is contained in:
parent
7b5c78ec7c
commit
c70e46a77c
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
|
@ -99,7 +99,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: {}
|
||||||
@ -120,7 +119,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: {}
|
||||||
@ -141,7 +139,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: {}
|
||||||
@ -162,7 +159,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: {}
|
||||||
@ -184,7 +180,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:
|
|
||||||
- devel
|
|
||||||
# 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)
|
||||||
|
85
deploy.sh
85
deploy.sh
@ -1,43 +1,13 @@
|
|||||||
#!/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
|
|
||||||
VERSION=${CSI_IMAGE_VERSION//v/} # Set version (without v prefix)
|
|
||||||
|
|
||||||
# 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,21 +52,45 @@ build_push_images() {
|
|||||||
make push-manifest
|
make push-manifest
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${TRAVIS_BRANCH}" != 'devel' ]; 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
|
||||||
|
VERSION=${CSI_IMAGE_VERSION//v/} # Set version (without v prefix)
|
||||||
|
|
||||||
|
# update information in Chart.yaml if the branch is not devel
|
||||||
|
if [ "${BRANCH_NAME}" != "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/$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"
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
|
mkdir -p "$CHARTDIR/csi-charts/docs/$PACKAGE"
|
||||||
build_step "log in to quay.io as user ${QUAY_IO_USERNAME}"
|
cp -R "./charts/ceph-csi-$PACKAGE" "$CHARTDIR/csi-charts/docs/$PACKAGE"
|
||||||
# This is a workaround to fix docker permission denied issue during manifest create in Travis CI.
|
pushd "$CHARTDIR/csi-charts/docs/$PACKAGE" >/dev/null
|
||||||
# `docker manifest create` fails due to permission denied on `/etc/docker/certs.d/quay.io`
|
helm package "ceph-csi-$PACKAGE"
|
||||||
# (https://github.com/docker/for-linux/issues/396).
|
popd >/dev/null
|
||||||
sudo chmod o+x /etc/docker
|
|
||||||
|
|
||||||
"${CONTAINER_CMD:-docker}" login -u "${QUAY_IO_USERNAME}" -p "${QUAY_IO_PASSWORD}" quay.io
|
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
|
||||||
|
|
||||||
set -xe
|
}
|
||||||
|
|
||||||
|
if [[ -z "${GITHUB_TOKEN}" ]]; then
|
||||||
|
echo "GITHUB_TOKEN is unset or set to the empty string"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
build_push_images
|
build_push_images
|
||||||
|
|
||||||
@ -119,4 +113,3 @@ if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
|
|||||||
build_step_log "finished deployment!"
|
build_step_log "finished deployment!"
|
||||||
|
|
||||||
[ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}"
|
[ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}"
|
||||||
fi
|
|
||||||
|
@ -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
|
||||||
@ -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
|
||||||
@ -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