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

Fix /frontend container build issues #80

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Conversation

mjlshen
Copy link
Contributor

@mjlshen mjlshen commented Apr 29, 2024

There were specific issues building the /frontend container when using colima on macOS that this PR fixes with documentation. However, /frontend was also failing to build due to go module/workspace issues the dependabot is also running into: https://github.com/Azure/ARO-HCP/security/dependabot/6. This PR fixes our build issues and also shifts to runtime/debug.buildInfo so that we don't need to leverage a build-time ldflag Version variable anymore.
 

What this PR does

  • add git into Dockerfile build step
  • remove static Version variable in favor of buildinfo
  • replace statements are needed to correctly import /internal into /frontend
  • store the commit hash via runtime/debug.buildInfo instead of ldflags
  • describe the required colima configuration for macOS

e.g. Sample current output:

❯ ARO_HCP_IMAGE_ACR=mshen make frontend-build-container

docker build --platform="linux/amd64" -f "frontend/Dockerfile" -t mshen.azurecr.io/arohcpfrontend:50eacd9 .
[+] Building 0.4s (12/12) FINISHED                                                                                                                                                                 ...

❯ docker run --rm -it mshen.azurecr.io/arohcpfrontend:50eacd9                                    
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
{"time":"2024-04-29T23:51:02.09201068Z","level":"INFO","msg":"ARO HCP Frontend (50eacd9168e28c817f57154aec9e2ca28b6e2859) started"}
{"time":"2024-04-29T23:51:02.099208117Z","level":"INFO","msg":"listening on 0.0.0.0:8443"}
^C{"time":"2024-04-29T23:51:03.684648398Z","level":"INFO","msg":"caught interrupt signal"}
{"time":"2024-04-29T23:51:03.686885321Z","level":"INFO","msg":"ARO HCP Frontend (50eacd9168e28c817f57154aec9e2ca28b6e2859) stopped"}

@@ -38,7 +38,7 @@ brew install colima

Before running your devcontainer, make sure colima is started.
```bash
colima start
colima start --cpu 4 --memory 8 --vz-rosetta --vm-type=vz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fyi @s-amann this alone should largely remediate macOS build issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

👏 thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

if anyone had already ran colima start you may need to run colima stop; colima delete before attempting to run with these new vm options

Comment on lines +2 to +3
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9-1161 AS builder
RUN microdnf install -y tar make git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notably switched the builder container to ubi-minimal as well and am installing git into the builder container

* replace statements are needed to import /internal
* store the commit hash via runtime/debug.buildInfo instead of ldflags
* describe the required colima configuration for macOS

Signed-off-by: Michael Shen <[email protected]>

clean:
rm --force aro-hcp-frontend
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The --force flag doesn't exist on macOS (by default anyway...)

Copy link
Collaborator

@mbarnes mbarnes left a comment

Choose a reason for hiding this comment

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

Requested one change since we're doing away with versions.

Makefile Show resolved Hide resolved
@mbarnes mbarnes dismissed their stale review April 30, 2024 09:10

Requested change has been addressed. Need to take a closer look at the rest.

@s-amann s-amann merged commit f079b69 into Azure:main Apr 30, 2024
3 checks passed
@mjlshen mjlshen deleted the frontend-version branch May 1, 2024 13:08
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.

3 participants