Skip to content

Make changes to CI so Docker image is reused. #110

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

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

haydenroche5
Copy link
Contributor

No description provided.

@haydenroche5 haydenroche5 self-assigned this Sep 20, 2023
@haydenroche5 haydenroche5 force-pushed the reuse_docker_image branch 17 times, most recently from 6d998f0 to 5b7aa0d Compare September 21, 2023 19:57
Dockerfile Outdated
@@ -83,7 +89,6 @@ RUN ["dash", "-c", "\
"]

# Configure Arduino CLI
USER ${USER}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line was what was causing all the failed builds while I was iterating on this PR. See https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

It's important to have this. Otherwise, root owns everything you build on your machine when you run the container locally. Then you don't have permissions to delete build artifacts, when you are outside the container.

@@ -164,20 +168,21 @@ if [ 0 -eq ${all_tests_result} ]; then

# Run coverage if available
if [ $(which lcov) ]; then
rm mock-*.gc?? *_Mock.gc?? *test.gc?? \
&& gcov --version \
rm mock-*.gc?? *_Mock.gc?? *test.gc??
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was failing here locally and that was causing the rest of the coverage commands below to not happen. I separated out this rm step from the rest of the steps below so that if the rm fails, we still do the other steps.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

I think we can just add the -f flag to the rm to ensure rm doesn't "fail".

I agree it's probably better to run on it's own, because running coverage should not be dependent on it's success. Let's go ahead and add the -f parameter, because it will clean up the logs.

args:
- -c
- "cp -r . /home/blues/Arduino/libraries/Blues_Wireless_Notecard \
&& HOME=/home/blues arduino-cli compile \
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the part you missed, and why you had to comment out the USER instruction from the Dockerfile (actions/runner#1876).

Dockerfile Outdated
@@ -83,7 +89,6 @@ RUN ["dash", "-c", "\
"]

# Configure Arduino CLI
USER ${USER}
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -164,20 +168,21 @@ if [ 0 -eq ${all_tests_result} ]; then

# Run coverage if available
if [ $(which lcov) ]; then
rm mock-*.gc?? *_Mock.gc?? *test.gc?? \
&& gcov --version \
rm mock-*.gc?? *_Mock.gc?? *test.gc??
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

I think we can just add the -f flag to the rm to ensure rm doesn't "fail".

I agree it's probably better to run on it's own, because running coverage should not be dependent on it's success. Let's go ahead and add the -f parameter, because it will clean up the logs.

Dockerfile Outdated
@@ -83,7 +89,6 @@ RUN ["dash", "-c", "\
"]

# Configure Arduino CLI
USER ${USER}
Copy link
Contributor

Choose a reason for hiding this comment

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

It's important to have this. Otherwise, root owns everything you build on your machine when you run the container locally. Then you don't have permissions to delete build artifacts, when you are outside the container.

@zfields
Copy link
Contributor

zfields commented Sep 23, 2023

Did coverage drop because we are no longer running the lcov with the new flags?

It's probably more accurate, but let's figure out what happened.

@haydenroche5 haydenroche5 merged commit 55c21dd into master Sep 28, 2023
@haydenroche5 haydenroche5 deleted the reuse_docker_image branch September 28, 2023 01:32
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