Changes for releasing 1.13 (#2070)

* Changes for releasing 1.13

- Changed release version in charts 1.13
- Made changes in release scripts and makefile

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Update helm chart maintainers

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2021-06-15 19:50:23 +05:30
committed by GitHub
parent 6facdac464
commit 023a9905f6
9 changed files with 323 additions and 549 deletions
+70 -33
View File
@@ -22,7 +22,27 @@ REPO ?= fission
TAG ?= dev TAG ?= dev
DOCKER_FLAGS ?= --push --progress plain DOCKER_FLAGS ?= --push --progress plain
check: test-run build clean VERSION ?= master
TIMESTAMP ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
COMMITSHA ?= $(shell git rev-parse HEAD)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
FISSION-CLI := fission
ifeq ($(GOOS), windows)
FISSION-CLI := $(FISSION-CLI).exe
endif
GO ?= go
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.GitCommit=$(COMMITSHA) $(GO_LDFLAGS)
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.BuildDate=$(TIMESTAMP) $(GO_LDFLAGS)
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.Version=$(VERSION) $(GO_LDFLAGS)
GCFLAGS ?= all=-trimpath=$(CURDIR)
ASMFLAGS ?= all=-trimpath=$(CURDIR)
### Static checks
check: test-run build-fission-cli clean
code-checks: code-checks:
hack/verify-gofmt.sh hack/verify-gofmt.sh
@@ -34,48 +54,59 @@ test-run: code-checks
hack/runtests.sh hack/runtests.sh
@rm -f coverage.txt @rm -f coverage.txt
# ensure the changes are buildable ### Binaries
build: build-cli fission-cli:
go build -o cmd/fetcher/fetcher ./cmd/fetcher/ @mkdir -p build/$(GOOS)/$(GOARCH)/$(VERSION)
go build -o cmd/fetcher/builder ./cmd/builder/ GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build \
go build -o cmd/reporter/reporter ./cmd/reporter/ -gcflags '$(GCFLAGS)' \
-asmflags '$(ASMFLAGS)' \
-ldflags "$(GO_LDFLAGS)" \
-o build/$(GOOS)/$(GOARCH)/$(VERSION)/$(FISSION-CLI) ./cmd/fission-cli
build-cli: all-fission-cli:
go build -o cmd/fission-cli/fission ./cmd/fission-cli/ $(MAKE) fission-cli GOOS=windows GOARCH=amd64
$(MAKE) fission-cli GOOS=linux GOARCH=amd64
$(MAKE) fission-cli GOOS=linux GOARCH=arm
$(MAKE) fission-cli GOOS=linux GOARCH=arm64
$(MAKE) fission-cli GOOS=darwin GOARCH=amd64
install-cli: build-cli install-fission-cli: fission-cli
mv cmd/fission-cli/fission /usr/local/bin mv build/$(GOOS)/$(GOARCH)/$(VERSION)/$(FISSION-CLI) /usr/local/bin/
### Container images
FISSION_IMGS := fission-bundle-multiarch-img \
fetcher-multiarch-img \
builder-multiarch-img\
pre-upgrade-checks-multiarch-img \
reporter-multiarch-img
verify-builder: verify-builder:
@./hack/buildx.sh $(PLATFORMS) @./hack/buildx.sh $(PLATFORMS)
# build images (environment images are not included) local-images:
image: PLATFORMS=linux/amd64 $(MAKE) all-images
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
docker build -t reporter -f cmd/builder/Dockerfile.reporter .
# build multi-architecture images for release. all-images: verify-builder $(FISSION_IMGS)
image-multiarch: verify-builder multiarch-bundle multiarch-fetcher multiarch-builder multiarch-preupgrade multiarch-reporter
multiarch-bundle: verify-builder fission-bundle-multiarch-img: cmd/fission-bundle/Dockerfile.fission-bundle
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/fission-bundle:$(TAG) $(DOCKER_FLAGS) -f cmd/fission-bundle/Dockerfile.fission-bundle . fetcher-multiarch-img: cmd/fetcher/Dockerfile.fission-fetcher
builder-multiarch-img: cmd/builder/Dockerfile.fission-builder
pre-upgrade-checks-multiarch-img: cmd/preupgradechecks/Dockerfile.fission-preupgradechecks
reporter-multiarch-img: cmd/reporter/Dockerfile.reporter
multiarch-fetcher: verify-builder %-multiarch-img:
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/fetcher:$(TAG) $(DOCKER_FLAGS) -f cmd/fetcher/Dockerfile.fission-fetcher . @echo === Building image $(REPO)/$(subst -multiarch-img,,$@):$(TAG) using context $(CURDIR) and dockerfile $<
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/$(subst -multiarch-img,,$@):$(TAG) \
multiarch-builder: verify-builder --build-arg GITCOMMIT=$(COMMITSHA) \
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/builder:$(TAG) $(DOCKER_FLAGS) -f cmd/builder/Dockerfile.fission-builder . --build-arg BUILDDATE=$(TIMESTAMP) \
--build-arg BUILDVERSION=$(VERSION) \
multiarch-preupgrade: verify-builder $(DOCKER_FLAGS) -f $< .
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/pre-upgrade-checks:$(TAG) $(DOCKER_FLAGS) -f cmd/preupgradechecks/Dockerfile.fission-preupgradechecks .
multiarch-reporter: verify-builder
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/reporter:$(TAG) $(DOCKER_FLAGS) -f cmd/reporter/Dockerfile.reporter .
### CRDs
generate-crds: generate-crds:
controller-gen crd:trivialVersions=false,preserveUnknownFields=false paths=./pkg/apis/core/v1 output:crd:artifacts:config=crds/v1 controller-gen crd:trivialVersions=false,preserveUnknownFields=false \
paths=./pkg/apis/core/v1 \
output:crd:artifacts:config=crds/v1
create-crds: create-crds:
@kubectl create -k crds/v1 @kubectl create -k crds/v1
@@ -84,11 +115,17 @@ update-crds:
@kubectl replace -k crds/v1 @kubectl replace -k crds/v1
delete-crds: delete-crds:
@./hack/delete-crds.sh @kubectl delete -k crds/v1
### Cleanup
clean: clean:
@rm -f cmd/fission-bundle/fission-bundle @rm -f cmd/fission-bundle/fission-bundle
@rm -f cmd/fission-cli/fission @rm -f cmd/fission-cli/fission
@rm -f cmd/fetcher/fetcher @rm -f cmd/fetcher/fetcher
@rm -f cmd/fetcher/builder @rm -f cmd/fetcher/builder
@rm -f cmd/reporter/reporter @rm -f cmd/reporter/reporter
@rm -f pkg/apis/core/v1/types_swagger_doc_generated.go
### Misc
generate-swagger-doc:
@cd pkg/apis/core/v1/tool && ./update-generated-swagger-docs.sh
+2 -2
View File
@@ -43,10 +43,10 @@ Parameter | Description | Default
`routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer` `routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer`
`repository` | Image base repository | `index.docker.io` `repository` | Image base repository | `index.docker.io`
`image` | Fission image repository | `fission/fission-bundle` `image` | Fission image repository | `fission/fission-bundle`
`imageTag` | Fission image tag | `1.12.0` `imageTag` | Fission image tag | `1.13.0`
`pullPolicy` | Image pull policy | `IfNotPresent` `pullPolicy` | Image pull policy | `IfNotPresent`
`fetcher.image` | Fission fetcher repository | `fission/fetcher` `fetcher.image` | Fission fetcher repository | `fission/fetcher`
`fetcher.imageTag` | Fission fetcher image tag | `1.12.0` `fetcher.imageTag` | Fission fetcher image tag | `1.13.0`
`controllerPort` | Fission Controller service port | `31313` `controllerPort` | Fission Controller service port | `31313`
`routerPort` | Fission Router service port | ` 31314` `routerPort` | Fission Router service port | ` 31314`
`functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function` `functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function`
+7 -7
View File
@@ -1,18 +1,18 @@
apiVersion: v2 apiVersion: v2
name: fission-all name: fission-all
version: 1.12.0 version: 1.13.0
description: Fission is a fast serverless framework for Kubernetes. description: Fission is a fast serverless framework for Kubernetes.
keywords: keywords:
- fission - fission
- serverless - serverless
home: http://fission.io/ home: https://fission.io/
maintainers: maintainers:
- name: Soam Vasani - name: Vishal Biyani
email: soamvasani+1@gmail.com email: vishal@infracloud.io
- name: Ta Ching Chen - name: Sanket Sudake
email: hello@tachingchen.com email: sanket@infracloud.io
engine: gotpl engine: gotpl
appVersion: 1.12.0 appVersion: 1.13.0
type: application type: application
dependencies: dependencies:
- name: prometheus - name: prometheus
+2 -2
View File
@@ -20,7 +20,7 @@ image: fission/fission-bundle
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
## Fission image version ## Fission image version
imageTag: 1.12.0 imageTag: 1.13.0
## Port at which Fission controller service should be exposed ## Port at which Fission controller service should be exposed
controllerPort: 31313 controllerPort: 31313
@@ -50,7 +50,7 @@ fetcher:
## Fetcher repository ## Fetcher repository
image: fission/fetcher image: fission/fetcher
## Fetcher image version ## Fetcher image version
imageTag: 1.12.0 imageTag: 1.13.0
## Fetcher is only for to downloading or uploading archive. ## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary. ## Normally, you don't need to change the value here, unless necessary.
+7 -7
View File
@@ -1,18 +1,18 @@
apiVersion: v2 apiVersion: v2
name: fission-core name: fission-core
version: 1.12.0 version: 1.13.0
description: Fission is a fast serverless framework for Kubernetes. description: Fission is a fast serverless framework for Kubernetes.
keywords: keywords:
- fission - fission
- serverless - serverless
home: http://fission.io/ home: https://fission.io/
maintainers: maintainers:
- name: Soam Vasani - name: Vishal Biyani
email: soamvasani+1@gmail.com email: vishal@infracloud.io
- name: Ta Ching Chen - name: Sanket Sudake
email: hello@tachingchen.com email: sanket@infracloud.io
engine: gotpl engine: gotpl
appVersion: 1.12.0 appVersion: 1.13.0
type: application type: application
dependencies: dependencies:
- name: prometheus - name: prometheus
+2 -2
View File
@@ -17,7 +17,7 @@ repository: index.docker.io
image: fission/fission-bundle image: fission/fission-bundle
## Fission image version ## Fission image version
imageTag: 1.12.0 imageTag: 1.13.0
## Image pull policy ## Image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@@ -43,7 +43,7 @@ fetcher:
## Fetcher repository ## Fetcher repository
image: fission/fetcher image: fission/fetcher
## Fetcher image version ## Fetcher image version
imageTag: 1.12.0 imageTag: 1.13.0
## Fetcher is only for to downloading or uploading archive. ## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary. ## Normally, you don't need to change the value here, unless necessary.
+26 -43
View File
@@ -1,21 +1,17 @@
#### Fission release # Fission release
Prerequisites ## Prerequisites
-------------
1. Get a dockerhub account if you don't have one. 1. Get access to:
Get access to: a. [The fission dockerhub account](https://hub.docker.com/r/fission/), if you have access, you will see Fission listed in [your organizations](https://hub.docker.com/organizations/)
- The fission dockerhub account (https://hub.docker.com/r/fission/ if you have access, you will see Fission listed in your organizations: https://hub.docker.com/organizations/ ) b. [Fission-charts repo](https://github.com/fission/fission-charts)
- Fission-charts repo (https://github.com/fission/fission-charts) c. [Fission Documentation Repo](https://github.com/fission/docs.fission.io)
- Fission Documentation Repo (https://github.com/fission/docs.fission.io) d. [Fission main repo](https://github.com/fission/fission)
- Fission main repo (https://github.com/fission/fission)
2. Get a Github "personal access token": 2. Get a Github [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
Save the token to ~/.gh-access-token (make sure that the file is Save the token to ~/.github-token (make sure that the file is readable only by you)
readable only by you)
3. Go toolchain set up. 3. Go toolchain set up.
@@ -23,28 +19,24 @@ Prerequisites
`docker login` with your own username; get this username added to `docker login` with your own username; get this username added to
the fission team on dockerhub. the fission team on dockerhub.
4. Install changelog generator tool "github_changelog_generator": https://github.com/skywinder/github-changelog-generator 4. Install changelog generator tool [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)
5. Install realpath if you don't already have it : https://github.com/harto/realpath-osx (You can use the brew method on Mac) 5. Install realpath if you don't already have it : https://github.com/harto/realpath-osx (You can use the brew method on Mac)
6. Install gothub if you don't already have it : https://github.com/itchio/gothub 6. Install [Github CLI](https://cli.github.com/)
You just have to go get github.com/itchio/gothub, that'll install gothub in $GOPATH/bin. Ensure this is already
in $PATH env variable.
## Check that the build is green
Check that the build is green!
------------------------------
Fix the build if it is not green. DON'T proceed unless build is GREEN! Fix the build if it is not green. DON'T proceed unless build is GREEN!
## Updating [Fission Repo](https://github.com/fission/fission)
Updating Fission Repo (https://github.com/fission/fission)
------------------------------
1. cd to the top of the fission repo, create a branch: 1. cd to the top of the fission repo, create a branch:
```shell
git checkout -b release-X.Y.Z git checkout -b release-X.Y.Z
```
2. Change references of old version to new version in charts directory. You use replace and find all with a quick preview in your IDE. 2. Change references of old version to new version in charts directory. You use replace and find all with a quick preview in your IDE.
@@ -69,31 +61,30 @@ Updating Fission Repo (https://github.com/fission/fission)
8. Test build from master branch for sanity check and make sure the master build is green 8. Test build from master branch for sanity check and make sure the master build is green
Updating Fission Charts (https://github.com/fission/fission-charts) ## Updating [Fission Charts](https://github.com/fission/fission-charts)
------------------------------
a. Switch to fission/fission-charts repo and run `index.sh` in that repo. (Don't edit the index.yaml in this repo manually. index.sh generates it, using the helm repo CLI.) a. Switch to fission/fission-charts repo and run `index.sh` in that repo. (Don't edit the index.yaml in this repo manually. index.sh generates it, using the helm repo CLI.)
b. You should have index.yaml and fission-core-*, fission-all-* charts as change, add, commit and push it to repo. b. You should have index.yaml and fission-core-*, fission-all-* charts as change, add, commit and push it to repo.
9. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created. 1. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created.
Edit it and add links to: Edit it and add links to:
* Install guide in docs a. Install guide in docs
* Changelog.md b. Changelog.md
Before you save the release - UNCHECK the "This is a pre-release" checkbox. This mark the release as ready for consumption (If release is stable). Before you save the release - UNCHECK the "This is a pre-release" checkbox. This mark the release as ready for consumption (If release is stable).
Updating Fission Docs (https://github.com/fission/docs.fission.io) ## Updating [Fission Docs](https://github.com/fission/docs.fission.io)
------------------------------
10. Documentation Update 1. Documentation Update
a. Merge documentation PRs that are peer reviewed and get latest master locally. a. Merge documentation PRs that are peer reviewed and get latest master locally.
b. In the repo fission/docs.fission.io change version in version.sh file to latest version (x.y.z) and run build.sh script b. In the repo fission/docs.fission.io change version in version.sh file to latest version (x.y.z) and run build.sh script
c. ** ONLY ** in the dist/x.y.z directory i.e. current version directory - replace all references from previous release to current release. Please use your IDE as there will be thousands of references. c. **ONLY** in the dist/x.y.z directory i.e. current version directory - replace all references from previous release to current release. Please use your IDE as there will be thousands of references.
d.VERIFY: There should be changes only in dist/x.y.z - where x.y.z is current version and in following files: d.VERIFY: There should be changes only in dist/x.y.z - where x.y.z is current version and in following files:
@@ -101,14 +92,6 @@ d.VERIFY: There should be changes only in dist/x.y.z - where x.y.z is current ve
- dist/index.html - dist/index.html
- version.sh - version.sh
## Announce the release
Announce the release Announce the release on Fission Slack and Twitter.
--------------------
Announce the release on #contributors.
Update Fission.io
-----------------
Tell #marketing channel to update link
-219
View File
@@ -1,219 +0,0 @@
#!/bin/bash
set -e
#set -x
DIR=`realpath $(dirname $0)/../`
BUILDDIR=$(realpath $DIR)/build
# Build CLI binaries for mac/linux/windows
build_all_cli() {
local version=$1
local date=$2
local gitcommit=$3
build_cli "linux" "linux" $version $date $gitcommit
build_cli "darwin" "osx" $version $date $gitcommit
build_cli "windows" "windows" $version $date $gitcommit
}
# Build cli binary for one OS, and put it in $BUILDDIR/cli/<os>/
build_cli() {
os=$1
osName=$2
local version=$3
local date=$4
local gitcommit=$5
arch="amd64" # parameterize if/when we need to
pushd $DIR/cmd/fission-cli
if [ "$osName" == "windows" ]
then
binary=fission-cli-${osName}.exe
else
binary=fission-cli-${osName}
fi
GOOS=$os GOARCH=$arch go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=$gitcommit -X github.com/fission/fission/pkg/info.BuildDate=$date -X github.com/fission/fission/pkg/info.Version=$version" -o $binary .
outdir=$BUILDDIR/cli/$osName/
mkdir -p $outdir
mv $binary $outdir
popd
}
# Build fission-bundle image
build_fission_bundle_image() {
local version=$1
local date=$2
local gitcommit=$3
local tag=fission/fission-bundle:$version
docker build -t $tag -f $DIR/cmd/fission-bundle/Dockerfile.fission-bundle --build-arg GITCOMMIT=$gitcommit \
--build-arg BUILDDATE=$date --build-arg BUILDVERSION=$version $DIR
docker tag $tag fission/fission-bundle:latest
}
build_fetcher_image() {
local version=$1
local date=$2
local gitcommit=$3
local tag=fission/fetcher:$version
docker build -t $tag -f $DIR/cmd/fetcher/Dockerfile.fission-fetcher --build-arg GITCOMMIT=$gitcommit \
--build-arg BUILDDATE=$date --build-arg BUILDVERSION=$version $DIR
docker tag $tag fission/fetcher:latest
}
push_fetcher_image() {
local version=$1
local tag=fission/fetcher:$version
}
build_builder_image() {
local version=$1
local date=$2
local gitcommit=$3
local tag=fission/builder:$version
docker build -t $tag -f $DIR/cmd/builder/Dockerfile.fission-builder --build-arg GITCOMMIT=$gitcommit \
--build-arg BUILDDATE=$date --build-arg BUILDVERSION=$version $DIR
docker tag $tag fission/builder:latest
}
# Build reporter image
build_reporter_image() {
local version=$1
local date=$2
local gitcommit=$3
local tag=fission/reporter:$version
docker build -t $tag -f $DIR/cmd/reporter/Dockerfile.reporter \
--build-arg GITCOMMIT=$gitcommit --build-arg BUILDDATE=$date --build-arg BUILDVERSION=$version $DIR
docker tag $tag fission/reporter:latest
}
# Build pre-upgrade-checks image
build_pre_upgrade_checks_image() {
local version=$1
local date=$2
local gitcommit=$3
local tag=fission/pre-upgrade-checks:$version
docker build -t $tag -f $DIR/cmd/preupgradechecks/Dockerfile.fission-preupgradechecks \
--build-arg GITCOMMIT=$gitcommit --build-arg BUILDDATE=$date --build-arg BUILDVERSION=$version $DIR
docker tag $tag fission/pre-upgrade-checks:latest
}
build_charts() {
local version=$1
mkdir -p $BUILDDIR/charts
pushd $DIR/charts
find . -iname *.~?~ | xargs -r rm
for c in fission-all fission-core
do
helm package -u $c/
mv *.tgz $BUILDDIR/charts/
done
popd
}
build_yamls() {
local version=$1
mkdir -p ${BUILDDIR}/yamls
pushd ${DIR}/charts
find . -iname *.~?~ | xargs -r rm
releaseName=fission-$(echo ${version} | sed 's/\./-/g')
for c in fission-all fission-core
do
# fetch dependencies
pushd ${c}
helm dependency update
popd
# for minikube and other environments that don't support LoadBalancer
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort > ${c}-${version}-minikube.yaml
# for environments that support LoadBalancer
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true > ${c}-${version}.yaml
# for OpenShift
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false > ${c}-${version}-openshift.yaml
# copy yaml files to build directory
mv *.yaml ${BUILDDIR}/yamls/
done
popd
}
build_all() {
local version=$1
if [ -z "$version" ]
then
echo "Version unspecified"
exit 1
fi
local date=$2
if [ -z "$date" ]
then
echo "Build date unspecified"
exit 1
fi
local gitcommit=$3
if [ -z "gitcommit" ]
then
echo "Git commit unspecified"
exit 1
fi
if [ -e $BUILDDIR ]
then
echo "Removing existing build dir ($BUILDDIR)."
rm -rf $BUILDDIR
fi
mkdir -p $BUILDDIR
# generate swagger (OpenApi 2.0) doc before building bundle image
generate_swagger_doc
build_fission_bundle_image $version $date $gitcommit
build_fetcher_image $version $date $gitcommit
build_builder_image $version $date $gitcommit
build_all_cli $version $date $gitcommit
build_pre_upgrade_checks_image $version $date $gitcommit
build_reporter_image $version $date $gitcommit
remove_generated_swagger_doc
}
generate_swagger_doc() {
pushd $DIR/pkg/apis/core/v1/tool
./update-generated-swagger-docs.sh
popd
}
remove_generated_swagger_doc() {
rm $DIR/pkg/apis/core/v1/types_swagger_doc_generated.go
}
version=${VERSION}
date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
gitcommit=$(git rev-parse HEAD)
build_all $version $date $gitcommit
build_charts $version
build_yamls $version
+207 -234
View File
@@ -6,214 +6,57 @@ set -e
DIR=$(realpath $(dirname $0))/../ DIR=$(realpath $(dirname $0))/../
BUILDDIR=$(realpath $DIR)/build BUILDDIR=$(realpath $DIR)/build
artifacts=()
source $(realpath ${DIR}/test/init_tools.sh) source $(realpath ${DIR}/test/init_tools.sh)
# Ensure we're on the master branch # Ensure we're on the master branch
check_branch() { check_branch() {
local version=$1 local version=$1
curr_branch=$(git rev-parse --abbrev-ref HEAD) curr_branch=$(git rev-parse --abbrev-ref HEAD)
if [ $curr_branch != "release-${version}" ] if [ $curr_branch != "release-${version}" ]; then
then
echo "Not on release-${version} branch." echo "Not on release-${version} branch."
exit 1 exit 1
fi fi
} }
# Ensure working dir is clean # Ensure working dir is clean
check_clean() { check_clean() {
if ! git diff-index --quiet HEAD -- if ! git diff-index --quiet HEAD --; then
then
echo "Unclean tree" echo "Unclean tree"
exit 1 exit 1
fi fi
} }
# Push fission-bundle image
push_fission_bundle_image() {
local version=$1
local tag=fission/fission-bundle:$version
docker push $tag
}
push_fetcher_image() {
local version=$1
local tag=fission/fetcher:$version
docker push $tag
}
push_builder_image() {
local version=$1
local tag=fission/builder:$version
docker push $tag
}
# Push pre-upgrade-checks image
push_pre_upgrade_checks_image() {
local version=$1
local tag=fission/pre-upgrade-checks:$version
docker push $tag
}
push_all() {
local version=$1
push_fission_bundle_image $version
push_fission_bundle_image latest
push_fetcher_image $version
push_fetcher_image latest
push_builder_image $version
push_builder_image latest
push_pre_upgrade_checks_image $version
push_pre_upgrade_checks_image latest
}
# Build and push fission-bundle image
push_multiarch_fission_bundle_image() {
TAG=$1 make multiarch-bundle
}
push_multiarch_fetcher_image() {
TAG=$1 make multiarch-fetcher
}
push_builder_image() {
TAG=$1 make multiarch-builder
}
# Push pre-upgrade-checks image
push_pre_upgrade_checks_image() {
TAG=$1 make multiarch-preupgrade
}
push_builder_image() {
TAG=$1 make multiarch-reporter
}
push_multiarch_all() {
TAG=$version make image-multiarch
TAG=latest make image-multiarch
}
tag_and_release() {
local version=$1
local gittag=$version
local prefix="v"
local gopkgtag=${version/#/${prefix}}
if [[ ${version} == v* ]]; # if version starts with "v", don't append prefix.
then
gopkgtag=${version}
fi
# tag the release
git tag $gittag
git tag -a $gopkgtag -m "Fission $gopkgtag"
# push tag
git push origin $gittag
git push origin $gopkgtag
# create gh release
gothub release \
--user fission \
--repo fission \
--tag $gittag \
--name "$version" \
--description "$version" \
--pre-release
}
attach_github_release_cli() { attach_github_release_cli() {
local version=$1
local gittag=$version
# cli # cli
echo "Uploading osx cli" echo "Artifact for osx amd64 cli"
gothub upload \ artifacts+=("$BUILDDIR/darwin/amd64/$version/fission#fission-cli-osx")
--replace \ echo "Artifact for windows amd64 cli"
--user fission \ artifacts+=("$BUILDDIR/windows/amd64/$version/fission.exe#fission-cli-windows.exe")
--repo fission \ echo "Artifact for linux amd64 cli"
--tag $gittag \ artifacts+=("$BUILDDIR/linux/amd64/$version/fission#fission-cli-linux")
--name fission-cli-osx \ echo "Artifact for linux arm cli"
--file $BUILDDIR/cli/osx/fission-cli-osx artifacts+=("$BUILDDIR/linux/arm/$version/fission#fission-cli-linux-arm")
echo "Artifact for linux arm64 cli"
echo "Uploading linux cli" artifacts+=("$BUILDDIR/linux/arm64/$version/fission#fission-cli-linux-arm64")
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name fission-cli-linux \
--file $BUILDDIR/cli/linux/fission-cli-linux
echo "Uploading windows cli"
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name fission-cli-windows.exe \
--file $BUILDDIR/cli/windows/fission-cli-windows.exe
} }
attach_github_release_charts() { attach_github_release_charts() {
local version=$1 local version=$1
local gittag=$version echo "fission-all chart"
artifacts+=("$BUILDDIR/charts/fission-all-$version.tgz#fission-all-$version.tgz")
# helm charts echo "Fission-core chart"
gothub upload \ artifacts+=("$BUILDDIR/charts/fission-core-$version.tgz#fission-core-$version.tgz")
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name fission-all-$version.tgz \
--file $BUILDDIR/charts/fission-all-$version.tgz
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name fission-core-$version.tgz \
--file $BUILDDIR/charts/fission-core-$version.tgz
} }
attach_github_release_yamls() { attach_github_release_yamls() {
local version=$1 local version=$1
local gittag=$version
for c in fission-all fission-core for c in fission-all fission-core; do
do
# YAML # YAML
gothub upload \ artifacts+=("$BUILDDIR/yamls/${c}-${version}-minikube.yaml#${c}-${version}-minikube.yaml")
--replace \ artifacts+=("$BUILDDIR/yamls/${c}-${version}.yaml#${c}-${version}.yaml")
--user fission \ artifacts+=("$BUILDDIR/yamls/${c}-${version}-openshift.yaml#${c}-${version}-openshift.yaml")
--repo fission \
--tag $gittag \
--name ${c}-${version}-minikube.yaml \
--file $BUILDDIR/yamls/${c}-${version}-minikube.yaml
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name ${c}-${version}.yaml \
--file $BUILDDIR/yamls/${c}-${version}.yaml
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name ${c}-${version}-openshift.yaml \
--file $BUILDDIR/yamls/${c}-${version}-openshift.yaml
done done
} }
@@ -228,102 +71,232 @@ update_github_charts_repo() {
popd popd
} }
tag_and_release() {
local version=$1
local gittag=$version
local prefix="v"
local gopkgtag=${version/#/${prefix}}
if [[ ${version} == v* ]]; then # if version starts with "v", don't append prefix.
gopkgtag=${version}
fi
# tag the release
git tag $gittag
git tag -a $gopkgtag -m "Fission $gopkgtag"
# push tag
git push origin $gittag
git push origin $gopkgtag
relnotes="
Install Guide: https://docs.fission.io/installation/
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md
"
gh release create $gittag --prerelease --title $gittag --notes $relnotes --target $gitcommit ${artifacts[@]}
}
generate_changelog() { generate_changelog() {
local version=$1 local version=$1
echo "# ${version}" > new_CHANGELOG.md echo "# ${version}" >new_CHANGELOG.md
echo echo
echo "[Documentation](https://docs.fission.io/)" >> new_CHANGELOG.md echo "[Documentation](https://docs.fission.io/)" >>new_CHANGELOG.md
echo echo
create_downloads_table ${version} >> new_CHANGELOG.md create_downloads_table ${version} >>new_CHANGELOG.md
# generate changelog from github # generate changelog from github
github_changelog_generator -u fission -p fission -t ${GITHUB_TOKEN} --future-release ${version} --no-issues -o tmp_CHANGELOG.md github_changelog_generator -u fission -p fission -t ${GITHUB_TOKEN} --future-release ${version} --no-issues -o tmp_CHANGELOG.md
sed -i '$ d' tmp_CHANGELOG.md sed -i '$ d' tmp_CHANGELOG.md
# concatenate two files # concatenate two files
cat tmp_CHANGELOG.md >> new_CHANGELOG.md cat tmp_CHANGELOG.md >>new_CHANGELOG.md
mv new_CHANGELOG.md ${DIR}/CHANGELOG.md mv new_CHANGELOG.md ${DIR}/CHANGELOG.md
rm tmp_CHANGELOG.md rm tmp_CHANGELOG.md
} }
create_downloads_table () { create_downloads_table() {
local release_tag=$1 local release_tag=$1
local url_prefix="https://github.com/fission/fission/releases/download" local url_prefix="https://github.com/fission/fission/releases/download"
echo "## Downloads for ${version}" echo "## Downloads for ${version}"
echo echo
local files=$(find build -name '*' -type f) local files=$(find build -name '*' -type f)
echo echo
echo "filename | sha256 hash" echo "filename | sha256 hash"
echo "-------- | -----------" echo "-------- | -----------"
for file in $files; do for file in ${artifacts[@]}; do
echo "[${file##*/}]($url_prefix/$release_tag/${file##*/}) | \`$(shasum -a 256 $file | cut -d' ' -f 1)\`" filepath=$(echo $file | cut -d'#' -f 1)
done filename=$(echo $file | cut -d'#' -f 2)
echo echo "[${filename}]($url_prefix/$release_tag/${filename}) | \`$(shasum -a 256 ${filepath} | cut -d' ' -f 1)\`"
done
echo
} }
export -f create_downloads_table export -f create_downloads_table
release_environment_check() { release_environment_check() {
local version=$1 local version=$1
local chartsrepo=$2 local chartsrepo=$2
check_branch $version check_branch $version
check_clean check_clean
if [ ! -f $HOME/.gh-access-token ] if [ ! -f $HOME/.github-token ]; then
then echo "Error finding github access token at ${HOME}/.github-token"
echo "Error finding github access token at ${HOME}/.gh-access-token." exit 1
exit 1 fi
fi
if [ ! -d $chartsrepo ] if [ ! -d $chartsrepo ]; then
then echo "Error finding chart repo at $chartsrepo"
echo "Error finding chart repo at $GOPATH/src/github.com/fission/fission-charts" exit 1
exit 1 fi
fi
if [ ! -d $FISSION_HOME ] if [ ! -d $FISSION_HOME ]; then
then echo "The FISSION_HOME variable should be set to directory where Fission and fission-charts are checked out"
echo "The FISSION_HOME variable should be set to directory where Fission and fission-charts are checked out" exit 1
exit 1 fi
fi
} }
export GITHUB_TOKEN=$(cat ~/.gh-access-token) build_charts() {
local version=$1
mkdir -p $BUILDDIR/charts
pushd $DIR/charts
find . -iname *.~?~ | xargs -r rm
for c in fission-all fission-core; do
helm package -u $c/
mv *.tgz $BUILDDIR/charts/
done
popd
}
build_yamls() {
local version=$1
mkdir -p ${BUILDDIR}/yamls
pushd ${DIR}/charts
find . -iname *.~?~ | xargs -r rm
releaseName=fission-$(echo ${version} | sed 's/\./-/g')
for c in fission-all fission-core; do
# fetch dependencies
pushd ${c}
helm dependency update
popd
# for minikube and other environments that don't support LoadBalancer
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort >${c}-${version}-minikube.yaml
# for environments that support LoadBalancer
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true >${c}-${version}.yaml
# for OpenShift
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false >${c}-${version}-openshift.yaml
# copy yaml files to build directory
mv *.yaml ${BUILDDIR}/yamls/
done
popd
}
build_all() {
local version=$1
if [ -z "$version" ]; then
echo "Version unspecified"
exit 1
fi
local date=$2
if [ -z "$date" ]; then
echo "Build date unspecified"
exit 1
fi
local gitcommit=$3
if [ -z "gitcommit" ]; then
echo "Git commit unspecified"
exit 1
fi
if [ -e $BUILDDIR ]; then
echo "Removing existing build dir ($BUILDDIR)."
rm -rf $BUILDDIR
fi
mkdir -p $BUILDDIR
# generate swagger (OpenApi 2.0) doc before building bundle image
VERSION=$version TIMESTAMP=$date COMMITSHA=$gitcommit make generate-swagger-doc
# Build CLI for all platforms
VERSION=$version TIMESTAMP=$date COMMITSHA=$gitcommit make all-fission-cli
}
build_images() {
local version=$1
if [ -z "$version" ]; then
echo "Version unspecified"
exit 1
fi
local date=$2
if [ -z "$date" ]; then
echo "Build date unspecified"
exit 1
fi
local gitcommit=$3
if [ -z "gitcommit" ]; then
echo "Git commit unspecified"
exit 1
fi
# Build and push all images
VERSION=$version TAG=$version TIMESTAMP=$date COMMITSHA=$gitcommit make all-images
VERSION=$version TAG=latest TIMESTAMP=$date COMMITSHA=$gitcommit make all-images
}
check_commands() {
if ! command -v hub >/dev/null; then
echo "Github CLI hub not found. Please get from https://cli.github.com/"
fi
}
export GITHUB_TOKEN=$(cat ~/.github-token)
version=$1 version=$1
chartsrepo=$2 if [ -z $version ]; then
echo "Release version not mentioned"
if [ -z $chartsrepo ] exit 1
then
chartsrepo="$DIR../fission-charts"
fi fi
date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
gitcommit=$(git rev-parse HEAD)
chartsrepo=$2
if [ -z $chartsrepo ]; then
chartsrepo="$DIR../fission-charts"
fi
check_commands
release_environment_check $version $chartsrepo release_environment_check $version $chartsrepo
build_all $version $date $gitcommit
# build_images $version $date $gitcommit
build_charts $version
build_yamls $version
# Build release-builder image
#docker build -t fission-release-builder -f $FISSION_HOME/fission/hack/Dockerfile .
# Build all binaries & container images in docker
# Here we mount docker.sock into container so that docker client can communicate with host docker daemon.
# For more detail please visit https://docs.docker.com/machine/overview/
docker run --rm -it -v $FISSION_HOME:/go/src/github.com/fission -v /var/run/docker.sock:/var/run/docker.sock \
-e VERSION=$version -w "/go/src/github.com/fission/fission/hack" fission-release-builder sh -c "./release-build.sh"
push_multiarch_all $version
tag_and_release $version
attach_github_release_cli $version attach_github_release_cli $version
attach_github_release_charts $version attach_github_release_charts $version
attach_github_release_yamls $version attach_github_release_yamls $version
update_github_charts_repo $version $chartsrepo update_github_charts_repo $version $chartsrepo
generate_changelog $version generate_changelog $version
tag_and_release $version
echo "############ DONE #############" echo "############ DONE #############"
echo "Congratulation, ${version} is ready to ship !!" echo "Congratulation, ${version} is ready to ship !!"