Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autobump Collector VERSION to latest on build - #1401

Merged
merged 5 commits into from
Jul 16, 2024

Conversation

nslaughter
Copy link
Contributor

@nslaughter nslaughter commented Jun 21, 2024

The purpose of the PR is to automate the Lambda Layer Collector build and release process by extracting version information from dependency files for the LDFLAGS in go build and store the information in the VERSION file where it can be used by processes (such as crafting release notes) where consistent version information is needed.

@nslaughter nslaughter requested a review from a team as a code owner June 21, 2024 22:29
@nslaughter nslaughter changed the title Auto increment version Autobump Collector VERSION to latest on build - Jun 22, 2024
collector/Makefile Outdated Show resolved Hide resolved
Replace the mechanism to fetch VERSION from remote versions.yaml with OTELCOL_VERSION placeholder.
Add a new target set-otelcol-version to set the OpenTelemetry Collector version from go.mod.
Modify the build target to depend on set-otelcol-version.
Remove the update-collector-version target and its usage in the build target.
modified:   .gitignore
deleted:    collector/VERSION
Copy link
Member

@tylerbenson tylerbenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.

@tylerbenson tylerbenson added the go Pull requests that update Go code label Jul 16, 2024
GIT_SHA=$(shell git rev-parse HEAD)
GOARCH ?= amd64
GOBUILD=GO111MODULE=on CGO_ENABLED=0 installsuffix=cgo go build -trimpath
BUILD_INFO_IMPORT_PATH=main

LDFLAGS=-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).Version=$(VERSION) \
LDFLAGS=-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).Version=$(OTELCOL_VERSION) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL variables in Makefiles are dynamically expanded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tylerbenson tylerbenson merged commit e5b3f00 into main Jul 16, 2024
13 checks passed
@tylerbenson tylerbenson deleted the autobump-collector-version branch July 16, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants