Skip to content

Commit

Permalink
Merge pull request grafana#110 from grafana/main
Browse files Browse the repository at this point in the history
Update from upstream repository
  • Loading branch information
openshift-merge-robot authored Feb 28, 2023
2 parents db91ad7 + 84c5e20 commit a5f4c92
Show file tree
Hide file tree
Showing 843 changed files with 81,916 additions and 11,279 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": "grafana/loki-build-image:0.28.1",
"containerEnv": {
"BUILD_IN_CONTAINER": "false"
},
"customizations": {
"vscode": {
"settings": {},
"extensions": ["golang.go", "Grafana.vscode-jsonnet"]
}
},
"features": {
}
}
62 changes: 60 additions & 2 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local archs = ['amd64', 'arm64', 'arm'];

local build_image_version = std.extVar('__build-image-version');

local drone_updater_plugin_image = 'us.gcr.io/kubernetes-dev/drone/plugins/updater@sha256:cbcb09c74f96a34c528f52bf9b4815a036b11fed65f685be216e0c8b8e84285b';

local onPRs = {
event: ['pull_request'],
};
Expand All @@ -11,6 +13,10 @@ local onTagOrMain = {
event: ['push', 'tag'],
};

local onTag = {
event: ['tag'],
};

local onPath(path) = {
paths+: [path],
};
Expand Down Expand Up @@ -44,6 +50,7 @@ local gpg_private_key = secret('gpg_private_key', 'infra/data/ci/packages-publis

// Injected in a secret because this is a public repository and having the config here would leak our environment names
local updater_config_template = secret('updater_config_template', 'secret/data/common/loki_ci_autodeploy', 'updater-config-template.json');
local helm_chart_auto_update_config_template = secret('helm-chart-update-config-template', 'secret/data/common/loki-helm-chart-auto-update', 'on-loki-release-config.json');

local run(name, commands, env={}) = {
name: name,
Expand Down Expand Up @@ -446,7 +453,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {

[
pipeline('loki-build-image') {
local build_image_tag = '0.27.1',
local build_image_tag = '0.28.1',
workspace: {
base: '/src',
path: 'loki',
Expand Down Expand Up @@ -665,7 +672,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
{
name: 'trigger',
image: 'us.gcr.io/kubernetes-dev/drone/plugins/updater',
image: drone_updater_plugin_image,
settings: {
github_token: { from_secret: github_secret.name },
config_file: configFileName,
Expand All @@ -674,6 +681,56 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
],
},
pipeline('update-loki-helm-chart-on-loki-release') {
local configFileName = 'updater-config.json',
depends_on: ['manifest'],
image_pull_secrets: [pull_secret.name],
trigger: {
// wee need to run it only on Loki tags that starts with `v`.
ref: ['refs/tags/v*'],
},
steps: [
{
name: 'check-version-is-latest',
image: 'alpine',
when: onTag,
commands: [
'apk add --no-cache bash git',
'git fetch --tags',
"latest_version=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1 | sed 's/v//g')",
'RELEASE_TAG=$(./tools/image-tag)',
'if [ "$RELEASE_TAG" != "$latest_version" ]; then echo "Current version $RELEASE_TAG is not the latest version of Loki. The latest version is $latest_version" && exit 78; fi',
],
},
{
name: 'prepare-helm-chart-update-config',
image: 'alpine',
depends_on: ['check-version-is-latest'],
commands: [
'apk add --no-cache bash git',
'git fetch origin --tags',
'RELEASE_TAG=$(./tools/image-tag)',
'echo $PLUGIN_CONFIG_TEMPLATE > %s' % configFileName,
// replace placeholders with RELEASE TAG
'sed -i -E "s/\\{\\{release\\}\\}/$RELEASE_TAG/g" %s' % configFileName,
],
settings: {
config_template: { from_secret: helm_chart_auto_update_config_template.name },
},
},
{
name: 'trigger-helm-chart-update',
image: drone_updater_plugin_image,
settings: {
github_token: {
from_secret: github_secret.name,
},
config_file: configFileName,
},
depends_on: ['prepare-helm-chart-update-config'],
},
],
},
promtail_win(),
logql_analyzer(),
pipeline('release') {
Expand Down Expand Up @@ -818,6 +875,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
ecr_key,
ecr_secret_key,
updater_config_template,
helm_chart_auto_update_config_template,
gpg_passphrase,
gpg_private_key,
]
98 changes: 75 additions & 23 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ steps:
dry_run: true
repo: grafana/loki-build-image
tags:
- 0.27.1
- 0.28.1
when:
event:
- pull_request
Expand All @@ -26,7 +26,7 @@ steps:
from_secret: docker_password
repo: grafana/loki-build-image
tags:
- 0.27.1
- 0.28.1
username:
from_secret: docker_username
when:
Expand Down Expand Up @@ -93,14 +93,14 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-drone-drift
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-generated-files
- commands:
- cd ..
Expand All @@ -110,7 +110,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: clone-target-branch
when:
event:
Expand All @@ -121,15 +121,15 @@ steps:
- clone-target-branch
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: test
- commands:
- cd ../loki-target-branch
- BUILD_IN_CONTAINER=false make test
depends_on:
- clone-target-branch
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: test-target-branch
when:
event:
Expand All @@ -142,7 +142,7 @@ steps:
- test
- test-target-branch
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: compare-coverage
when:
event:
Expand All @@ -160,7 +160,7 @@ steps:
TOKEN:
from_secret: github_token
USER: grafanabot
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: report-coverage
when:
event:
Expand All @@ -170,15 +170,15 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
depends_on:
- test
- lint
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-mod
- commands:
- apk add make bash && make lint-scripts
Expand All @@ -189,28 +189,28 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: loki
- commands:
- make BUILD_IN_CONTAINER=false check-doc
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-doc
- commands:
- make BUILD_IN_CONTAINER=false validate-example-configs
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: validate-example-configs
- commands:
- make BUILD_IN_CONTAINER=false check-example-config-doc
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-example-config-doc
- commands:
- mkdir -p /hugo/content/docs/loki/latest
Expand Down Expand Up @@ -243,7 +243,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: loki-mixin-check
when:
event:
Expand All @@ -268,7 +268,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: documentation-helm-reference-check
trigger:
ref:
Expand Down Expand Up @@ -1254,7 +1254,7 @@ steps:
from_secret: updater_config_template
- depends_on:
- prepare-updater-config
image: us.gcr.io/kubernetes-dev/drone/plugins/updater
image: us.gcr.io/kubernetes-dev/drone/plugins/updater@sha256:cbcb09c74f96a34c528f52bf9b4815a036b11fed65f685be216e0c8b8e84285b
name: trigger
settings:
config_file: updater-config.json
Expand All @@ -1270,6 +1270,52 @@ trigger:
- refs/tags/v*
- refs/pull/*/head
---
depends_on:
- manifest
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: update-loki-helm-chart-on-loki-release
steps:
- commands:
- apk add --no-cache bash git
- git fetch --tags
- latest_version=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1 | sed
's/v//g')
- RELEASE_TAG=$(./tools/image-tag)
- if [ "$RELEASE_TAG" != "$latest_version" ]; then echo "Current version $RELEASE_TAG
is not the latest version of Loki. The latest version is $latest_version" && exit
78; fi
image: alpine
name: check-version-is-latest
when:
event:
- tag
- commands:
- apk add --no-cache bash git
- git fetch origin --tags
- RELEASE_TAG=$(./tools/image-tag)
- echo $PLUGIN_CONFIG_TEMPLATE > updater-config.json
- sed -i -E "s/\{\{release\}\}/$RELEASE_TAG/g" updater-config.json
depends_on:
- check-version-is-latest
image: alpine
name: prepare-helm-chart-update-config
settings:
config_template:
from_secret: helm-chart-update-config-template
- depends_on:
- prepare-helm-chart-update-config
image: us.gcr.io/kubernetes-dev/drone/plugins/updater@sha256:cbcb09c74f96a34c528f52bf9b4815a036b11fed65f685be216e0c8b8e84285b
name: trigger-helm-chart-update
settings:
config_file: updater-config.json
github_token:
from_secret: github_token
trigger:
ref:
- refs/tags/v*
---
kind: pipeline
name: promtail-windows
platform:
Expand Down Expand Up @@ -1370,15 +1416,15 @@ steps:
NFPM_SIGNING_KEY:
from_secret: gpg_private_key
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: write-key
- commands:
- make BUILD_IN_CONTAINER=false packages
environment:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: test packaging
- commands:
- ./tools/packaging/verify-deb-install.sh
Expand All @@ -1404,7 +1450,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: publish
when:
event:
Expand Down Expand Up @@ -1438,7 +1484,7 @@ steps:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: build and push
privileged: true
volumes:
Expand Down Expand Up @@ -1662,6 +1708,12 @@ get:
kind: secret
name: updater_config_template
---
get:
name: on-loki-release-config.json
path: secret/data/common/loki-helm-chart-auto-update
kind: secret
name: helm-chart-update-config-template
---
get:
name: passphrase
path: infra/data/ci/packages-publish/gpg
Expand All @@ -1675,6 +1727,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: c1930caa8e7ffedf82b641cc1204d87319cddf576efa787d2ef1a86d16c2b9cf
hmac: ae19447e0f2e91746c5b4e6a3dc469a08a63c44045f4b995a6980d0e401e071f

...
Loading

0 comments on commit a5f4c92

Please sign in to comment.