Add Drone pipeline to test packaging (#6482)

* Add Drone pipeline to test packaging
Currently, the packaging process only happens on tags, which could lead to surprises
Especially considering I'm working on deb and RPM packaging (lots more steps than now)

I also moved the publishing from Circle to Drone because:
1. I'll need some new secrets from Vault
2. It should be faster

* Fix make target

* Remove `-parallel` arg for `gox`
pull/6516/head
Julien Duchesne 4 years ago committed by GitHub
parent 4c90d57e68
commit 6a9557a1e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .circleci/config.yml
  2. 24
      .drone/drone.jsonnet
  3. 30
      .drone/drone.yml
  4. 5
      Makefile
  5. 2
      tools/nfpm.yaml
  6. 8
      tools/release
  7. 8
      tools/release-note.md

@ -32,10 +32,6 @@ workflows:
requires: [test]
filters: { <<: *tag-or-main }
- publish/binaries:
requires: [test]
filters: { <<: *only-tags }
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
.defaults: &defaults
@ -81,10 +77,3 @@ jobs:
name: docker-driver
command: make docker-driver-push
publish/binaries:
<<: *defaults
steps:
- checkout
- run:
name: github release
command: make BUILD_IN_CONTAINER=false publish

@ -496,13 +496,11 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
fluentd(),
logstash(),
querytee(),
] + [
manifest(['promtail', 'loki', 'loki-canary']) {
trigger: condition('include').tagMain {
event: ['push', 'tag'],
},
},
] + [
pipeline('deploy') {
trigger: condition('include').tagMain {
event: ['push', 'tag'],
@ -533,7 +531,27 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
],
},
] + [promtail_win()]
promtail_win(),
pipeline('release') {
trigger: {
event: ['pull_request', 'tag'],
},
image_pull_secrets: [pull_secret.name],
steps: [
run(
'test packaging',
commands=['make BUILD_IN_CONTAINER=false packages']
) { when: { event: ['pull_request'] } },
run(
'publish',
commands=['make BUILD_IN_CONTAINER=false publish'],
env={
GITHUB_TOKEN: { from_secret: github_secret.name },
}
) { when: { event: ['tag'] } },
],
},
]
+ [
lambda_promtail(arch)
for arch in ['amd64', 'arm64']

@ -1072,6 +1072,34 @@ trigger:
- pull_request
- tag
---
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: release
steps:
- commands:
- make BUILD_IN_CONTAINER=false packages
environment: {}
image: grafana/loki-build-image:0.21.0
name: test packaging
when:
event:
- pull_request
- commands:
- make BUILD_IN_CONTAINER=false publish
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/loki-build-image:0.21.0
name: publish
when:
event:
- tag
trigger:
event:
- pull_request
- tag
---
depends_on:
- check
kind: pipeline
@ -1285,6 +1313,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: 8335495d285498f513bb265cf90079175c25f5b6c5717deab7abfae65341726a
hmac: e56633097c3edb68fc784f2059f5c773f02ac485750610aaff59b43eb1417c5b
...

@ -245,9 +245,8 @@ cmd/migrate/migrate:
#############
# Releasing #
#############
# concurrency is limited to 2 to prevent CircleCI from OOMing. Sorry
GOX = gox $(GO_FLAGS) -parallel=2 -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
CGO_GOX = gox $(DYN_GO_FLAGS) -cgo -parallel=2 -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
GOX = gox $(GO_FLAGS) -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
CGO_GOX = gox $(DYN_GO_FLAGS) -cgo -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
dist: clean
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/logcli

@ -2,7 +2,7 @@
name: "logcli"
arch: "amd64"
platform: "linux"
version: ${CIRCLE_TAG}
version: ${DRONE_TAG}
section: "default"
provides:
- logcli

@ -1,9 +1,9 @@
#!/usr/bin/env bash
ghr \
-t "${GITHUB_TOKEN}" \
-u "${CIRCLE_PROJECT_USERNAME}" \
-r "${CIRCLE_PROJECT_REPONAME}" \
-c "${CIRCLE_SHA1}" \
-u "${DRONE_REPO_OWNER}" \
-r "${DRONE_REPO_NAME}" \
-c "${DRONE_COMMIT}" \
-b="$(cat ./tools/release-note.md | envsubst)" \
-delete -draft \
"${CIRCLE_TAG}" ./dist/
"${DRONE_TAG}" ./dist/

@ -1,4 +1,4 @@
This is release `${CIRCLE_TAG}` of Loki.
This is release `${DRONE_TAG}` of Loki.
### Notable changes:
:warning: **ADD RELEASE NOTES HERE** :warning:
@ -11,8 +11,8 @@ The components of Loki are currently distributed in plain binary form and as Doc
* https://hub.docker.com/r/grafana/loki
* https://hub.docker.com/r/grafana/promtail
```bash
$ docker pull "grafana/loki:${CIRCLE_TAG}"
$ docker pull "grafana/promtail:${CIRCLE_TAG}"
$ docker pull "grafana/loki:${DRONE_TAG}"
$ docker pull "grafana/promtail:${DRONE_TAG}"
```
#### Binary
@ -21,7 +21,7 @@ Choose from the assets below for the application and architecture matching your
Example for `Loki` on the `linux` operating system and `amd64` architecture:
```bash
$ curl -O -L "https://github.com/grafana/loki/releases/download/${CIRCLE_TAG}/loki-linux-amd64.zip"
$ curl -O -L "https://github.com/grafana/loki/releases/download/${DRONE_TAG}/loki-linux-amd64.zip"
# extract the binary
$ unzip "loki-linux-amd64.zip"
# make sure it is executable

Loading…
Cancel
Save