mirror of https://github.com/grafana/loki
chore: update to latest release action (#11808)
parent
09aa0f80b5
commit
65b3ec441b
@ -0,0 +1,15 @@ |
||||
{ |
||||
"version": 1, |
||||
"dependencies": [ |
||||
{ |
||||
"source": { |
||||
"git": { |
||||
"remote": "https://github.com/grafana/loki-release.git", |
||||
"subdir": "workflows" |
||||
} |
||||
}, |
||||
"version": "release-1.10.x" |
||||
} |
||||
], |
||||
"legacyImports": true |
||||
} |
||||
@ -0,0 +1,16 @@ |
||||
{ |
||||
"version": 1, |
||||
"dependencies": [ |
||||
{ |
||||
"source": { |
||||
"git": { |
||||
"remote": "https://github.com/grafana/loki-release.git", |
||||
"subdir": "workflows" |
||||
} |
||||
}, |
||||
"version": "c005223f58b83f288b655dde5bcfeff7490c7aa5", |
||||
"sum": "5K+r6Bsb8JMR1ytQjSObjvHFpH7SJBi5D4ysSwvC4/g=" |
||||
} |
||||
], |
||||
"legacyImports": false |
||||
} |
||||
@ -0,0 +1,58 @@ |
||||
local lokiRelease = import 'workflows/main.jsonnet'; |
||||
local build = lokiRelease.build; |
||||
{ |
||||
'patch-release-pr.yml': std.manifestYamlDoc( |
||||
lokiRelease.releasePRWorkflow( |
||||
imageJobs={ |
||||
loki: build.image('loki', 'cmd/loki'), |
||||
fluentd: build.image('fluentd', 'clients/cmd/fluentd', platform=['linux/amd64']), |
||||
'fluent-bit': build.image('fluent-bit', 'clients/cmd/fluent-bit', platform=['linux/amd64']), |
||||
logstash: build.image('logstash', 'clients/cmd/logstash', platform=['linux/amd64']), |
||||
logcli: build.image('logcli', 'cmd/logcli'), |
||||
'loki-canary': build.image('loki-canary', 'cmd/loki-canary'), |
||||
'loki-canary-boringcrypto': build.image('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), |
||||
'loki-operator': build.image('loki-operator', 'operator', context='release/operator', platform=['linux/amd64']), |
||||
promtail: build.image('promtail', 'clients/cmd/promtail'), |
||||
querytee: build.image('querytee', 'cmd/querytee', platform=['linux/amd64']), |
||||
}, |
||||
branches=['release-[0-9]+.[0-9]+.x'], |
||||
checkTemplate='grafana/loki-release/.github/workflows/check.yml@release-1.10.x', |
||||
imagePrefix='grafana', |
||||
releaseRepo='grafana/loki', |
||||
skipArm=false, |
||||
skipValidation=false, |
||||
versioningStrategy='always-bump-patch', |
||||
), false, false |
||||
), |
||||
'minor-release-pr.yml': std.manifestYamlDoc( |
||||
lokiRelease.releasePRWorkflow( |
||||
imageJobs={ |
||||
loki: build.image('loki', 'cmd/loki'), |
||||
fluentd: build.image('fluentd', 'clients/cmd/fluentd', platform=['linux/amd64']), |
||||
'fluent-bit': build.image('fluent-bit', 'clients/cmd/fluent-bit', platform=['linux/amd64']), |
||||
logstash: build.image('logstash', 'clients/cmd/logstash', platform=['linux/amd64']), |
||||
logcli: build.image('logcli', 'cmd/logcli'), |
||||
'loki-canary': build.image('loki-canary', 'cmd/loki-canary'), |
||||
'loki-canary-boringcrypto': build.image('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), |
||||
'loki-operator': build.image('loki-operator', 'operator', context='release/operator', platform=['linux/amd64']), |
||||
promtail: build.image('promtail', 'clients/cmd/promtail'), |
||||
querytee: build.image('querytee', 'cmd/querytee', platform=['linux/amd64']), |
||||
}, |
||||
branches=['k[0-9]+'], |
||||
checkTemplate='grafana/loki-release/.github/workflows/check.yml@release-1.10.x', |
||||
imagePrefix='grafana', |
||||
releaseRepo='grafana/loki', |
||||
skipArm=false, |
||||
skipValidation=false, |
||||
versioningStrategy='always-bump-minor', |
||||
), false, false |
||||
), |
||||
'release.yml': std.manifestYamlDoc( |
||||
lokiRelease.releaseWorkflow( |
||||
branches=['release-[0-9]+.[0-9]+.x', 'k[0-9]+'], |
||||
getDockerCredsFromVault=true, |
||||
imagePrefix='grafana', |
||||
releaseRepo='grafana/loki', |
||||
), false, false |
||||
), |
||||
} |
||||
@ -0,0 +1,154 @@ |
||||
local common = import 'common.libsonnet'; |
||||
local job = common.job; |
||||
local step = common.step; |
||||
local releaseStep = common.releaseStep; |
||||
local releaseLibStep = common.releaseLibStep; |
||||
|
||||
{ |
||||
image: function( |
||||
name, |
||||
path, |
||||
context='release', |
||||
platform=[ |
||||
'linux/amd64', |
||||
'linux/arm64', |
||||
'linux/arm', |
||||
] |
||||
) |
||||
job.new() |
||||
+ job.withStrategy({ |
||||
'fail-fast': true, |
||||
matrix: { |
||||
platform: platform, |
||||
}, |
||||
}) |
||||
+ job.withSteps([ |
||||
common.fetchReleaseLib, |
||||
common.fetchReleaseRepo, |
||||
common.setupNode, |
||||
common.googleAuth, |
||||
|
||||
step.new('Set up QEMU', 'docker/setup-qemu-action@v3'), |
||||
step.new('set up docker buildx', 'docker/setup-buildx-action@v3'), |
||||
|
||||
releaseStep('parse image platform') |
||||
+ step.withId('platform') |
||||
+ step.withRun(||| |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
|||), |
||||
|
||||
step.new('Build and export', 'docker/build-push-action@v5') |
||||
+ step.withTimeoutMinutes(25) |
||||
+ step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') |
||||
+ step.with({ |
||||
context: context, |
||||
file: 'release/%s/Dockerfile' % path, |
||||
platforms: '${{ matrix.platform }}', |
||||
tags: '${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}' % [name], |
||||
outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, |
||||
}), |
||||
step.new('upload artifacts', 'google-github-actions/upload-cloud-storage@v2') |
||||
+ step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') |
||||
+ step.with({ |
||||
path: 'release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, |
||||
destination: 'loki-build-artifacts/${{ github.sha }}/images', //TODO: make bucket configurable |
||||
process_gcloudignore: false, |
||||
}), |
||||
]), |
||||
|
||||
version: |
||||
job.new() |
||||
+ job.withSteps([ |
||||
common.fetchReleaseLib, |
||||
common.fetchReleaseRepo, |
||||
common.setupNode, |
||||
common.extractBranchName, |
||||
releaseLibStep('get release version') |
||||
+ step.withId('version') |
||||
+ step.withRun(||| |
||||
npm install |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--dry-run \ |
||||
--dry-run-output release.json \ |
||||
--release-type simple \ |
||||
--repo-url="${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token="${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" |
||||
|
||||
if [[ `jq length release.json` -gt 1 ]]; then |
||||
echo 'release-please would create more than 1 PR, so cannot determine correct version' |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
exit 1 |
||||
fi |
||||
|
||||
if [[ `jq length release.json` -eq 0 ]]; then |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
else |
||||
version="$(npm run --silent get-version)" |
||||
echo "Parsed version: ${version}" |
||||
echo "version=${version}" >> $GITHUB_OUTPUT |
||||
echo "pr_created=true" >> $GITHUB_OUTPUT |
||||
fi |
||||
|||), |
||||
]) |
||||
+ job.withOutputs({ |
||||
version: '${{ steps.version.outputs.version }}', |
||||
pr_created: '${{ steps.version.outputs.pr_created }}', |
||||
}), |
||||
|
||||
dist: function(buildImage, skipArm=true) |
||||
job.new() |
||||
+ job.withSteps([ |
||||
common.fetchReleaseRepo, |
||||
common.googleAuth, |
||||
step.new('get nfpm signing keys', 'grafana/shared-workflows/actions/get-vault-secrets@main') |
||||
+ step.withId('get-secrets') |
||||
+ step.with({ |
||||
common_secrets: ||| |
||||
NFPM_SIGNING_KEY=packages-gpg:private-key |
||||
NFPM_PASSPHRASE=packages-gpg:passphrase |
||||
|||, |
||||
}), |
||||
|
||||
releaseStep('build artifacts') |
||||
+ step.withEnv({ |
||||
BUILD_IN_CONTAINER: false, |
||||
DRONE_TAG: '${{ needs.version.outputs.version }}', |
||||
IMAGE_TAG: '${{ needs.version.outputs.version }}', |
||||
NFPM_SIGNING_KEY_FILE: 'nfpm-private-key.key', |
||||
SKIP_ARM: skipArm, |
||||
}) |
||||
//TODO: the workdir here is loki specific |
||||
+ step.withRun(||| |
||||
cat <<EOF | docker run \ |
||||
--interactive \ |
||||
--env BUILD_IN_CONTAINER \ |
||||
--env DRONE_TAG \ |
||||
--env IMAGE_TAG \ |
||||
--env NFPM_PASSPHRASE \ |
||||
--env NFPM_SIGNING_KEY \ |
||||
--env NFPM_SIGNING_KEY_FILE \ |
||||
--env SKIP_ARM \ |
||||
--volume .:/src/loki \ |
||||
--workdir /src/loki \ |
||||
--entrypoint /bin/sh "%s" |
||||
git config --global --add safe.directory /src/loki |
||||
echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE |
||||
make dist packages |
||||
EOF |
||||
||| % buildImage), |
||||
|
||||
step.new('upload build artifacts', 'google-github-actions/upload-cloud-storage@v2') |
||||
+ step.with({ |
||||
path: 'release/dist', |
||||
destination: 'loki-build-artifacts/${{ github.sha }}', //TODO: make bucket configurable |
||||
process_gcloudignore: false, |
||||
}), |
||||
]), |
||||
} |
||||
@ -0,0 +1,124 @@ |
||||
{ |
||||
step: { |
||||
new: function(name, uses=null) { |
||||
name: name, |
||||
} + if uses != null then { |
||||
uses: uses, |
||||
} else {}, |
||||
with: function(with) { |
||||
with+: with, |
||||
}, |
||||
withRun: function(run) { |
||||
run: run, |
||||
}, |
||||
withId: function(id) { |
||||
id: id, |
||||
}, |
||||
withWorkingDirectory: function(workingDirectory) { |
||||
'working-directory': workingDirectory, |
||||
}, |
||||
withIf: function(_if) { |
||||
'if': _if, |
||||
}, |
||||
withEnv: function(env) { |
||||
env: env, |
||||
}, |
||||
withSecrets: function(env) { |
||||
secrets: env, |
||||
}, |
||||
withTimeoutMinutes: function(timeout) { |
||||
'timeout-minutes': timeout, |
||||
}, |
||||
}, |
||||
job: { |
||||
new: function(runsOn='ubuntu-latest') { |
||||
'runs-on': runsOn, |
||||
}, |
||||
with: function(with) { |
||||
with+: with, |
||||
}, |
||||
withUses: function(uses) { |
||||
uses: uses, |
||||
}, |
||||
withSteps: function(steps) { |
||||
steps: steps, |
||||
}, |
||||
withStrategy: function(strategy) { |
||||
strategy: strategy, |
||||
}, |
||||
withNeeds: function(needs) { |
||||
needs: needs, |
||||
}, |
||||
withIf: function(_if) { |
||||
'if': _if, |
||||
}, |
||||
withOutputs: function(outputs) { |
||||
outputs: outputs, |
||||
}, |
||||
withContainer: function(container) { |
||||
container: container, |
||||
}, |
||||
withEnv: function(env) { |
||||
env: env, |
||||
}, |
||||
withSecrets: function(env) { |
||||
secrets: env, |
||||
}, |
||||
}, |
||||
|
||||
releaseStep: function(name, uses=null) $.step.new(name, uses) + |
||||
$.step.withWorkingDirectory('release'), |
||||
|
||||
releaseLibStep: function(name, uses=null) $.step.new(name, uses) + |
||||
$.step.withWorkingDirectory('lib'), |
||||
|
||||
checkout: |
||||
$.step.new('checkout', 'actions/checkout@v4'), |
||||
|
||||
fetchReleaseRepo: |
||||
$.step.new('pull code to release', 'actions/checkout@v4') |
||||
+ $.step.with({ |
||||
repository: '${{ env.RELEASE_REPO }}', |
||||
path: 'release', |
||||
}), |
||||
fetchReleaseLib: |
||||
$.step.new('pull release library code', 'actions/checkout@v4') |
||||
+ $.step.with({ |
||||
repository: 'grafana/loki-release', |
||||
path: 'lib', |
||||
}), |
||||
|
||||
setupNode: $.step.new('setup node', 'actions/setup-node@v4') |
||||
+ $.step.with({ |
||||
'node-version': 20, |
||||
}), |
||||
|
||||
makeTarget: function(target) 'make %s' % target, |
||||
|
||||
alwaysGreen: { |
||||
steps: [ |
||||
$.step.new('always green') |
||||
+ $.step.withRun('echo "always green"'), |
||||
], |
||||
}, |
||||
|
||||
googleAuth: $.step.new('auth gcs', 'google-github-actions/auth@v2') |
||||
+ $.step.with({ |
||||
credentials_json: '${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}', |
||||
}), |
||||
setupGoogleCloudSdk: $.step.new('Set up Cloud SDK', 'google-github-actions/setup-gcloud@v2') |
||||
+ $.step.with({ |
||||
version: '>= 452.0.0', |
||||
}), |
||||
|
||||
extractBranchName: $.releaseStep('extract branch name') |
||||
+ $.step.withId('extract_branch') |
||||
+ $.step.withRun(||| |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
|||), |
||||
|
||||
fixDubiousOwnership: $.step.new('fix git dubious ownership') |
||||
+ $.step.withRun(||| |
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE" |
||||
|||), |
||||
} |
||||
@ -0,0 +1,111 @@ |
||||
{ |
||||
common: import 'common.libsonnet', |
||||
job: $.common.job, |
||||
step: $.common.step, |
||||
build: import 'build.libsonnet', |
||||
release: import 'release.libsonnet', |
||||
validate: import 'validate.libsonnet', |
||||
releasePRWorkflow: function( |
||||
branches=['release-[0-9]+.[0-9]+.x', 'k[0-9]+'], |
||||
buildImage='grafana/loki-build-image:0.33.0', |
||||
checkTemplate='./.github/workflows/check.yml', |
||||
dockerUsername='grafana', |
||||
imageJobs={}, |
||||
imagePrefix='grafana', |
||||
releaseRepo='grafana/loki-release', |
||||
skipArm=true, |
||||
skipValidation=false, |
||||
versioningStrategy='always-bump-patch', |
||||
) { |
||||
name: 'create release PR', |
||||
on: { |
||||
push: { |
||||
branches: branches, |
||||
}, |
||||
}, |
||||
permissions: { |
||||
contents: 'write', |
||||
'pull-requests': 'write', |
||||
'id-token': 'write', |
||||
}, |
||||
concurrency: { |
||||
group: 'create-release-pr-${{ github.sha }}', |
||||
}, |
||||
env: { |
||||
RELEASE_REPO: releaseRepo, |
||||
DOCKER_USERNAME: dockerUsername, |
||||
IMAGE_PREFIX: imagePrefix, |
||||
SKIP_VALIDATION: skipValidation, |
||||
VERSIONING_STRATEGY: versioningStrategy, |
||||
}, |
||||
local validationSteps = ['check'], |
||||
jobs: { |
||||
check: {} + $.job.withUses(checkTemplate) |
||||
+ $.job.with({ |
||||
skip_validation: skipValidation, |
||||
}), |
||||
version: $.build.version + $.common.job.withNeeds(validationSteps), |
||||
dist: $.build.dist(buildImage, skipArm) + $.common.job.withNeeds(['version']), |
||||
} + std.mapWithKey(function(name, job) job + $.common.job.withNeeds(['version']), imageJobs) + { |
||||
local buildImageSteps = ['dist'] + std.objectFields(imageJobs), |
||||
'create-release-pr': $.release.createReleasePR + $.common.job.withNeeds(buildImageSteps), |
||||
}, |
||||
}, |
||||
releaseWorkflow: function( |
||||
releaseRepo='grafana/loki-release', |
||||
dockerUsername='grafana', |
||||
imagePrefix='grafana', |
||||
branches=['release-[0-9].[0-9].x', 'k[0-9]*'], |
||||
getDockerCredsFromVault=false |
||||
) { |
||||
name: 'create release', |
||||
on: { |
||||
push: { |
||||
branches: branches, |
||||
}, |
||||
}, |
||||
permissions: { |
||||
contents: 'write', |
||||
'pull-requests': 'write', |
||||
'id-token': 'write', |
||||
}, |
||||
concurrency: { |
||||
group: 'create-release-${{ github.sha }}', |
||||
}, |
||||
env: { |
||||
RELEASE_REPO: releaseRepo, |
||||
IMAGE_PREFIX: imagePrefix, |
||||
}, |
||||
jobs: { |
||||
shouldRelease: $.release.shouldRelease, |
||||
createRelease: $.release.createRelease, |
||||
publishImages: $.release.publishImages(getDockerCredsFromVault, dockerUsername), |
||||
}, |
||||
}, |
||||
check: function( |
||||
buildImage='grafana/loki-build-image:0.33.0', |
||||
) { |
||||
name: 'check', |
||||
on: { |
||||
workflow_call: { |
||||
inputs: { |
||||
skip_validation: { |
||||
default: false, |
||||
description: 'skip validation steps', |
||||
required: false, |
||||
type: 'boolean', |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
permissions: { |
||||
contents: 'write', |
||||
'pull-requests': 'write', |
||||
'id-token': 'write', |
||||
}, |
||||
concurrency: { |
||||
group: 'check-${{ github.sha }}', |
||||
}, |
||||
jobs: $.validate(buildImage), |
||||
}, |
||||
} |
||||
@ -0,0 +1,144 @@ |
||||
local common = import 'common.libsonnet'; |
||||
local job = common.job; |
||||
local step = common.step; |
||||
local releaseStep = common.releaseStep; |
||||
local releaseLibStep = common.releaseLibStep; |
||||
|
||||
// DO NOT MODIFY THIS FOOTER TEMPLATE |
||||
// This template is matched by the should-release action to detect the correct |
||||
// sha to release and pull aritfacts from. If you need to change this, make sure |
||||
// to change it in both places. |
||||
//TODO: make bucket configurable |
||||
local pullRequestFooter = 'Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}'; |
||||
|
||||
{ |
||||
createReleasePR: |
||||
job.new() |
||||
+ job.withSteps([ |
||||
common.fetchReleaseRepo, |
||||
common.fetchReleaseLib, |
||||
common.setupNode, |
||||
common.extractBranchName, |
||||
|
||||
releaseLibStep('release please') |
||||
+ step.withId('release') |
||||
+ step.withEnv({ |
||||
SHA: '${{ github.sha }}', |
||||
}) |
||||
//TODO make bucket configurable |
||||
//TODO make a type/release in the backport action |
||||
//TODO backport action should not bring over autorelease: pending label |
||||
+ step.withRun(||| |
||||
npm install |
||||
echo "Pull request footer: %s" |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--label "backport main,autorelease: pending,type/docs" \ |
||||
--pull-request-footer "%s" \ |
||||
--release-type simple \ |
||||
--repo-url "${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token "${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" \ |
||||
--separate-pull-requests false \ |
||||
--debug |
||||
||| % [pullRequestFooter, pullRequestFooter]), |
||||
]), |
||||
|
||||
shouldRelease: job.new() |
||||
+ job.withSteps([ |
||||
common.fetchReleaseRepo, |
||||
common.fetchReleaseLib, |
||||
common.extractBranchName, |
||||
|
||||
step.new('should a release be created?', './lib/actions/should-release') |
||||
+ step.withId('should_release') |
||||
+ step.with({ |
||||
baseBranch: '${{ steps.extract_branch.outputs.branch }}', |
||||
}), |
||||
]) |
||||
+ job.withOutputs({ |
||||
shouldRelease: '${{ steps.should_release.outputs.shouldRelease }}', |
||||
sha: '${{ steps.should_release.outputs.sha }}', |
||||
name: '${{ steps.should_release.outputs.name }}', |
||||
branch: '${{ steps.extract_branch.outputs.branch }}', |
||||
|
||||
}), |
||||
createRelease: job.new() |
||||
+ job.withNeeds(['shouldRelease']) |
||||
+ job.withIf('${{ fromJSON(needs.shouldRelease.outputs.shouldRelease) }}') |
||||
+ job.withSteps([ |
||||
common.fetchReleaseRepo, |
||||
common.fetchReleaseLib, |
||||
common.setupNode, |
||||
common.googleAuth, |
||||
common.setupGoogleCloudSdk, |
||||
|
||||
// exits with code 1 if the url does not match |
||||
// meaning there are no artifacts for that sha |
||||
// we need to handle this if we're going to run this pipeline on every merge to main |
||||
releaseStep('download binaries') |
||||
+ step.withRun(||| |
||||
echo "downloading binaries to $(pwd)/dist" |
||||
gsutil cp -r gs://loki-build-artifacts/${{ needs.shouldRelease.outputs.sha }}/dist . |
||||
|||), |
||||
|
||||
releaseLibStep('create release') |
||||
+ step.withId('release') |
||||
+ step.withRun(||| |
||||
npm install |
||||
npm exec -- release-please github-release \ |
||||
--draft \ |
||||
--release-type simple \ |
||||
--repo-url="${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ needs.shouldRelease.outputs.branch }}" \ |
||||
--token="${{ secrets.GH_TOKEN }}" |
||||
|||), |
||||
|
||||
releaseStep('upload artifacts') |
||||
+ step.withId('upload') |
||||
+ step.withEnv({ |
||||
GH_TOKEN: '${{ secrets.GH_TOKEN }}', |
||||
}) |
||||
+ step.withRun(||| |
||||
gh release upload ${{ needs.shouldRelease.outputs.name }} dist/* |
||||
gh release edit ${{ needs.shouldRelease.outputs.name }} --draft=false |
||||
|||), |
||||
]) |
||||
+ job.withOutputs({ |
||||
sha: '${{ needs.shouldRelease.outputs.sha }}', |
||||
}), |
||||
|
||||
publishImages: function(getDockerCredsFromVault=false, dockerUsername='grafanabot') |
||||
job.new() |
||||
+ job.withNeeds(['createRelease']) |
||||
+ job.withSteps( |
||||
[ |
||||
common.fetchReleaseLib, |
||||
common.googleAuth, |
||||
common.setupGoogleCloudSdk, |
||||
step.new('Set up QEMU', 'docker/setup-qemu-action@v3'), |
||||
step.new('set up docker buildx', 'docker/setup-buildx-action@v3'), |
||||
] + (if getDockerCredsFromVault then [ |
||||
step.new('Login to DockerHub (from vault)', 'grafana/shared-workflows/actions/dockerhub-login@main'), |
||||
] else [ |
||||
step.new('Login to DockerHub (from secrets)', 'docker/login-action@v3') |
||||
+ step.with({ |
||||
username: dockerUsername, |
||||
password: '${{ secrets.DOCKER_PASSWORD }}', |
||||
}), |
||||
]) + |
||||
[ |
||||
step.new('download images') |
||||
+ step.withRun(||| |
||||
echo "downloading images to $(pwd)/images" |
||||
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images . |
||||
|||), |
||||
step.new('publish docker images', './lib/actions/push-images') |
||||
+ step.with({ |
||||
imageDir: 'images', |
||||
imagePrefix: '${{ env.IMAGE_PREFIX }}', |
||||
}), |
||||
] |
||||
), |
||||
} |
||||
@ -0,0 +1,114 @@ |
||||
local common = import 'common.libsonnet'; |
||||
local job = common.job; |
||||
local step = common.step; |
||||
local releaseStep = common.releaseStep; |
||||
|
||||
local setupValidationDeps = function(job) job { |
||||
steps: [ |
||||
common.checkout, |
||||
common.fetchReleaseLib, |
||||
common.fixDubiousOwnership, |
||||
step.new('install tar') |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.withRun(||| |
||||
apt update |
||||
apt install -qy tar xz-utils |
||||
|||), |
||||
step.new('install shellcheck', './lib/actions/install-binary') |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.with({ |
||||
binary: 'shellcheck', |
||||
version: '0.9.0', |
||||
download_url: 'https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.x86_64.tar.xz', |
||||
tarball_binary_path: '*/${binary}', |
||||
smoke_test: '${binary} --version', |
||||
tar_args: 'xvf', |
||||
}), |
||||
step.new('install jsonnetfmt', './lib/actions/install-binary') |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.with({ |
||||
binary: 'jsonnetfmt', |
||||
version: '0.18.0', |
||||
download_url: 'https://github.com/google/go-jsonnet/releases/download/v${version}/go-jsonnet_${version}_Linux_x86_64.tar.gz', |
||||
tarball_binary_path: '${binary}', |
||||
smoke_test: '${binary} --version', |
||||
}), |
||||
] + job.steps, |
||||
}; |
||||
|
||||
local validationJob = function(buildImage) job.new() |
||||
+ job.withContainer({ |
||||
image: buildImage, |
||||
}) |
||||
+ job.withEnv({ |
||||
BUILD_IN_CONTAINER: false, |
||||
SKIP_VALIDATION: '${{ inputs.skip_validation }}', |
||||
}); |
||||
|
||||
|
||||
function(buildImage) { |
||||
local validationMakeStep = function(name, target) |
||||
step.new(name) |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.withRun(common.makeTarget(target)), |
||||
|
||||
test: setupValidationDeps( |
||||
validationJob(buildImage) |
||||
+ job.withSteps([ |
||||
validationMakeStep('test', 'test'), |
||||
]) |
||||
), |
||||
|
||||
lint: setupValidationDeps( |
||||
validationJob(buildImage) |
||||
+ job.withSteps([ |
||||
validationMakeStep('lint', 'lint'), |
||||
validationMakeStep('lint jsonnet', 'lint-jsonnet'), |
||||
validationMakeStep('lint scripts', 'lint-scripts'), |
||||
validationMakeStep('format', 'check-format'), |
||||
]) + { |
||||
steps+: [ |
||||
step.new('golangci-lint', 'golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5') |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.with({ |
||||
version: 'v1.55.1', |
||||
'only-new-issues': true, |
||||
}), |
||||
], |
||||
} |
||||
), |
||||
|
||||
check: setupValidationDeps( |
||||
validationJob(buildImage) |
||||
+ job.withSteps([ |
||||
validationMakeStep('check generated files', 'check-generated-files'), |
||||
validationMakeStep('check mod', 'check-mod'), |
||||
validationMakeStep('check docs', 'check-doc'), |
||||
validationMakeStep('validate example configs', 'validate-example-configs'), |
||||
validationMakeStep('validate dev cluster config', 'validate-dev-cluster-config'), |
||||
validationMakeStep('check example config docs', 'check-example-config-doc'), |
||||
validationMakeStep('check helm reference doc', 'documentation-helm-reference-check'), |
||||
validationMakeStep('check drone drift', 'check-drone-drift'), |
||||
]) + { |
||||
steps+: [ |
||||
step.new('build docs website') |
||||
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
||||
+ step.withRun(||| |
||||
cat <<EOF | docker run \ |
||||
--interactive \ |
||||
--env BUILD_IN_CONTAINER \ |
||||
--env DRONE_TAG \ |
||||
--env IMAGE_TAG \ |
||||
--volume .:/src/loki \ |
||||
--workdir /src/loki \ |
||||
--entrypoint /bin/sh "%s" |
||||
git config --global --add safe.directory /src/loki |
||||
mkdir -p /hugo/content/docs/loki/latest |
||||
cp -r docs/sources/* /hugo/content/docs/loki/latest/ |
||||
cd /hugo && make prod |
||||
EOF |
||||
||| % 'grafana/docs-base:e6ef023f8b8'), |
||||
], |
||||
} |
||||
), |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
local lokiRelease = import 'main.jsonnet'; |
||||
local build = lokiRelease.build; |
||||
{ |
||||
'.github/workflows/release-pr.yml': std.manifestYamlDoc( |
||||
lokiRelease.releasePRWorkflow( |
||||
imageJobs={ |
||||
loki: build.image('fake-loki', 'cmd/loki'), |
||||
}, |
||||
branches=['release-[0-9]+.[0-9]+.x'], |
||||
imagePrefix='trevorwhitney075', |
||||
releaseRepo='grafana/loki-release', |
||||
skipValidation=false, |
||||
versioningStrategy='always-bump-patch', |
||||
), false, false |
||||
), |
||||
'.github/workflows/release.yml': std.manifestYamlDoc( |
||||
lokiRelease.releaseWorkflow( |
||||
branches=['release-[0-9]+.[0-9]+.x'], |
||||
dockerUsername='trevorwhitney075', |
||||
getDockerCredsFromVault=false, |
||||
imagePrefix='trevorwhitney075', |
||||
releaseRepo='grafana/loki-release', |
||||
), false, false |
||||
), |
||||
'.github/workflows/check.yml': std.manifestYamlDoc( |
||||
lokiRelease.check( |
||||
buildImage='grafana/loki-build-image:0.33.0' |
||||
) |
||||
), |
||||
} |
||||
@ -0,0 +1 @@ |
||||
github.com/grafana/loki-release/workflows |
||||
@ -0,0 +1,12 @@ |
||||
--- |
||||
name: check |
||||
on: |
||||
pull_request: {} |
||||
push: |
||||
branches: |
||||
- main |
||||
jobs: |
||||
check: |
||||
uses: grafana/loki-release/.github/workflows/check.yml@release-1.10.x |
||||
with: |
||||
skip_validation: false |
||||
@ -1,28 +0,0 @@ |
||||
name: Checks |
||||
on: |
||||
pull_request: |
||||
branches: |
||||
- main |
||||
jobs: |
||||
checks: |
||||
runs-on: ubuntu-latest |
||||
env: |
||||
BUILD_IN_CONTAINER: false |
||||
container: |
||||
image: grafana/loki-build-image:0.33.0 |
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
||||
- name: golangci-lint |
||||
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 |
||||
with: |
||||
version: v1.55.1 |
||||
only-new-issues: true |
||||
- run: make lint |
||||
- run: make check-doc |
||||
- run: make check-mod |
||||
- run: make validate-example-configs |
||||
- run: make check-example-config-doc |
||||
- run: make check-drone-drift |
||||
- run: make check-generated-files |
||||
- run: make test |
||||
@ -0,0 +1,10 @@ |
||||
--- |
||||
name: enforce conventional commits |
||||
on: [pull_request] |
||||
jobs: |
||||
check-title: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: amannn/action-semantic-pull-request@v5 |
||||
env: |
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||
@ -1,21 +1,773 @@ |
||||
--- |
||||
name: 'create release PR for minor releases' |
||||
on: |
||||
push: |
||||
branches: |
||||
- 'k[0-9]*' |
||||
workflow_dispatch: {} |
||||
permissions: |
||||
contents: 'write' |
||||
issues: 'write' |
||||
pull-requests: 'write' |
||||
concurrency: |
||||
group: "create-release-pr-${{ github.sha }}" |
||||
env: |
||||
DOCKER_USERNAME: "grafana" |
||||
IMAGE_PREFIX: "grafana" |
||||
RELEASE_REPO: "grafana/loki" |
||||
SKIP_VALIDATION: false |
||||
VERSIONING_STRATEGY: "always-bump-minor" |
||||
jobs: |
||||
create-release-pr: |
||||
uses: github/loki-release/.github/workflows/release-pr.yml@main |
||||
check: |
||||
uses: "grafana/loki-release/.github/workflows/check.yml@release-1.10.x" |
||||
with: |
||||
release_repo: grafana/loki |
||||
skip_validation: false |
||||
versioning_strategy: always-bump-minor |
||||
secrets: |
||||
GCS_SERVICE_ACCOUNT_KEY: '${{ secrets.BACKEND_ENTERPRISE_DRONE }}' |
||||
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |
||||
create-release-pr: |
||||
needs: |
||||
- "dist" |
||||
- "fluent-bit" |
||||
- "fluentd" |
||||
- "logcli" |
||||
- "logstash" |
||||
- "loki" |
||||
- "loki-canary" |
||||
- "loki-canary-boringcrypto" |
||||
- "loki-operator" |
||||
- "promtail" |
||||
- "querytee" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- id: "extract_branch" |
||||
name: "extract branch name" |
||||
run: | |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- env: |
||||
SHA: "${{ github.sha }}" |
||||
id: "release" |
||||
name: "release please" |
||||
run: | |
||||
npm install |
||||
echo "Pull request footer: Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--label "backport main,autorelease: pending,type/docs" \ |
||||
--pull-request-footer "Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" \ |
||||
--release-type simple \ |
||||
--repo-url "${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token "${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" \ |
||||
--separate-pull-requests false \ |
||||
--debug |
||||
working-directory: "lib" |
||||
dist: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- id: "get-secrets" |
||||
name: "get nfpm signing keys" |
||||
uses: "grafana/shared-workflows/actions/get-vault-secrets@main" |
||||
with: |
||||
common_secrets: | |
||||
NFPM_SIGNING_KEY=packages-gpg:private-key |
||||
NFPM_PASSPHRASE=packages-gpg:passphrase |
||||
- env: |
||||
BUILD_IN_CONTAINER: false |
||||
DRONE_TAG: "${{ needs.version.outputs.version }}" |
||||
IMAGE_TAG: "${{ needs.version.outputs.version }}" |
||||
NFPM_SIGNING_KEY_FILE: "nfpm-private-key.key" |
||||
SKIP_ARM: false |
||||
name: "build artifacts" |
||||
run: | |
||||
cat <<EOF | docker run \ |
||||
--interactive \ |
||||
--env BUILD_IN_CONTAINER \ |
||||
--env DRONE_TAG \ |
||||
--env IMAGE_TAG \ |
||||
--env NFPM_PASSPHRASE \ |
||||
--env NFPM_SIGNING_KEY \ |
||||
--env NFPM_SIGNING_KEY_FILE \ |
||||
--env SKIP_ARM \ |
||||
--volume .:/src/loki \ |
||||
--workdir /src/loki \ |
||||
--entrypoint /bin/sh "grafana/loki-build-image:0.33.0" |
||||
git config --global --add safe.directory /src/loki |
||||
echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE |
||||
make dist packages |
||||
EOF |
||||
working-directory: "release" |
||||
- name: "upload build artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}" |
||||
path: "release/dist" |
||||
process_gcloudignore: false |
||||
fluent-bit: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/fluent-bit/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/fluent-bit-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/fluent-bit:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/fluent-bit-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
fluentd: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/fluentd/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/fluentd-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/fluentd:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/fluentd-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
logcli: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/logcli/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/logcli-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/logcli:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/logcli-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
logstash: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/logstash/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/logstash-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/logstash:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/logstash-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
loki: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-canary: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki-canary/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-canary-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-canary:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-canary-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-canary-boringcrypto: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki-canary-boringcrypto/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-canary-boringcrypto-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-canary-boringcrypto:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-canary-boringcrypto-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-operator: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release/operator" |
||||
file: "release/operator/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-operator-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-operator:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-operator-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
promtail: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/promtail/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/promtail-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/promtail:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/promtail-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
querytee: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/querytee/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/querytee-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/querytee:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/querytee-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
version: |
||||
needs: |
||||
- "check" |
||||
outputs: |
||||
pr_created: "${{ steps.version.outputs.pr_created }}" |
||||
version: "${{ steps.version.outputs.version }}" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- id: "extract_branch" |
||||
name: "extract branch name" |
||||
run: | |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- id: "version" |
||||
name: "get release version" |
||||
run: | |
||||
npm install |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--dry-run \ |
||||
--dry-run-output release.json \ |
||||
--release-type simple \ |
||||
--repo-url="${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token="${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" |
||||
|
||||
if [[ `jq length release.json` -gt 1 ]]; then |
||||
echo 'release-please would create more than 1 PR, so cannot determine correct version' |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
exit 1 |
||||
fi |
||||
|
||||
if [[ `jq length release.json` -eq 0 ]]; then |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
else |
||||
version="$(npm run --silent get-version)" |
||||
echo "Parsed version: ${version}" |
||||
echo "version=${version}" >> $GITHUB_OUTPUT |
||||
echo "pr_created=true" >> $GITHUB_OUTPUT |
||||
fi |
||||
working-directory: "lib" |
||||
name: "create release PR" |
||||
"on": |
||||
push: |
||||
branches: |
||||
- "k[0-9]+" |
||||
permissions: |
||||
contents: "write" |
||||
id-token: "write" |
||||
pull-requests: "write" |
||||
|
||||
@ -1,21 +1,773 @@ |
||||
--- |
||||
name: 'create release PR for patch releases' |
||||
on: |
||||
push: |
||||
branches: |
||||
- 'release-[0-9].[0-9].x' |
||||
workflow_dispatch: {} |
||||
permissions: |
||||
contents: 'write' |
||||
issues: 'write' |
||||
pull-requests: 'write' |
||||
concurrency: |
||||
group: "create-release-pr-${{ github.sha }}" |
||||
env: |
||||
DOCKER_USERNAME: "grafana" |
||||
IMAGE_PREFIX: "grafana" |
||||
RELEASE_REPO: "grafana/loki" |
||||
SKIP_VALIDATION: false |
||||
VERSIONING_STRATEGY: "always-bump-patch" |
||||
jobs: |
||||
create-release-pr: |
||||
uses: github/loki-release/.github/workflows/release-pr.yml@main |
||||
check: |
||||
uses: "grafana/loki-release/.github/workflows/check.yml@release-1.10.x" |
||||
with: |
||||
release_repo: grafana/loki |
||||
skip_validation: false |
||||
versioning_strategy: always-bump-patch |
||||
secrets: |
||||
GCS_SERVICE_ACCOUNT_KEY: '${{ secrets.BACKEND_ENTERPRISE_DRONE }}' |
||||
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |
||||
create-release-pr: |
||||
needs: |
||||
- "dist" |
||||
- "fluent-bit" |
||||
- "fluentd" |
||||
- "logcli" |
||||
- "logstash" |
||||
- "loki" |
||||
- "loki-canary" |
||||
- "loki-canary-boringcrypto" |
||||
- "loki-operator" |
||||
- "promtail" |
||||
- "querytee" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- id: "extract_branch" |
||||
name: "extract branch name" |
||||
run: | |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- env: |
||||
SHA: "${{ github.sha }}" |
||||
id: "release" |
||||
name: "release please" |
||||
run: | |
||||
npm install |
||||
echo "Pull request footer: Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--label "backport main,autorelease: pending,type/docs" \ |
||||
--pull-request-footer "Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" \ |
||||
--release-type simple \ |
||||
--repo-url "${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token "${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" \ |
||||
--separate-pull-requests false \ |
||||
--debug |
||||
working-directory: "lib" |
||||
dist: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- id: "get-secrets" |
||||
name: "get nfpm signing keys" |
||||
uses: "grafana/shared-workflows/actions/get-vault-secrets@main" |
||||
with: |
||||
common_secrets: | |
||||
NFPM_SIGNING_KEY=packages-gpg:private-key |
||||
NFPM_PASSPHRASE=packages-gpg:passphrase |
||||
- env: |
||||
BUILD_IN_CONTAINER: false |
||||
DRONE_TAG: "${{ needs.version.outputs.version }}" |
||||
IMAGE_TAG: "${{ needs.version.outputs.version }}" |
||||
NFPM_SIGNING_KEY_FILE: "nfpm-private-key.key" |
||||
SKIP_ARM: false |
||||
name: "build artifacts" |
||||
run: | |
||||
cat <<EOF | docker run \ |
||||
--interactive \ |
||||
--env BUILD_IN_CONTAINER \ |
||||
--env DRONE_TAG \ |
||||
--env IMAGE_TAG \ |
||||
--env NFPM_PASSPHRASE \ |
||||
--env NFPM_SIGNING_KEY \ |
||||
--env NFPM_SIGNING_KEY_FILE \ |
||||
--env SKIP_ARM \ |
||||
--volume .:/src/loki \ |
||||
--workdir /src/loki \ |
||||
--entrypoint /bin/sh "grafana/loki-build-image:0.33.0" |
||||
git config --global --add safe.directory /src/loki |
||||
echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE |
||||
make dist packages |
||||
EOF |
||||
working-directory: "release" |
||||
- name: "upload build artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}" |
||||
path: "release/dist" |
||||
process_gcloudignore: false |
||||
fluent-bit: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/fluent-bit/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/fluent-bit-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/fluent-bit:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/fluent-bit-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
fluentd: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/fluentd/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/fluentd-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/fluentd:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/fluentd-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
logcli: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/logcli/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/logcli-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/logcli:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/logcli-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
logstash: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/logstash/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/logstash-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/logstash:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/logstash-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
loki: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-canary: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki-canary/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-canary-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-canary:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-canary-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-canary-boringcrypto: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/loki-canary-boringcrypto/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-canary-boringcrypto-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-canary-boringcrypto:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-canary-boringcrypto-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
loki-operator: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release/operator" |
||||
file: "release/operator/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/loki-operator-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/loki-operator:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/loki-operator-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
promtail: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/clients/cmd/promtail/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/promtail-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/promtail:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/promtail-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
- "linux/arm64" |
||||
- "linux/arm" |
||||
querytee: |
||||
needs: |
||||
- "version" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- id: "platform" |
||||
name: "parse image platform" |
||||
run: | |
||||
mkdir -p images |
||||
|
||||
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" |
||||
echo "platform=${platform}" >> $GITHUB_OUTPUT |
||||
echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "Build and export" |
||||
timeout-minutes: 25 |
||||
uses: "docker/build-push-action@v5" |
||||
with: |
||||
context: "release" |
||||
file: "release/cmd/querytee/Dockerfile" |
||||
outputs: "type=docker,dest=release/images/querytee-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
platforms: "${{ matrix.platform }}" |
||||
tags: "${{ env.IMAGE_PREFIX }}/querytee:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" |
||||
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}" |
||||
name: "upload artifacts" |
||||
uses: "google-github-actions/upload-cloud-storage@v2" |
||||
with: |
||||
destination: "loki-build-artifacts/${{ github.sha }}/images" |
||||
path: "release/images/querytee-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" |
||||
process_gcloudignore: false |
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
platform: |
||||
- "linux/amd64" |
||||
version: |
||||
needs: |
||||
- "check" |
||||
outputs: |
||||
pr_created: "${{ steps.version.outputs.pr_created }}" |
||||
version: "${{ steps.version.outputs.version }}" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- id: "extract_branch" |
||||
name: "extract branch name" |
||||
run: | |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- id: "version" |
||||
name: "get release version" |
||||
run: | |
||||
npm install |
||||
npm exec -- release-please release-pr \ |
||||
--consider-all-branches \ |
||||
--dry-run \ |
||||
--dry-run-output release.json \ |
||||
--release-type simple \ |
||||
--repo-url="${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ steps.extract_branch.outputs.branch }}" \ |
||||
--token="${{ secrets.GH_TOKEN }}" \ |
||||
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" |
||||
|
||||
if [[ `jq length release.json` -gt 1 ]]; then |
||||
echo 'release-please would create more than 1 PR, so cannot determine correct version' |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
exit 1 |
||||
fi |
||||
|
||||
if [[ `jq length release.json` -eq 0 ]]; then |
||||
echo "pr_created=false" >> $GITHUB_OUTPUT |
||||
else |
||||
version="$(npm run --silent get-version)" |
||||
echo "Parsed version: ${version}" |
||||
echo "version=${version}" >> $GITHUB_OUTPUT |
||||
echo "pr_created=true" >> $GITHUB_OUTPUT |
||||
fi |
||||
working-directory: "lib" |
||||
name: "create release PR" |
||||
"on": |
||||
push: |
||||
branches: |
||||
- "release-[0-9]+.[0-9]+.x" |
||||
permissions: |
||||
contents: "write" |
||||
id-token: "write" |
||||
pull-requests: "write" |
||||
|
||||
@ -1,19 +1,131 @@ |
||||
--- |
||||
name: 'create release' |
||||
on: |
||||
concurrency: |
||||
group: "create-release-${{ github.sha }}" |
||||
env: |
||||
IMAGE_PREFIX: "grafana" |
||||
RELEASE_REPO: "grafana/loki" |
||||
jobs: |
||||
createRelease: |
||||
if: "${{ fromJSON(needs.shouldRelease.outputs.shouldRelease) }}" |
||||
needs: |
||||
- "shouldRelease" |
||||
outputs: |
||||
sha: "${{ needs.shouldRelease.outputs.sha }}" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "setup node" |
||||
uses: "actions/setup-node@v4" |
||||
with: |
||||
node-version: 20 |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up Cloud SDK" |
||||
uses: "google-github-actions/setup-gcloud@v2" |
||||
with: |
||||
version: ">= 452.0.0" |
||||
- name: "download binaries" |
||||
run: | |
||||
echo "downloading binaries to $(pwd)/dist" |
||||
gsutil cp -r gs://loki-build-artifacts/${{ needs.shouldRelease.outputs.sha }}/dist . |
||||
working-directory: "release" |
||||
- id: "release" |
||||
name: "create release" |
||||
run: | |
||||
npm install |
||||
npm exec -- release-please github-release \ |
||||
--draft \ |
||||
--release-type simple \ |
||||
--repo-url="${{ env.RELEASE_REPO }}" \ |
||||
--target-branch "${{ needs.shouldRelease.outputs.branch }}" \ |
||||
--token="${{ secrets.GH_TOKEN }}" |
||||
working-directory: "lib" |
||||
- env: |
||||
GH_TOKEN: "${{ secrets.GH_TOKEN }}" |
||||
id: "upload" |
||||
name: "upload artifacts" |
||||
run: | |
||||
gh release upload ${{ needs.shouldRelease.outputs.name }} dist/* |
||||
gh release edit ${{ needs.shouldRelease.outputs.name }} --draft=false |
||||
working-directory: "release" |
||||
publishImages: |
||||
needs: |
||||
- "createRelease" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- name: "auth gcs" |
||||
uses: "google-github-actions/auth@v2" |
||||
with: |
||||
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" |
||||
- name: "Set up Cloud SDK" |
||||
uses: "google-github-actions/setup-gcloud@v2" |
||||
with: |
||||
version: ">= 452.0.0" |
||||
- name: "Set up QEMU" |
||||
uses: "docker/setup-qemu-action@v3" |
||||
- name: "set up docker buildx" |
||||
uses: "docker/setup-buildx-action@v3" |
||||
- name: "Login to DockerHub (from vault)" |
||||
uses: "grafana/shared-workflows/actions/dockerhub-login@main" |
||||
- name: "download images" |
||||
run: | |
||||
echo "downloading images to $(pwd)/images" |
||||
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images . |
||||
- name: "publish docker images" |
||||
uses: "./lib/actions/push-images" |
||||
with: |
||||
imageDir: "images" |
||||
imagePrefix: "${{ env.IMAGE_PREFIX }}" |
||||
shouldRelease: |
||||
outputs: |
||||
branch: "${{ steps.extract_branch.outputs.branch }}" |
||||
name: "${{ steps.should_release.outputs.name }}" |
||||
sha: "${{ steps.should_release.outputs.sha }}" |
||||
shouldRelease: "${{ steps.should_release.outputs.shouldRelease }}" |
||||
runs-on: "ubuntu-latest" |
||||
steps: |
||||
- name: "pull code to release" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "release" |
||||
repository: "${{ env.RELEASE_REPO }}" |
||||
- name: "pull release library code" |
||||
uses: "actions/checkout@v4" |
||||
with: |
||||
path: "lib" |
||||
repository: "grafana/loki-release" |
||||
- id: "extract_branch" |
||||
name: "extract branch name" |
||||
run: | |
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
||||
working-directory: "release" |
||||
- id: "should_release" |
||||
name: "should a release be created?" |
||||
uses: "./lib/actions/should-release" |
||||
with: |
||||
baseBranch: "${{ steps.extract_branch.outputs.branch }}" |
||||
name: "create release" |
||||
"on": |
||||
push: |
||||
branches: |
||||
- 'release-[0-9].[0-9].x' |
||||
- 'k[0-9]*' |
||||
workflow_dispatch: {} |
||||
- "release-[0-9]+.[0-9]+.x" |
||||
- "k[0-9]+" |
||||
permissions: |
||||
contents: write |
||||
pull-requests: write |
||||
jobs: |
||||
release: |
||||
uses: github/loki-release/.github/workflows/release.yml@main |
||||
with: |
||||
release_repo: grafana/loki |
||||
secrets: |
||||
GCS_SERVICE_ACCOUNT_KEY: '${{ secrets.BACKEND_ENTERPRISE_DRONE }}' |
||||
GH_TOKEN: '${{ secrets.GH_TOKEN }}' |
||||
contents: "write" |
||||
id-token: "write" |
||||
pull-requests: "write" |
||||
|
||||
@ -1,6 +1,3 @@ |
||||
{ |
||||
"cmd/loki": "2.9.4", |
||||
"cmd/loki-canary": "2.9.4", |
||||
"cmd/logcli": "2.9.4", |
||||
"clients/cmd/promtail": "2.9.4" |
||||
".": "2.9.4" |
||||
} |
||||
|
||||
Loading…
Reference in new issue