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

Help for overriding paths during build #787

Open
glensc opened this issue Dec 12, 2019 · 12 comments · May be fixed by #1507
Open

Help for overriding paths during build #787

glensc opened this issue Dec 12, 2019 · 12 comments · May be fixed by #1507
Assignees
Labels
kind/bug A defect in an existing functionality (or a PR fixing it)

Comments

@glensc
Copy link
Contributor

glensc commented Dec 12, 2019

in brew packaging, the paths have gone wrong at least twice now:

FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory

Is there anything from skopeo side that can be done to improve this?

For example support for building to use standard env variables or build from makefile and make arguments.

Or alias the build time configurable into namespace that does not change with each release for example to main module? config module?

        "-X main.systemRegistriesDirPath=#{etc/"containers/registries.d"}",
        "-X main.unixTempDirForBigFiles=/var/tmp",
        "-X main.systemDefaultPolicyPath=#{etc/"containers/policy.json"}",
        "-X main.systemRegistriesConfPath=#{etc/"containers/registries.conf"}",

also, perhaps skopeo --version --verbose (or skypeo --config, or skopeo config)could output configured paths? so could use assert_match in brew formula test stage?

@TomSweeneyRedHat
Copy link
Member

@lsm5 any tips?

@mtrmac
Copy link
Contributor

mtrmac commented Dec 12, 2019

Thanks for your report.

https://github.com/Homebrew/homebrew-core/pull/47766/files does indeed look painful — likely enough to happen again, and it fails silently.

In principle I think the skopeo Makefile should be handling that, e.g. making sure the destinations used to install files (CONTAINERSSYSCONFIGDIR and the like) and the paths hard-coded into the binary match. (It may impact integration tests, though.)

Figuring out the c/image major version component automatically within the Makefile should be possible as well. Testing that the overrides are applied and not ignored would, I suppose, happen through the integration tests “impacted” above.

jcpetruzza added a commit to heyhabito/nixpkgs that referenced this issue Mar 10, 2020
We started having issues with `pkgs.dockerTools.pullImage`, were it
would fail with:

```
FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory
```

It turns out that since `skopeo` was bumped to `0.1.40`, it was
accidentally no longer being built with a default policy.

This may happen again, see containers/skopeo#787
adisbladis pushed a commit to NixOS/nixpkgs that referenced this issue Mar 10, 2020
We started having issues with `pkgs.dockerTools.pullImage`, were it
would fail with:

```
FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory
```

It turns out that since `skopeo` was bumped to `0.1.40`, it was
accidentally no longer being built with a default policy.

This may happen again, see containers/skopeo#787
adisbladis pushed a commit to NixOS/nixpkgs that referenced this issue Mar 10, 2020
We started having issues with `pkgs.dockerTools.pullImage`, were it
would fail with:

```
FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory
```

It turns out that since `skopeo` was bumped to `0.1.40`, it was
accidentally no longer being built with a default policy.

This may happen again, see containers/skopeo#787

(cherry picked from commit a646f4b)
zhenyavinogradov pushed a commit to serokell/nixpkgs that referenced this issue Mar 16, 2020
We started having issues with `pkgs.dockerTools.pullImage`, were it
would fail with:

```
FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory
```

It turns out that since `skopeo` was bumped to `0.1.40`, it was
accidentally no longer being built with a default policy.

This may happen again, see containers/skopeo#787
@rhatdan
Copy link
Member

rhatdan commented Jan 19, 2021

@glensc @lsm5 Could you work together to open a PR to fix this issue.
I opened a PR to fix Makefile handling of PREFIX and DESTDIR. #1168
What else needs to change? Seems like we could fix this one rather quickly.

@mateuszkwiatkowski
Copy link
Contributor

mateuszkwiatkowski commented Apr 28, 2021

This is also makes porting to FreeBSD harder - FreeBSD ports install files with PREFIX = /usr/local and skopeo can't find configuration without manual intervention or setting ldflags.

@rhatdan
Copy link
Member

rhatdan commented Apr 28, 2021

@mateuszkwiatkowski Please open a PR to fix issues that you see. My PR was merged back in January, what other issues do you want fixed?

@mateuszkwiatkowski
Copy link
Contributor

@rhatdan the issue here is that containers/image doesn't respect $PREFIX - it uses hardcoded value of /etc/containers.
My proposition is to either look for config in both paths (/usr/local/etc/, /etc) or generate path during the build our of $PREFIX. What do you think?

@mtrmac
Copy link
Contributor

mtrmac commented Apr 30, 2021

I don’t think that adding more hard-coded paths to c/image is going to make relocation any easier.

At the top level, Skopeo’s Makefile should be setting the various -X flags based on $PREFIX and other overrides; the user intent is clear from that.

That makes the discussion of what c/image should support ultimately less urgent. I could imagine another c/image variable (github.com/containers/image/v5/internal.{prefix,sysConfDir} ?) so that many users only need to set one or two values instead of several; I’m not immediately sure whether that would actually work as expected, or whether it is worth it.)


BTW c/image/docker.perHostCertDirs hard-codes /etc paths without a way to override; that should probably be fixed.

mateuszkwiatkowski added a commit to runhyve/skopeo that referenced this issue May 26, 2021
Handling $PREFIX for binaries and documentation was fixed in
containers#1168.
This commit puts configuration files to $PREFIX/etc/containers.

Fixes containers#787
@mateuszkwiatkowski
Copy link
Contributor

Hi @rhatdan and @mtrmac,

I addressed my problem in PR #1298. Please take a look if it's good to be merged. Thanks!

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@lsm5
Copy link
Member

lsm5 commented Nov 15, 2021

I addressed my problem in PR #1298. Please take a look if it's good to be merged. Thanks!

Since the PR #1298 has been closed, are we ok closing this issue?

@mtrmac
Copy link
Contributor

mtrmac commented Nov 15, 2021

Well it would still be a good idea (but low priority, sure) to make this easier; #1298 not being finished doesn’t mean the problem went away.

lsm5 added a commit to lsm5/skopeo that referenced this issue Nov 16, 2021
This will put config dir under $PREFIX for FreeBSD.

Continuing PR#1298 by @mateuszkwiatkowski.

Fixes: containers#787

Signed-off-by: Lokesh Mandvekar <[email protected]>
@lsm5 lsm5 linked a pull request Nov 16, 2021 that will close this issue
lsm5 added a commit to lsm5/skopeo that referenced this issue Nov 16, 2021
This will put config dir under $PREFIX for FreeBSD.

Continuing PR#1298 by @mateuszkwiatkowski.

Fixes: containers#787

Signed-off-by: Lokesh Mandvekar <[email protected]>
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@mtrmac mtrmac added the kind/bug A defect in an existing functionality (or a PR fixing it) label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A defect in an existing functionality (or a PR fixing it)
Projects
None yet
6 participants