summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--classes/container-bundle.bbclass13
-rw-r--r--recipes-containers/container-registry/container-registry-index.bb13
2 files changed, 22 insertions, 4 deletions
diff --git a/classes/container-bundle.bbclass b/classes/container-bundle.bbclass
index 53b7b2f8..6f43149b 100644
--- a/classes/container-bundle.bbclass
+++ b/classes/container-bundle.bbclass
@@ -280,6 +280,12 @@ python __anonymous() {
280 d.setVar('_PROCESSED_BUNDLES', ' '.join(processed_bundles)) 280 d.setVar('_PROCESSED_BUNDLES', ' '.join(processed_bundles))
281 d.setVar('_BUNDLE_RUNTIME', runtime) 281 d.setVar('_BUNDLE_RUNTIME', runtime)
282 282
283 # Remote containers are fetched during do_fetch (network is allowed there).
284 # extend_recipe_sysroot populates the native sysroot so skopeo is available.
285 if remote_urls:
286 d.appendVarFlag('do_fetch', 'prefuncs', ' extend_recipe_sysroot')
287 d.appendVarFlag('do_fetch', 'postfuncs', ' do_fetch_containers')
288
283 # Build service file map for custom service files 289 # Build service file map for custom service files
284 # Format: container1=/path/to/file1;container2=/path/to/file2 290 # Format: container1=/path/to/file1;container2=/path/to/file2
285 service_mappings = [] 291 service_mappings = []
@@ -324,7 +330,7 @@ python do_fetch_containers() {
324 fetched_dir = os.path.join(workdir, 'fetched') 330 fetched_dir = os.path.join(workdir, 'fetched')
325 os.makedirs(fetched_dir, exist_ok=True) 331 os.makedirs(fetched_dir, exist_ok=True)
326 332
327 # Find skopeo in native sysroot (available after do_prepare_recipe_sysroot) 333 # Find skopeo in native sysroot (populated by extend_recipe_sysroot prefunc)
328 # skopeo-native installs to sbindir, not bindir 334 # skopeo-native installs to sbindir, not bindir
329 staging_sbindir = d.getVar('STAGING_SBINDIR_NATIVE') 335 staging_sbindir = d.getVar('STAGING_SBINDIR_NATIVE')
330 skopeo = os.path.join(staging_sbindir, 'skopeo') 336 skopeo = os.path.join(staging_sbindir, 'skopeo')
@@ -363,8 +369,9 @@ python do_fetch_containers() {
363 bb.fatal(f"Failed to fetch container '{url}': {e}") 369 bb.fatal(f"Failed to fetch container '{url}': {e}")
364} 370}
365 371
366do_fetch_containers[network] = "1" 372# do_fetch_containers runs as a postfunc of do_fetch (set in __anonymous
367addtask fetch_containers after do_prepare_recipe_sysroot before do_compile 373# when remote containers are configured). This keeps network access within
374# do_fetch where it is permitted by yocto-check-layer.
368 375
369do_compile() { 376do_compile() {
370 set -e 377 set -e
diff --git a/recipes-containers/container-registry/container-registry-index.bb b/recipes-containers/container-registry/container-registry-index.bb
index 590e89b3..7d53e28e 100644
--- a/recipes-containers/container-registry/container-registry-index.bb
+++ b/recipes-containers/container-registry/container-registry-index.bb
@@ -84,7 +84,18 @@ python do_container_registry_index() {
84 bb.plain(f"Pushed {len(pushed_refs)} image references to {registry}") 84 bb.plain(f"Pushed {len(pushed_refs)} image references to {registry}")
85} 85}
86 86
87addtask do_container_registry_index before do_build 87addtask do_container_registry_index
88
89python do_build() {
90 bb.plain("")
91 bb.plain("Container registry push requires explicit invocation (network access")
92 bb.plain("is not permitted during the normal build chain).")
93 bb.plain("")
94 bb.plain("To push OCI images to the registry, run:")
95 bb.plain("")
96 bb.plain(" bitbake container-registry-index -c container_registry_index")
97 bb.plain("")
98}
88 99
89# Generate a helper script with paths baked in 100# Generate a helper script with paths baked in
90# Script is placed alongside registry storage (outside tmp/) so it persists 101# Script is placed alongside registry storage (outside tmp/) so it persists