|
| 1 | +# OSC Packaging Container |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +This is the openSUSE packaging container image that includes all the required |
| 6 | +tools for creating and modifying packages in the [Open Build |
| 7 | +Service](https://build.opensuse.org/) using |
| 8 | +[osc](https://github.com/openSUSE/osc/). |
| 9 | + |
| 10 | + |
| 11 | +## How to use this container image |
| 12 | + |
| 13 | +The container image is intended for interactive usage with a `.oscrc` configuration file and |
| 14 | +the osc cookiejar mounted into the container: |
| 15 | + |
| 16 | +```ShellSession |
| 17 | +# podman run --rm -it \ |
| 18 | + -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \ |
| 19 | + -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:rw,z \ |
| 20 | + registry.opensuse.org/opensuse/osc:%%osc_version%% |
| 21 | +``` |
| 22 | + |
| 23 | +The command launches an interactive shell environment that uses the local osc |
| 24 | +configuration. You can then check out packages, perform modifications, and send |
| 25 | +submissions to OBS. |
| 26 | + |
| 27 | +To work on an already checked out package, mount the current working directory: |
| 28 | + |
| 29 | +```ShellSession |
| 30 | +# podman run --rm -it \ |
| 31 | + -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \ |
| 32 | + -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \ |
| 33 | + -v .:/root/osc-workdir:z \ |
| 34 | + registry.opensuse.org/opensuse/osc:%%osc_version%% |
| 35 | +``` |
| 36 | + |
| 37 | +The container entrypoint recognizes whether you are launching it for interactive |
| 38 | +usage or invoking `osc` directly. You can omit the command `osc` in the second |
| 39 | +case. For example: |
| 40 | + |
| 41 | +```ShellSession |
| 42 | +# podman run --rm -it \ |
| 43 | + -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \ |
| 44 | + -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \ |
| 45 | + registry.opensuse.org/opensuse/osc:%%osc_version%% \ |
| 46 | + ls openSUSE:Factory |
| 47 | +``` |
| 48 | + |
| 49 | +The command automatically forwards the arguments to `osc` and calls |
| 50 | +`osc ls openSUSE:Factory`. |
| 51 | + |
| 52 | + |
| 53 | +### Building packages |
| 54 | + |
| 55 | +The container image can be used to build packages using the podman build backend |
| 56 | +(the default in this container image). The podman backend can only build RPM |
| 57 | +packages, building containers with docker or disk images with kiwi is not |
| 58 | +supported at the moment. |
| 59 | + |
| 60 | +`osc` will cache build dependencies in the pre-configured `packagecachedir`. The |
| 61 | +`packagecachedir` defaults to `/var/tmp/osbuild-packagecache` and is declared as |
| 62 | +a volume in this container image. To speed up package builds, it is recommended |
| 63 | +to bind mount the package cache directory onto the host or use a persistent |
| 64 | +container volume, e.g. as follows: |
| 65 | + |
| 66 | +```ShellSession |
| 67 | +# podman run --rm -it \ |
| 68 | + -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \ |
| 69 | + -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \ |
| 70 | + -v pkgcache:/var/tmp/osbuild-packagecache \ |
| 71 | + registry.opensuse.org/opensuse/osc:%%osc_version%% |
| 72 | +``` |
| 73 | + |
| 74 | +The above command only applies if you are using the default package cache |
| 75 | +location. Obtain the current setting via: |
| 76 | + |
| 77 | +```ShellSession |
| 78 | +# osc config general packagecachedir |
| 79 | +'general': 'packagecachedir' is set to '/var/tmp/osbuild-packagecache' |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | +### Using the image labels |
| 84 | + |
| 85 | +The image provides four labels: `run`, `runv`, `runcwd`, `runcwdv`. The `run` |
| 86 | +label includes the full command, to run the `osc` container, while the `runcwd` |
| 87 | +label additionally mounts the current working directory to `/root/osc-workdir` |
| 88 | +(the container images' working directory). The labels with the `v` appended |
| 89 | +additionally include the directive to mount a container volume called `pkgcache` |
| 90 | +to `/var/tmp/osbuild-packagecache`. |
| 91 | + |
| 92 | +To view the labels, use the following command: |
| 93 | + |
| 94 | +```ShellSession |
| 95 | +# podman container runlabel run --display registry.opensuse.org/opensuse/osc:%%osc_version%% |
| 96 | +``` |
| 97 | + |
| 98 | +The labels can be used to run the container with Podman version 5.1.0 or later: |
| 99 | + |
| 100 | +```ShellSession |
| 101 | +# podman container runlabel run \ |
| 102 | + registry.opensuse.org/opensuse/osc:%%osc_version%% \ |
| 103 | + ls openSUSE:Factory |
| 104 | +``` |
| 105 | + |
| 106 | + |
| 107 | +### Connecting to build.suse.de |
| 108 | + |
| 109 | +build.suse.de uses an SSH-based authentication, which requires additional |
| 110 | +resources to be available in the container. You also must provide the internal certificate to the container: |
| 111 | + |
| 112 | +```ShellSession |
| 113 | +# podman run --rm -it \ |
| 114 | + -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \ |
| 115 | + -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \ |
| 116 | + -v /etc/ssl/ca-bundle.pem:/etc/ssl/ca-bundle.pem:ro,z \ |
| 117 | + -v $SSH_AUTH_SOCK:/run/user/0/ssh-agent.socket:z \ |
| 118 | + -e SSH_AUTH_SOCK=/var/run/user/0/ssh-agent.socket:z \ |
| 119 | + -v "$PWD":/root/osc-workdir:z \ |
| 120 | + registry.opensuse.org/opensuse/osc:%%osc_version%% |
| 121 | +``` |
| 122 | + |
| 123 | + |
| 124 | +## Limitations |
| 125 | + |
| 126 | +- Currently, it is not possible to build container images or disk images in a |
| 127 | + container. |
| 128 | +- The `runlabel run` command only works with Podman 5.1.0 and newer. |
| 129 | + |
| 130 | + |
| 131 | +## Volumes |
| 132 | + |
| 133 | +The container image is preconfigured to put `/var/tmp` into a volume. This |
| 134 | +directory is used by `osc` to store the buildroot and the package cache. |
| 135 | + |
| 136 | +## Licensing |
| 137 | + |
| 138 | +`SPDX-License-Identifier: MIT` |
| 139 | + |
| 140 | +This documentation and the build recipe are licensed as MIT. |
| 141 | +The container itself contains various software components under various open source licenses listed in the associated |
| 142 | +Software Bill of Materials (SBOM). |
| 143 | + |
| 144 | +This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/). |
0 commit comments