Skip to content

Commit

Permalink
CI Release (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode authored Oct 24, 2019
1 parent 83f1f46 commit b9ff9e8
Show file tree
Hide file tree
Showing 15 changed files with 584 additions and 24 deletions.
80 changes: 80 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,83 @@ steps:
commands:
- wget -qO- https://github.com/fossas/fossa-cli/releases/download/v1.0.11/fossa-cli_1.0.11_linux_amd64.tar.gz | tar xvz -C /go/bin/
- /go/bin/fossa test

---
kind: pipeline
type: docker
name: release

platform:
os: linux
arch: amd64

trigger:
event:
include:
- tag

steps:
- name: license-scan
image: golang:1.13
environment:
FOSSA_API_KEY:
from_secret: fossa_api_key
commands:
- wget -qO- https://github.com/fossas/fossa-cli/releases/download/v1.0.11/fossa-cli_1.0.11_linux_amd64.tar.gz | tar xvz -C /go/bin/
- /go/bin/fossa analyze

- name: build
image: golang:1.13
commands:
- make ci

- name: lint
image: golangci/golangci-lint:v1.21.0
commands:
- golangci-lint run

- name: license-check
image: golang:1.13
environment:
FOSSA_API_KEY:
from_secret: fossa_api_key
commands:
- wget -qO- https://github.com/fossas/fossa-cli/releases/download/v1.0.11/fossa-cli_1.0.11_linux_amd64.tar.gz | tar xvz -C /go/bin/
- /go/bin/fossa test

- name: create-dist
image: golang:1.13
commands:
- go run tools/create-artifacts/main.go -version ${DRONE_TAG} -commit ${DRONE_COMMIT} -goversion `go version | awk '{print $$3}'`

- name: publish
image: plugins/github-release
settings:
api_key:
from_secret: github_token
files: dist/*
note: changelog/NOTE.md

- name: docker-reva-tag
pull: always
image: plugins/docker
settings:
repo: cs3org/reva
tags: ${DRONE_TAG}
dockerfile: Dockerfile.reva
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password

- name: docker-revad-tag
pull: always
image: plugins/docker
settings:
repo: cs3org/revad
tags: ${DRONE_TAG}
dockerfile: Dockerfile.revad
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
cmd/revad/revad
cmd/revad/revad.pid
cmd/reva/reva
tools/release/release

# Ignore pid files
*.pid
Expand All @@ -33,3 +34,4 @@ docs/node_modules/
docs/tech-doc-hugo
docs/themes/

dist/
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Changelog for Reva unreleased (UNRELEASED)
=======================================

The following sections list the changes in Reva unreleased relevant to
Reva users. The changes are ordered by importance.

Summary
-------

* Enh #243: Create reference when accepting a share

Details
-------

* Enhancement #243: Create reference when accepting a share

When accepting a share only the state information changed for the share was not merged into the
user tree. Now after accepting a share, the share is mounted into the user tree in a location
specified by the user.

https://github.com/reva/reva/pull/243


39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "dirty-"`
VERSION=`git describe --always`
GO_VERSION=`go version | awk '{print $$3}'`
BUILD_PLATFORM=`go version | awk '{print $$4}'`

LDFLAGS=-ldflags "-s -X main.buildDate=${BUILD_DATE} -X main.gitCommit=${GIT_DIRTY}${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH} -X main.version=${VERSION} -X main.goVersion=${GO_VERSION} -X main.buildPlatform=${BUILD_PLATFORM}"

off:
GORPOXY=off
echo BUILD_DATE=${BUILD_DATE}
echo GIT_COMMIT=${GIT_COMMIT}
echo GIT_DIRTY=${GIT_DIRTY}
echo VERSION=${VERSION}
echo GO_VERSION=${GO_VERSION}

imports: off
goimports -w tools pkg internal cmd

build: imports
go build -mod=vendor -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad
go build -mod=vendor -o ./cmd/reva/reva ${LDFLAGS} ./cmd/reva
go build -mod=vendor -o ./cmd/revad/revad ./cmd/revad
go build -mod=vendor -o ./cmd/reva/reva ./cmd/reva

tidy:
go mod tidy

build-revad: imports
go build -mod=vendor -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad
go build -mod=vendor -o ./cmd/revad/revad ./cmd/revad

build-reva: imports
go build -mod=vendor -o ./cmd/reva/reva ${LDFLAGS} ./cmd/reva
go build -mod=vendor -o ./cmd/reva/reva ./cmd/reva

test: off
go test -mod=vendor -race ./...
Expand All @@ -42,12 +44,13 @@ contrib:

# for manual building only
deps:
cd /tmp && go get github.com/golangci/golangci-lint/cmd/golangci-lint
cd /tmp && rm -rf golangci-lint && git clone --quiet -b 'v1.21.0' --single-branch --depth 1 https://github.com/golangci/golangci-lint &> /dev/null && cd golangci-lint/cmd/golangci-lint && go install
cd /tmp && go get golang.org/x/tools/cmd/goimports

build-ci: off
go build -mod=vendor -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad
go build -mod=vendor -o ./cmd/reva/reva ${LDFLAGS} ./cmd/reva
go build -mod=vendor -o ./cmd/revad/revad ./cmd/revad
go build -mod=vendor -o ./cmd/reva/reva ./cmd/reva

lint-ci:
go run tools/check-license/check-license.go

Expand All @@ -57,7 +60,19 @@ ci: build-ci test lint-ci

# to be run in Docker build
build-revad-docker: off
go build -mod=vendor -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad
go build -mod=vendor -o ./cmd/revad/revad ./cmd/revad
build-reva-docker: off
go build -mod=vendor -o ./cmd/revad/reva ${LDFLAGS} ./cmd/reva
go build -mod=vendor -o ./cmd/revad/reva ./cmd/reva
clean:
rm -rf dist

# for releasing you need to run: go run tools/prepare-release/main.go
# $ go run tools/prepare-release/main.go -version 0.0.1 -commit -tag
release-deps:
cd /tmp && go get github.com/restic/calens

# create local build versions
dist: default
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}

all: deps default
32 changes: 32 additions & 0 deletions changelog/CHANGELOG.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- range $changes := . }}{{ with $changes -}}
Changelog for Reva {{ .Version }} ({{ .Date }})
=======================================

The following sections list the changes in Reva {{ .Version }} relevant to
Reva users. The changes are ordered by importance.

Summary
-------
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .TypeShort }} #{{ .PrimaryID }}: {{ .Title }}
{{- end }}{{ end }}

Details
-------
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .Type }} #{{ .PrimaryID }}: {{ .Title }}
{{ range $par := .Paragraphs }}
{{ wrap $par 80 3 }}
{{ end -}}
{{ range $url := .IssueURLs }}
{{ $url -}}
{{ end -}}
{{ range $url := .PRURLs }}
{{ $url -}}
{{ end -}}
{{ range $url := .OtherURLs }}
{{ $url -}}
{{ end }}
{{ end }}{{ end }}

{{ end }}{{ end -}}
14 changes: 14 additions & 0 deletions changelog/TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Bugfix: Fix behavior for foobar (in present tense)

We've fixed the behavior for foobar, a long-standing annoyance for Reva
users.

The text in the paragraphs is written in past tense. The last section is a list
of issue URLs, PR URLs and other URLs. The first issue ID (or the first PR ID,
in case there aren't any issue links) is used as the primary ID.

https://github.com/cs3org/reva/issues/292
https://github.com/cs3org/reva/pull/323

Note: you can use Bugfix or Enhancement as the first keyword to denote
either a bufix or an improvement.
31 changes: 31 additions & 0 deletions changelog/changelog-github.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- range $changes := . }}{{ with $changes -}}
Changelog for Reva {{ .Version }} ({{ .Date }})
=======================================

The following sections list the changes in Reva {{ .Version }} relevant to Reva users. The changes are ordered by importance.

Summary
-------
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .TypeShort }} [#{{ .PrimaryID }}]({{ .PrimaryURL }}): {{ .Title }}
{{- end }}{{ end }}

Details
-------
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .Type }} #{{ .PrimaryID }}: {{ .Title }}
{{ range $par := .Paragraphs }}
{{ $par }}
{{ end }}
{{ range $id := .Issues -}}
{{ ` ` }}[#{{ $id }}](https://github.com/reva/reva/issues/{{ $id -}})
{{- end -}}
{{ range $id := .PRs -}}
{{ ` ` }}[#{{ $id }}](https://github.com/reva/reva/pull/{{ $id -}})
{{- end -}}
{{ ` ` }}{{ range $url := .OtherURLs -}}
{{ $url -}}
{{- end }}
{{ end }}{{ end }}

{{ end }}{{ end -}}
8 changes: 8 additions & 0 deletions changelog/unreleased/pull-334
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Create release procedure for Reva

Reva did not have any procedure to release versions.
This PR brings a new tool to release Reva versions (tools/release)
and prepares the necessary files for artefact distributed made from Drone
into Github pages.

https://github.com/reva/reva/pull/334
3 changes: 1 addition & 2 deletions cmd/reva/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import (
var (
conf *config

// Compile time variables
gitCommit, gitBranch, buildDate, version, goVersion, buildPlatform string
gitCommit, buildDate, version, goVersion string
)

func main() {
Expand Down
6 changes: 2 additions & 4 deletions cmd/reva/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ var versionCommand = func() *command {
cmd.Action = func() error {
msg := "version=%s "
msg += "commit=%s "
msg += "branch=%s "
msg += "go_version=%s "
msg += "build_date=%s "
msg += "build_platform=%s\n"
msg += "build_date=%s\n"

fmt.Printf(msg, version, gitCommit, gitBranch, goVersion, buildDate, buildPlatform)
fmt.Printf(msg, version, gitCommit, goVersion, buildDate)
return nil
}
return cmd
Expand Down
8 changes: 3 additions & 5 deletions cmd/revad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var (
pidFlag = flag.String("p", "", "pid file. If empty defaults to a random file in the OS temporary directory")

// Compile time variables initialez with gcc flags.
gitCommit, gitBranch, buildDate, version, goVersion, buildPlatform string
gitCommit, buildDate, version, goVersion string
)

type coreConf struct {
Expand Down Expand Up @@ -190,12 +190,10 @@ func getWriter(out string) (io.Writer, error) {
func getVersionString() string {
msg := "version=%s "
msg += "commit=%s "
msg += "branch=%s "
msg += "go_version=%s "
msg += "build_date=%s "
msg += "build_platform=%s"
msg += "build_date=%s"

return fmt.Sprintf(msg, version, gitCommit, gitBranch, goVersion, buildDate, buildPlatform)
return fmt.Sprintf(msg, version, gitCommit, goVersion, buildDate)
}

func handleVersionFlag() {
Expand Down
8 changes: 8 additions & 0 deletions docs/content/en/docs/Changelog/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Changelog"
linkTitle: "Changelog"
weight: 40
description: >
Changelog of Reva releases
---

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ require (
github.com/pkg/errors v0.8.1
github.com/pkg/xattr v0.4.1
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 // indirect
github.com/rs/cors v1.7.0
github.com/rs/zerolog v1.15.0
go.opencensus.io v0.22.1
Expand Down
Loading

0 comments on commit b9ff9e8

Please sign in to comment.