skopeo icon indicating copy to clipboard operation
skopeo copied to clipboard

Help for overriding paths during build

Open glensc opened this issue 5 years ago • 12 comments

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

  • https://github.com/Homebrew/homebrew-core/pull/47766
  • https://github.com/Homebrew/homebrew-core/pull/45834

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?

glensc avatar Dec 12 '19 11:12 glensc

@lsm5 any tips?

TomSweeneyRedHat avatar Dec 12 '19 14:12 TomSweeneyRedHat

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.

mtrmac avatar Dec 12 '19 16:12 mtrmac

@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. https://github.com/containers/skopeo/pull/1168 What else needs to change? Seems like we could fix this one rather quickly.

rhatdan avatar Jan 19 '21 15:01 rhatdan

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.

mateuszkwiatkowski avatar Apr 28 '21 12:04 mateuszkwiatkowski

@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?

rhatdan avatar Apr 28 '21 13:04 rhatdan

@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?

mateuszkwiatkowski avatar Apr 30 '21 12:04 mateuszkwiatkowski

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.

mtrmac avatar Apr 30 '21 16:04 mtrmac

Hi @rhatdan and @mtrmac,

I addressed my problem in PR https://github.com/containers/skopeo/pull/1298. Please take a look if it's good to be merged. Thanks!

mateuszkwiatkowski avatar May 26 '21 20:05 mateuszkwiatkowski

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

github-actions[bot] avatar Jun 26 '21 00:06 github-actions[bot]

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?

lsm5 avatar Nov 15 '21 15:11 lsm5

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.

mtrmac avatar Nov 15 '21 15:11 mtrmac

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

github-actions[bot] avatar Jun 27 '22 00:06 github-actions[bot]