Skip to content

Commit

Permalink
feat: add release please config (#11333) (#11789)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:

The new release process is being developed in another repo for now as it
enables much faster feedback loops. We are at the stage where we are
pulling the Loki repo and building images, so it's time to move the
`release-please` config into Loki, and configure it for the various
packages we will be releasing.

This PR adds the two basic configs that `release-please` requires. This
PR does not change anything about the release process, it just enables
us to keep iterating out of band until we're ready to move over.

This was already added to `main`, but adding here so I can test it on
the release branch

**Which issue(s) this PR fixes**:
Re #11332
  • Loading branch information
trevorwhitney committed Jan 26, 2024
1 parent da6c26f commit e628f5d
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 11 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/minor-release-pr.yml
@@ -0,0 +1,21 @@
---
name: 'create release PR for minor releases'
on:
push:
branches:
- 'k[0-9]*'
workflow_dispatch: {}
permissions:
contents: 'write'
issues: 'write'
pull-requests: 'write'
jobs:
create-release-pr:
uses: github/loki-release/.github/workflows/release-pr.yml@main
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 }}'
21 changes: 21 additions & 0 deletions .github/workflows/patch-release-pr.yml
@@ -0,0 +1,21 @@
---
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'
jobs:
create-release-pr:
uses: github/loki-release/.github/workflows/release-pr.yml@main
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 }}'
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,19 @@
---
name: 'create release'
on:
push:
branches:
- 'release-[0-9].[0-9].x'
- 'k[0-9]*'
workflow_dispatch: {}
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 }}'
6 changes: 6 additions & 0 deletions .release-please-manifest.json
@@ -0,0 +1,6 @@
{
"cmd/loki": "2.9.4",
"cmd/loki-canary": "2.9.4",
"cmd/logcli": "2.9.4",
"clients/cmd/promtail": "2.9.4"
}
39 changes: 28 additions & 11 deletions Makefile
Expand Up @@ -281,14 +281,24 @@ cmd/migrate/migrate:
#############
GOX = gox $(GO_FLAGS) -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
CGO_GOX = gox $(DYN_GO_FLAGS) -cgo -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}"

SKIP_ARM ?= false
dist: clean
ifeq ($(SKIP_ARM),true)
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/logcli
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
CGO_ENABLED=0 $(GOX) -osarch="darwin/amd64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
CGO_ENABLED=1 $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/amd64" ./clients/cmd/promtail
else
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/logcli
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
CGO_ENABLED=0 $(GOX) -osarch="darwin/amd64 darwin/arm64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig" CC="aarch64-linux-gnu-gcc" $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/arm64" ./clients/cmd/promtail
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabihf/pkgconfig" CC="arm-linux-gnueabihf-gcc" $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/arm" ./clients/cmd/promtail
CGO_ENABLED=1 $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/amd64" ./clients/cmd/promtail
endif
for i in dist/*; do zip -j -m $$i.zip $$i; done
pushd dist && sha256sum * > SHA256SUMS && popd

Expand All @@ -307,7 +317,7 @@ publish: packages
lint: ## run linters
go version
golangci-lint version
GO111MODULE=on golangci-lint run -v
GO111MODULE=on golangci-lint run -v --timeout 15m
faillint -paths "sync/atomic=go.uber.org/atomic" ./...

########
Expand Down Expand Up @@ -786,30 +796,37 @@ check-doc: doc
###################
# Example Configs #
###################
EXAMPLES_DOC_PATH := $(DOC_SOURCES_PATH)/configure/examples
EXAMPLES_DOC_OUTPUT_PATH := $(EXAMPLES_DOC_PATH)/configuration-examples.md
EXAMPLES_YAML_PATH := $(EXAMPLES_DOC_PATH)/yaml
EXAMPLES_SKIP_VALIDATION_FLAG := "doc-example:skip-validation=true"

# Validate the example configurations that we provide in ./docs/sources/configure/examples
# We run the validation only for complete examples, not snippets.
# Complete examples should contain "Example" in their file name.
validate-example-configs: loki
for f in ./docs/sources/configure/examples/*.yaml; do echo "Validating provided example config: $$f" && ./cmd/loki/loki -config.file=$$f -verify-config || exit 1; sleep 1; done
for f in $$(grep -rL $(EXAMPLES_SKIP_VALIDATION_FLAG) $(EXAMPLES_YAML_PATH)/*.yaml); do echo "Validating provided example config: $$f" && ./cmd/loki/loki -config.file=$$f -verify-config || exit 1; done

validate-dev-cluster-config: loki
./cmd/loki/loki -config.file=./tools/dev/loki-boltdb-storage-s3/config/loki.yaml -verify-config

# Dynamically generate ./docs/sources/configure/examples.md using the example configs that we provide.
# This target should be run if any of our example configs change.
generate-example-config-doc:
$(eval CONFIG_DOC_PATH=$(DOC_SOURCES_PATH)/configure)
$(eval CONFIG_EXAMPLES_PATH=$(CONFIG_DOC_PATH)/examples)
echo "Removing existing doc at $(CONFIG_DOC_PATH)/examples.md and re-generating. . ."
echo "Removing existing doc at $(EXAMPLES_DOC_OUTPUT_PATH) and re-generating. . ."
# Title and Heading
echo -e "---\ntitle: Examples\ndescription: Loki Configuration Examples\n---\n # Examples" > $(CONFIG_DOC_PATH)/examples.md
echo -e "---\ntitle: Configuration\ndescription: Loki Configuration Examples and Snippets\nweight: 100\n---\n# Configuration" > $(EXAMPLES_DOC_OUTPUT_PATH)
# Append each configuration and its file name to examples.md
for f in $$(find $(CONFIG_EXAMPLES_PATH)/*.yaml -printf "%f\n" | sort -k1n); do \
echo -e "\n## $$f\n\n\`\`\`yaml\n" >> $(CONFIG_DOC_PATH)/examples.md; \
cat $(CONFIG_EXAMPLES_PATH)/$$f >> $(CONFIG_DOC_PATH)/examples.md; \
echo -e "\n\`\`\`\n" >> $(CONFIG_DOC_PATH)/examples.md; \
for f in $$(find $(EXAMPLES_YAML_PATH)/*.yaml -printf "%f\n" | sort -k1n); do \
echo -e "\n## $$f\n\n\`\`\`yaml\n" >> $(EXAMPLES_DOC_OUTPUT_PATH); \
grep -v $(EXAMPLES_SKIP_VALIDATION_FLAG) $(EXAMPLES_YAML_PATH)/$$f >> $(EXAMPLES_DOC_OUTPUT_PATH); \
echo -e "\n\`\`\`\n" >> $(EXAMPLES_DOC_OUTPUT_PATH); \
done


# Fail our CI build if changes are made to example configurations but our doc is not updated
check-example-config-doc: generate-example-config-doc
@if ! (git diff --exit-code ./docs/sources/configure/examples.md); then \
@if ! (git diff --exit-code $(EXAMPLES_DOC_OUTPUT_PATH)); then \
echo -e "\nChanges found in generated example configuration doc"; \
echo "Run 'make generate-example-config-doc' and commit the changes to fix this error."; \
echo "If you are actively developing these files you can ignore this error"; \
Expand Down

0 comments on commit e628f5d

Please sign in to comment.