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

[DEV] Improve how versioning is handle between main driver and plugins #19

Open
davidallendj opened this issue Oct 14, 2024 · 0 comments

Comments

@davidallendj
Copy link
Collaborator

Short Description
The configurator currently has a way of checking if both the main driver and generator plugins are built using the same git commit. This tends to work fine when the binaries are being built within a clone repository, but fails when built externally, since the method for getting the version commit is just running a git command:

func GitCommit() string {
	c := exec.Command("git", "rev-parse", "--short=8", "HEAD")
	stdout, err := c.Output()
	if err != nil {
		return ""
	}

	return strings.TrimRight(string(stdout), "\n")
}

Instead, it may be a better idea to use a version tag (with commit as well if necessary) that gets injected when building the binaries. Having the version tag injected external to the program itself should allow the version tag to be included when the binaries are built external to the repository.

Definition of Done
This task will be considered complete once the versioning is done external to configurator through a script or the Makefile.

Additional context
There are examples from SMD and magellan how this task should be completed. The main program must contain variables that are set via LDFLAGS when building:

LDFLAGS="-s -X=$(GIT)main.commit=$(BUILD) -X=$(GIT)main.version=$(VERSION) -X=$(GIT)main.date=$(shell date +%Y-%m-%d:%H:%M:%S)"

The main program should contain variables like so:

var (
	version string
	commit  string
	date    string
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant