-
Notifications
You must be signed in to change notification settings - Fork 619
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
Derive version in agent, ecs-init, and .rpm/.deb packages from the toplevel VERSION file #4423
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinnywang
changed the title
Consolidate version files
Simplify the process of updating version
Nov 8, 2024
tinnywang
changed the title
Simplify the process of updating version
Derive version in agent, ecs-init, and .rpm/.deb packages from the toplevel VERSION file
Nov 8, 2024
tinnywang
force-pushed
the
consolidate-version
branch
from
November 8, 2024 18:32
55d7de8
to
74874b7
Compare
sparrc
approved these changes
Nov 8, 2024
amogh09
approved these changes
Nov 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 🎉
mye956
approved these changes
Nov 8, 2024
Merged
prateekchaudhry
added a commit
to prateekchaudhry/amazon-ecs-agent
that referenced
this pull request
Nov 18, 2024
prateekchaudhry
added a commit
to prateekchaudhry/amazon-ecs-agent
that referenced
this pull request
Nov 18, 2024
…m the toplevel VERSION file aws#4423"; Update agent to 1.89.0
prateekchaudhry
added a commit
to prateekchaudhry/amazon-ecs-agent
that referenced
this pull request
Nov 18, 2024
…m the toplevel VERSION file aws#4423"; Update agent to 1.89.0
prateekchaudhry
added a commit
that referenced
this pull request
Nov 19, 2024
…m the toplevel VERSION file #4423"; Update agent to 1.89.0
JoseVillalta
pushed a commit
to JoseVillalta/amazon-ecs-agent
that referenced
this pull request
Nov 21, 2024
…plevel VERSION file (aws#4423)
JoseVillalta
pushed a commit
to JoseVillalta/amazon-ecs-agent
that referenced
this pull request
Nov 21, 2024
…m the toplevel VERSION file aws#4423"; Update agent to 1.89.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When releasing a new version of Agent, we need to manually update version in several places before running
version-gen.go
:This PR consolidates the Agent and ecs-init VERSION files into a single source of truth from which we derive version in go code and RPM spec files. With these changes, we need only update the toplevel VERSION file before running
version-gen.go
.Implementation details
Consolidate Agent and ecs-init VERSION files
We only need a single VERSION file because Agent and ecs-init always release together with the same version, so keep VERSION, remove ECSVERSION, and replace any references to ECSVERSION with VERSION.
Consolidate scripts for generating
version.go
We have 3 different scripts for generating
version.go
files in Agent and ecs-init.version-gen.go
only generatesagent/version/version.go
. We commit changes to this file.update-version.sh
generatesagent/version/version.go
andecs-init/version/version.go
. We don't commit changes to either file, which is why the info in ecs-init'sversion.go
is so out-of-date.update-version
doesn't appear to be used.Update
version-gen.go
to generateversion.go
files in both theagent/version
andecs-init/version
packages. Replace references toupdate-version.sh
withversion-gen.go
. Finally, updateconfig.DefaultAgentVersion
amazon-ecs-agent/ecs-init/config/common.go
Line 48 in ea4ffcd
to use
version.Version
Derive RPM spec file version from VERSION
In our Makefile, update
rpmbuild
commands to define a%version
macro. The%version
macro will evaluate to the value in our VERSION file.In the amazon-linux-ami-integrated spec and the generic-rpm-integrated spec, replace the hard-coded version string with
%{version}
.Other notable changes
version-gen.go
was inagent/version/gen
. It is now in the toplevelscripts
directory since it is used by both agent and ecs-init. It should be run from the root of the repo, e.g.go run scripts/version-gen.go
../scripts/update-version.sh
to regenerate the ecs-init version file. I have moved this call intoscripts/gobuild.sh
since the .rpm/.deb package builders all eventually callgobuild.sh
.gobuild.sh
also usesversion-gen.go
instead ofupdate-version.sh
.scripts/gobuild.sh
set linker flags to override ecs-init version variables. This is how we've been able to release correctly versioned ecs-inits without committing changes to ecs-init'sversion.go
. Setting linker flags isn't necessary anymore because weversion.go
(when the script runsversion-gen.go
, as mentioned in the previous bullet point)version.go
(the releaser will do this when creating the release PR)amazon-ecs-agent/scripts/gobuild.sh
Lines 28 to 38 in ea4ffcd
Testing
Built and installed .rpm/.deb packages on the appropriate platforms.
Verified that the ecs-init version info was correct with
Changed the semver in the toplevel VERSION file and then rebuilt and reinstalled ecs-init.
Verified that the newly installed ecs-init version info had the new semver.
Description for the changelog
Derive version in agent, ecs-init, and .rpm/.deb packages from the toplevel VERSION file.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.