Skip to content

Commit f77ae87

Browse files
author
SUSE Update Bot
committed
Test build for #1050
1 parent fe6aaa1 commit f77ae87

File tree

6 files changed

+204
-0
lines changed

6 files changed

+204
-0
lines changed

.obs/workflows.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ staging_build:
137137
source_project: home:defolos:BCI:CR:Tumbleweed
138138
source_package: openjdk-22-devel-image
139139
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
140+
- branch_package:
141+
source_project: home:defolos:BCI:CR:Tumbleweed
142+
source_package: packaging-image
143+
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
140144
- branch_package:
141145
source_project: home:defolos:BCI:CR:Tumbleweed
142146
source_package: pcp-image
@@ -340,6 +344,9 @@ refresh_devel_BCI:
340344
- trigger_services:
341345
project: devel:BCI:Tumbleweed
342346
package: openjdk-22-devel-image
347+
- trigger_services:
348+
project: devel:BCI:Tumbleweed
349+
package: packaging-image
343350
- trigger_services:
344351
project: devel:BCI:Tumbleweed
345352
package: pcp-image

packaging-image/Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
# Copyright (c) 2024 SUSE LLC
4+
5+
# All modifications and additions to the file contributed by third parties
6+
# remain the property of their copyright owners, unless otherwise agreed
7+
# upon.
8+
9+
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
10+
# It is maintained by the BCI team and generated by
11+
# https://github.com/SUSE/BCI-dockerfile-generator
12+
13+
# Please submit bugfixes or comments via https://bugs.opensuse.org/
14+
# You can contact the BCI team via https://github.com/SUSE/bci/discussions
15+
16+
17+
#!BuildTag: opensuse/osc:%%osc_version%%
18+
#!BuildTag: opensuse/osc:%%osc_version%%-%RELEASE%
19+
#!BuildTag: opensuse/osc:latest
20+
21+
FROM opensuse/tumbleweed:latest
22+
23+
RUN set -euo pipefail; zypper -n in osc build cpio obs-service-appimage obs-service-cargo obs-service-cdi_containers_meta obs-service-compose_kiwi_description obs-service-docker_label_helper obs-service-download_assets obs-service-download_files obs-service-download_url obs-service-extract_file obs-service-format_spec_file obs-service-go_modules obs-service-kiwi_label_helper obs-service-kiwi_metainfo_helper obs-service-kubevirt_containers_meta obs-service-node_modules obs-service-obs_scm obs-service-product_converter obs-service-recompress obs-service-refresh_patches obs-service-replace_using_env obs-service-replace_using_package_version obs-service-set_version obs-service-snapcraft obs-service-source_validator obs-service-tar obs-service-tar_scm obs-service-verify_file openSUSE-release openSUSE-release-appliance-docker bash-completion git obs-scm-bridge openssh-common openssh-clients podman runc; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
24+
25+
# Define labels according to https://en.opensuse.org/Building_derived_containers
26+
# labelprefix=org.opensuse.application.osc
27+
LABEL org.opencontainers.image.authors="openSUSE (https://www.opensuse.org/)"
28+
LABEL org.opencontainers.image.title="openSUSE Tumbleweed Packaging"
29+
LABEL org.opencontainers.image.description="Packaging container based on the openSUSE Tumbleweed Base Container Image."
30+
LABEL org.opencontainers.image.version="%%osc_version%%"
31+
LABEL org.opencontainers.image.url="https://www.opensuse.org"
32+
LABEL org.opencontainers.image.created="%BUILDTIME%"
33+
LABEL org.opencontainers.image.vendor="openSUSE Project"
34+
LABEL org.opencontainers.image.source="%SOURCEURL%"
35+
LABEL org.opencontainers.image.ref.name="%%osc_version%%-%RELEASE%"
36+
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE%"
37+
LABEL org.openbuildservice.disturl="%DISTURL%"
38+
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime#openSUSE_BCI"
39+
LABEL org.opensuse.release-stage="released"
40+
# endlabelprefix
41+
LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/packaging-image/README.md"
42+
LABEL run="podman run --rm -it --privileged -v \$HOME/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z -v \$HOME/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z IMAGE"
43+
LABEL runcwd="podman run --rm -it --privileged -v \$HOME/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z -v \$HOME/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z -v .:/root/osc-workdir:z IMAGE"
44+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
45+
CMD ["/bin/bash"]
46+
WORKDIR /root/osc-workdir
47+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
48+
RUN chmod +x /usr/local/bin/entrypoint.sh
49+
ENV OSC_VM_TYPE=podman
50+
51+
VOLUME /var/tmp

packaging-image/README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# OSC Packaging Container
2+
3+
![Redistributable](https://img.shields.io/badge/Redistributable-Yes-green)
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
56+
backend. You **must** launch the container in privileged mode for building.
57+
58+
59+
### Using the image labels
60+
61+
The image provides two labels: `run` and `runcwd`. The first includes the full
62+
command, to run the `osc` container, while the second to run the container with
63+
the local working directory mounted.
64+
65+
To view the labels, use the following command:
66+
67+
```ShellSession
68+
# podman container runlabel run --display registry.opensuse.org/opensuse/osc:%%osc_version%%
69+
# podman container runlabel runcwd --display registry.opensuse.org/opensuse/osc:%%osc_version%%
70+
```
71+
72+
The labels can be used to run the container with Podman version 5.1.0 or later:
73+
```ShellSession
74+
# podman container runlabel run \
75+
registry.opensuse.org/opensuse/osc:%%osc_version%% \
76+
ls openSUSE:Factory
77+
```
78+
79+
80+
### Connecting to build.suse.de
81+
82+
build.suse.de uses an SSH-based authentication, which requires additional
83+
resources to be available in the container. You also must provide the internal certificate to the container:
84+
85+
```ShellSession
86+
# podman run --rm -it \
87+
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
88+
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
89+
-v /etc/ssl/ca-bundle.pem:/etc/ssl/ca-bundle.pem:ro,z \
90+
-v $SSH_AUTH_SOCK:/run/user/0/ssh-agent.socket:z \
91+
-e SSH_AUTH_SOCK=/var/run/user/0/ssh-agent.socket:z \
92+
-v "$PWD":/root/osc-workdir:z \
93+
registry.opensuse.org/opensuse/osc:%%osc_version%%
94+
```
95+
96+
97+
## Limitations
98+
99+
- Currently, it is not possible to build packages in a container.
100+
- The `runlabel run` command only works with Podman 5.1.0 and newer.
101+
102+
103+
## Volumes
104+
105+
The container image is preconfigured to put `/var/tmp` into a volume. This
106+
directory is used by `osc` to store the buildroot and the package cache.
107+
108+
## Licensing
109+
110+
`SPDX-License-Identifier: MIT`
111+
112+
This documentation and the build recipe are licensed as MIT.
113+
The container itself contains various software components under various open source licenses listed in the associated
114+
Software Bill of Materials (SBOM).
115+
116+
This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/).

packaging-image/_service

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<services>
2+
<service mode="buildtime" name="docker_label_helper"/>
3+
<service mode="buildtime" name="kiwi_metainfo_helper"/>
4+
<service name="replace_using_package_version" mode="buildtime">
5+
<param name="file">Dockerfile</param>
6+
<param name="regex">%%osc_version%%</param>
7+
<param name="package">osc</param>
8+
</service>
9+
</services>

packaging-image/entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [[ ! -e /root/.config/osc/oscrc ]]; then
4+
cat << EOF
5+
This container is expected to be launched with your oscrc mounted to
6+
/root/.config/osc/oscrc
7+
8+
Please consult the README or the label 'run' for the full invocation.
9+
EOF
10+
fi
11+
12+
if [[ "-h --help -v --verbose -q --quiet --debug --debugger --post-mortem --traceback -H --http-debug --http-full-debug -A --apiurl --config --setopt --no-keyring add addchannels addcontainers addremove ar aggregatepac api branch getpac bco branchco browse build wipe shell chroot buildconfig buildhistory buildhist buildinfo buildlog buildlogtail blt bl cat less blame changedevelrequest changedevelreq cr checkconstraints checkout co clean cleanassets ca clone comment commit checkin ci config copypac create-pbuild-config cpc createincident createrequest creq delete remove del rm deleterequest deletereq droprequest dropreq dr dependson detachbranch develproject dp bsdevelproject diff di ldiff linkdiff distributions dists downloadassets da enablechannels enablechannel fork getbinaries help importsrcpkg info init jobhistory jobhist linkpac linktobranch list LL lL ll ls localbuildlog lbl lock log maintainer bugowner maintenancerequest mr mbranch maintained sm meta mkpac mv my patchinfo pdiff prdiff projdiff projectdiff prjresults pr pull pull_request rdelete rdiff rebuild rebuildpac release releaserequest remotebuildlog remotebuildlogtail rbuildlogtail rblt rbuildlog rbl repairlink repairwc repo repositories platforms repos repourls request review rq requestmaintainership reqbs reqms reqmaintainership requestbugownership reqbugownership resolved restartbuild abortbuild results r revert rpmlintlog lint rpmlint rremove search bse se sendsysrq service setdevelproject sdp setlinkrev showlinked signkey staging status st submitrequest submitpac submitreq sr token triggerreason tr undelete unlock update up updatepacmetafromspec updatepkgmetafromspec metafromspec vc version whatdependson whois user who wipebinaries unpublish workerinfo" =~ (^|[[:space:]])$1($|[[:space:]]) ]]; then
13+
# looks like the user is executing the container as the osc command
14+
osc "$@"
15+
else
16+
exec "$@"
17+
fi
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-------------------------------------------------------------------
2+
Wed Sep 11 07:46:36 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
3+
4+
- First version of the Packaging BCI

0 commit comments

Comments
 (0)