Skip to content

Commit

Permalink
ci: allow release-please to accept manifest in config mode (#12040)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney authored Feb 22, 2024
1 parent 2151471 commit 85ef0d0
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 876 deletions.
253 changes: 0 additions & 253 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,6 @@ local promtail_win() = pipeline('promtail-windows') {

local querytee() = pipeline('querytee-amd64') + arch_image('amd64', 'main') {
steps+: [
// dry run for everything that is not tag or main
docker('amd64', 'querytee') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
repo: 'grafana/loki-query-tee',
},
},
] + [
// publish for tag or main
docker('amd64', 'querytee') {
depends_on: ['image-tag'],
Expand All @@ -196,21 +186,10 @@ local querytee() = pipeline('querytee-amd64') + arch_image('amd64', 'main') {
},
},
],
depends_on: ['check'],
};

local fluentbit() = pipeline('fluent-bit-amd64') + arch_image('amd64', 'main') {
steps+: [
// dry run for everything that is not tag or main
clients_docker('amd64', 'fluent-bit') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
repo: 'grafana/fluent-bit-plugin-loki',
},
},
] + [
// publish for tag or main
clients_docker('amd64', 'fluent-bit') {
depends_on: ['image-tag'],
Expand All @@ -220,21 +199,10 @@ local fluentbit() = pipeline('fluent-bit-amd64') + arch_image('amd64', 'main') {
},
},
],
depends_on: ['check'],
};

local fluentd() = pipeline('fluentd-amd64') + arch_image('amd64', 'main') {
steps+: [
// dry run for everything that is not tag or main
clients_docker('amd64', 'fluentd') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
repo: 'grafana/fluent-plugin-loki',
},
},
] + [
// publish for tag or main
clients_docker('amd64', 'fluentd') {
depends_on: ['image-tag'],
Expand All @@ -244,21 +212,10 @@ local fluentd() = pipeline('fluentd-amd64') + arch_image('amd64', 'main') {
},
},
],
depends_on: ['check'],
};

local logstash() = pipeline('logstash-amd64') + arch_image('amd64', 'main') {
steps+: [
// dry run for everything that is not tag or main
clients_docker('amd64', 'logstash') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
repo: 'grafana/logstash-output-loki',
},
},
] + [
// publish for tag or main
clients_docker('amd64', 'logstash') {
depends_on: ['image-tag'],
Expand All @@ -268,87 +225,46 @@ local logstash() = pipeline('logstash-amd64') + arch_image('amd64', 'main') {
},
},
],
depends_on: ['check'],
};

local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) {
steps+: [
// dry run for everything that is not tag or main
clients_docker(arch, 'promtail') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
},
},
] + [
// publish for tag or main
clients_docker(arch, 'promtail') {
depends_on: ['image-tag'],
when: onTagOrMain,
settings+: {},
},
],
depends_on: ['check'],
};

local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(arch) {
local skipStep = skipMissingSecretPipelineStep(ecr_key.name), // Needs ECR secrets to run

steps+: [
skipStep,
// dry run for everything that is not tag or main
lambda_promtail_ecr('lambda-promtail') {
depends_on: ['image-tag', skipStep.name],
when: onPRs,
settings+: {
dry_run: true,
},
},
] + [
// publish for tag or main
lambda_promtail_ecr('lambda-promtail') {
depends_on: ['image-tag'],
when: onTagOrMain,
settings+: {},
},
],
depends_on: ['check'],
};

local lokioperator(arch) = pipeline('lokioperator-' + arch) + arch_image(arch) {
steps+: [
// dry run for everything that is not tag or main
docker_operator(arch, 'loki-operator') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
},
},
] + [
// publish for tag or main
docker_operator(arch, 'loki-operator') {
depends_on: ['image-tag'],
when: onTagOrMain,
settings+: {},
},
],
depends_on: ['check'],
};

local logql_analyzer() = pipeline('logql-analyzer') + arch_image('amd64') {
steps+: [
// dry run for everything that is not tag or main
docker('amd64', 'logql-analyzer') {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
repo: 'grafana/logql-analyzer',
},
},
] + [
// publish for tag or main
docker('amd64', 'logql-analyzer') {
depends_on: ['image-tag'],
Expand All @@ -358,21 +274,10 @@ local logql_analyzer() = pipeline('logql-analyzer') + arch_image('amd64') {
},
},
],
depends_on: ['check'],
};

local multiarch_image(arch) = pipeline('docker-' + arch) + arch_image(arch) {
steps+: [
// dry run for everything that is not tag or main
docker(arch, app) {
depends_on: ['image-tag'],
when: onPRs,
settings+: {
dry_run: true,
},
}
for app in apps
] + [
// publish for tag or main
docker(arch, app) {
depends_on: ['image-tag'],
Expand All @@ -381,7 +286,6 @@ local multiarch_image(arch) = pipeline('docker-' + arch) + arch_image(arch) {
}
for app in apps
],
depends_on: ['check'],
};

local manifest(apps) = pipeline('manifest') {
Expand Down Expand Up @@ -535,60 +439,6 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
],
},
pipeline('check') {
workspace: {
base: '/src',
path: 'loki',
},
steps: [
make('check-drone-drift', container=false) { depends_on: ['clone'] },
make('check-generated-files', container=false) { depends_on: ['clone'] },
run('clone-target-branch', commands=[
'cd ..',
'echo "cloning "$DRONE_TARGET_BRANCH ',
'git clone -b $DRONE_TARGET_BRANCH $CI_REPO_REMOTE loki-target-branch',
'cd -',
]) { depends_on: ['clone'], when: onPRs },
make('test', container=false) { depends_on: ['clone-target-branch', 'check-generated-files'] },
run('test-target-branch', commands=['cd ../loki-target-branch', 'BUILD_IN_CONTAINER=false make test']) { depends_on: ['clone-target-branch'], when: onPRs },
make('compare-coverage', container=false, args=[
'old=../loki-target-branch/test_results.txt',
'new=test_results.txt',
'packages=ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki',
'> diff.txt',
]) { depends_on: ['test', 'test-target-branch'], when: onPRs },
run('report-coverage', commands=[
"total_diff=$(sed 's/%//' diff.txt | awk '{sum+=$3;}END{print sum;}')",
'if [ $total_diff = 0 ]; then exit 0; fi',
"pull=$(echo $CI_COMMIT_REF | awk -F '/' '{print $3}')",
"body=$(jq -Rs '{body: . }' diff.txt)",
'curl -X POST -u $USER:$TOKEN -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/grafana/loki/issues/$pull/comments -d "$body" > /dev/null',
], env={
USER: 'grafanabot',
TOKEN: { from_secret: github_secret.name },
}) { depends_on: ['compare-coverage'], when: onPRs },
make('lint', container=false) { depends_on: ['check-generated-files'] },
make('check-mod', container=false) { depends_on: ['test', 'lint'] },
{
name: 'shellcheck',
image: 'koalaman/shellcheck-alpine:stable',
commands: ['apk add make bash && make lint-scripts'],
},
make('loki', container=false) { depends_on: ['check-generated-files'] },
make('check-doc', container=false) { depends_on: ['loki'] },
make('validate-example-configs', container=false) { depends_on: ['loki'] },
make('check-example-config-doc', container=false) { depends_on: ['clone'] },
{
name: 'build-docs-website',
image: 'grafana/docs-base:latest',
commands: [
'mkdir -p /hugo/content/docs/loki/latest',
'cp -r docs/sources/* /hugo/content/docs/loki/latest/',
'cd /hugo && make prod',
],
},
],
},
pipeline('mixins') {
workspace: {
base: '/src',
Expand Down Expand Up @@ -751,109 +601,6 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
promtail_win(),
logql_analyzer(),
pipeline('release') {
trigger+: {
event: ['pull_request', 'tag'],
},
depends_on+: ['check'],
image_pull_secrets: [pull_secret.name],
volumes+: [
{
name: 'cgroup',
host: {
path: '/sys/fs/cgroup',
},
},
{
name: 'docker',
host: {
path: '/var/run/docker.sock',
},
},
],
// Launch docker images with systemd
services: [
{
name: 'systemd-debian',
image: 'jrei/systemd-debian:12',
volumes: [
{
name: 'cgroup',
path: '/sys/fs/cgroup',
},
],
privileged: true,
},
{
name: 'systemd-centos',
image: 'jrei/systemd-centos:8',
volumes: [
{
name: 'cgroup',
path: '/sys/fs/cgroup',
},
],
privileged: true,
},
],
// Package and test the packages
steps: [
skipMissingSecretPipelineStep(gpg_private_key.name), // Needs GPG keys to run
{
name: 'fetch-tags',
image: 'alpine',
commands: [
'apk add --no-cache bash git',
'git fetch origin --tags',
],
},
run('write-key',
commands=['printf "%s" "$NFPM_SIGNING_KEY" > $NFPM_SIGNING_KEY_FILE'],
env={
NFPM_SIGNING_KEY: { from_secret: gpg_private_key.name },
NFPM_SIGNING_KEY_FILE: '/drone/src/private-key.key',
}),
run('test packaging',
commands=[
'make BUILD_IN_CONTAINER=false packages',
],
env={
NFPM_PASSPHRASE: { from_secret: gpg_passphrase.name },
NFPM_SIGNING_KEY_FILE: '/drone/src/private-key.key',
}),
{
name: 'test deb package',
image: 'docker',
commands: ['./tools/packaging/verify-deb-install.sh'],
volumes: [
{
name: 'docker',
path: '/var/run/docker.sock',
},
],
privileged: true,
},
{
name: 'test rpm package',
image: 'docker',
commands: ['./tools/packaging/verify-rpm-install.sh'],
volumes: [
{
name: 'docker',
path: '/var/run/docker.sock',
},
],
privileged: true,
},
run('publish',
commands=['make BUILD_IN_CONTAINER=false publish'],
env={
GITHUB_TOKEN: { from_secret: github_secret.name },
NFPM_PASSPHRASE: { from_secret: gpg_passphrase.name },
NFPM_SIGNING_KEY_FILE: '/drone/src/private-key.key',
}) { when: { event: ['tag'] } },
],
},
pipeline('docker-driver') {
trigger+: onTagOrMain,
steps: [
Expand Down
Loading

0 comments on commit 85ef0d0

Please sign in to comment.