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

Add backup logic for Go installation in Amazon Linux buildspec #4253

Merged
merged 16 commits into from
Jul 31, 2024

Conversation

Ephylouise
Copy link
Contributor

@Ephylouise Ephylouise commented Jul 23, 2024

Summary

This PR adds backup go installation logic for Amazon Linux buildspec. Between July 16-22 our Go version did not match Amazon Linux's Go version. This caused the AL make target to fail and a lack of All-Dogs AL artifacts. They are building now, but this adds logic to install the latest available Go version, if our specified version is not yet available.

  • July 16th: the ‘dev’ branch GO_VERSION file was updated from 1.22.3 to 1.22.5
  • July 22nd: Amazon Linux’s Go version was updated from 1.22.4 to 1.22.5

PRs that were created or updated between July 16th - July 22nd did not successfully build Amazon Linux 2 or 2023 All-Dogs artifacts because Amazon Linux 2023 version 2023.5.20240708 was Unable to find a match: golang-1.22.5.

Implementation details

This edit adds logic to the Go installation within the Amazon Linux buildspec file. First, it tries to install the Go version from the amazon-ecs-agent repo’s GO_VERSION file. If that fails, it will find that latest available Go version for the platform instead.

Testing

Testing was performed on a forked branch and personal Isengard account, which mirrors the configuration of the CodeBuild projects in the dev+ci account. See this PR for more details.

  • Tested by hard coding incorrect GOVERION variable GOVERSION="1.99.9"
    • Successfully installed Go 1.22.5 even with an incompatible GO_VERSION variable.
Error: Unable to find a match: golang-1.99.9
Specified Go version 1.99.9 not found, installing latest available version
Last metadata expiration check: 0:00:28 ago on Tue Jul 23 19:08:20 2024.
Dependencies resolved.
================================================================================
 Package         Arch        Version                     Repository        Size
================================================================================
Installing:
 golang          x86_64      1.22.5-1.amzn2023.0.1       amazonlinux      661 k

Different approach attempted:

Using source ./scripts/install-golang.sh to install Go and download it from the source was attempted. The source install script approach does not work for Amazon Linux build jobs, as the environment changes made by that script do not persist to the rest of the build steps running in a separate shell session. Instead, the reliable way to install Go is through the package manager (yum or dnf), which ensures the necessary environment variables are set correctly for the entire build process.

Description for the changelog

Adds backup logic to install latest available Go version in Amazon Linux buildspec

Does this PR include breaking model changes? If so, Have you added transformation functions?
No

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Ephylouise Ephylouise merged commit 5c2d1bf into aws:dev Jul 31, 2024
40 checks passed
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

Successfully merging this pull request may close these issues.

5 participants