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

[tooling] Use make image to build image #273

Merged
merged 4 commits into from
Oct 20, 2023

Conversation

BenjaminPelletier
Copy link
Member

We compose a lot of make commands and shell scripts together, most of which need an up-to-date version of the monitoring image. Despite trying to signal build status through the DO_NOT_BUILD_MONITORING environment variable, we still repeatedly build the image on a single command invocation because that environment variable does not transmit through make files.

This PR resolves that issue by defining a well-formed make target for the image (correctly specifies its dependencies and generates a placeholder file with timestamp) and using that make target to build the image in all normal scripts (explicit build and release scripts still build the image regardless of currency).

@BenjaminPelletier BenjaminPelletier marked this pull request as ready for review October 19, 2023 23:58
Copy link
Contributor

@barroco barroco left a comment

Choose a reason for hiding this comment

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

Nice solution!

@@ -21,3 +21,4 @@ docker image build \
--build-arg commit_hash="$(git rev-parse HEAD)" \
. \
|| exit 1
touch monitoring/image
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Would it make sense to use a text file and write inside its purpose? Something like:
"File created by monitoring/build.sh to keep track of the latest build run date time."

Copy link
Member Author

Choose a reason for hiding this comment

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

We wouldn't want to name it differently, despite the value of making its purpose clear via, e.g., image.maketarget, since having the file named anything other than the makefile target makes management difficult within make. But content sounds good; updated.

@BenjaminPelletier BenjaminPelletier merged commit 98c3f0f into interuss:main Oct 20, 2023
8 checks passed
@BenjaminPelletier BenjaminPelletier deleted the make-image branch October 20, 2023 23:21
github-actions bot added a commit that referenced this pull request Oct 20, 2023
* Use `make image` to build image

* Make linter happy and clean up some scripts

* Add explanatory content in placeholder file 98c3f0f
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.

2 participants