Skip to content

Fix git hash calculation with Docker build - #1935

Merged
FintasticMan merged 1 commit into
InfiniTimeOrg:mainfrom
febrezo:docker-build
Nov 17, 2024
Merged

Fix git hash calculation with Docker build#1935
FintasticMan merged 1 commit into
InfiniTimeOrg:mainfrom
febrezo:docker-build

Conversation

@febrezo

@febrezo febrezo commented Dec 24, 2023

Copy link
Copy Markdown
Contributor

Fix error when compiling the Pinetime using the Docker image. If done with Docker, the container does not trust the /sources folder, leading to a blank response of the command that grabs the git commit git rev-parse --short HEAD.

fatal: detected dubious ownership in repository at '/sources'
To add an exception for this directory, call:

        git config --global --add safe.directory /sources
PROJECT_GIT_COMMIT_HASH_SUCCESS? 128

BUILD CONFIGURATION
-------------------
    * Mode : Release
    * Version : 1.3.0
    * Toolchain : /opt/gcc-arm-none-eabi-10.3-2021.10
    * GitRef(S) :
    * NRF52 SDK : /opt/nRF5_SDK_15.3.0_59ac345
    * Target device : PINETIME
    * Build DFU (using adafruit-nrfutil) : Enabled
    * Build resources : Enabled

If the git config --global --add safe.directory /sources is added to the Dockerfile, the problem is solved and the hash is added correctly.

Fixes #1842

@github-actions

github-actions Bot commented Dec 24, 2023

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 374576B -16B
data 948B 0B
bss 63504B 0B

@FintasticMan

Copy link
Copy Markdown
Member

This is likely the cause for #1842. If possible I would prefer us to figure out why the ownership is dubious and fix that before just adding marking the source dir as safe.

@FintasticMan FintasticMan added the bug Something isn't working label Jan 10, 2024

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is a valid fix for dev containers as described here: https://www.kenmuse.com/blog/avoiding-dubious-ownership-in-dev-containers/

image

@NeroBurner NeroBurner added this to the 1.15.0 milestone Nov 15, 2024
@JF002

JF002 commented Nov 17, 2024

Copy link
Copy Markdown
Collaborator

This is likely the cause for #1842. If possible I would prefer us to figure out why the ownership is dubious and fix that before just adding marking the source dir as safe.

Do you think we should block this PR until we figure that out, or can we merge it in the meantime?

Fix error when compiling the Pinetime using the Docker image.
If done with Docker, the container does not trust the /sources
folder, leading to a blank response of the command that grabs
the git commit `git rev-parse --short HEAD`.

```
fatal: detected dubious ownership in repository at '/sources'
To add an exception for this directory, call:

        git config --global --add safe.directory /sources
PROJECT_GIT_COMMIT_HASH_SUCCESS? 128

BUILD CONFIGURATION
-------------------
    * Mode : Release
    * Version : 1.3.0
    * Toolchain : /opt/gcc-arm-none-eabi-10.3-2021.10
    * GitRef(S) :
    * NRF52 SDK : /opt/nRF5_SDK_15.3.0_59ac345
    * Target device : PINETIME
    * Build DFU (using adafruit-nrfutil) : Enabled
    * Build resources : Enabled
```

If the `git config --global --add safe.directory /sources` is
added to the Dockerfile, the problem is solved and the hash is
added correctly.

@FintasticMan FintasticMan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's fine to merge it in the meantime. I've just updated this to the latest main.

@FintasticMan
FintasticMan merged commit 6c7eb66 into InfiniTimeOrg:main Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Short ref doesn't appear in CI builds

4 participants