Skip to content

Commit 71e4f7a

Browse files
author
SUSE Update Bot
committed
Test build for #1050
1 parent cb64504 commit 71e4f7a

File tree

7 files changed

+224
-17
lines changed

7 files changed

+224
-17
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

mariadb-image/healthcheck.sh

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,40 @@ connect()
6666
return "$s";
6767
;;
6868
esac
69-
# falling back to this if there wasn't a connection answer.
70-
set +e +o pipefail
71-
# (on second extra_file)
72-
# shellcheck disable=SC2086
73-
mariadb ${nodefaults:+--no-defaults} \
69+
# falling back to tcp if there wasn't a connection answer.
70+
s=$(mariadb ${nodefaults:+--no-defaults} \
7471
${def['file']:+--defaults-file=${def['file']}} \
7572
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
7673
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
7774
--skip-ssl --skip-ssl-verify-server-cert \
78-
-h localhost --protocol tcp -e 'select 1' 2>&1 \
79-
| grep -qF "Can't connect"
80-
local ret=${PIPESTATUS[1]}
81-
set -eo pipefail
82-
if (( "$ret" == 0 )); then
83-
# grep Matched "Can't connect" so we fail
84-
connect_s=1
85-
else
86-
connect_s=0
87-
fi
75+
-h localhost --protocol tcp \
76+
--skip-column-names --batch --skip-print-query-on-error \
77+
-e 'select @@skip_networking' 2>&1)
78+
79+
case "$s" in
80+
1) # skip-networking=1 (no network)
81+
;&
82+
ERROR\ 2002\ \(HY000\):*)
83+
# cannot connect
84+
connect_s=1
85+
;;
86+
0) # skip-networking=0
87+
;&
88+
ERROR\ 1820\ \(HY000\)*) # password expire
89+
;&
90+
ERROR\ 4151\ \(HY000\):*) # account locked
91+
;&
92+
ERROR\ 1226\ \(42000\)*) # resource limit exceeded
93+
;&
94+
ERROR\ 1[0-9][0-9][0-9]\ \(28000\):*)
95+
# grep access denied and other 28000 client errors - we did connect
96+
connect_s=0
97+
;;
98+
*)
99+
>&2 echo "Unknown error $s"
100+
connect_s=1
101+
;;
102+
esac
88103
return $connect_s
89104
}
90105

@@ -367,8 +382,8 @@ while [ $# -gt 0 ]; do
367382
fi
368383
shift
369384
done
370-
if [ -z "$connect_s" ]; then
371-
# we didn't do a connnect test, so the current success status is suspicious
385+
if [ "$connect_s" != "0" ]; then
386+
# we didn't pass a connnect test, so the current success status is suspicious
372387
# return what connect thinks.
373388
connect
374389
exit $?

packaging-image/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 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 cpio 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 git openssh-common openssh-clients; 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 -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 -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+
50+
VOLUME /var/tmp

packaging-image/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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 configuration. You can then check out packages, perform modifications, and
24+
send submissions to OBS.
25+
26+
To work on an already checked out package, mount the current working directory:
27+
28+
```ShellSession
29+
# podman run --rm -it \
30+
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
31+
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
32+
-v .:/root/osc-workdir:z \
33+
registry.opensuse.org/opensuse/osc:%%osc_version%%
34+
```
35+
36+
The container entrypoint recognizes whether you are launching it for interactive
37+
usage or invoking `osc` directly. You can omit
38+
the command `osc` in the second case. For example:
39+
40+
```ShellSession
41+
# podman run --rm -it \
42+
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
43+
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
44+
registry.opensuse.org/opensuse/osc:%%osc_version%% ls openSUSE:Factory
45+
```
46+
47+
The command automatically forwards the arguments to `osc` and calls
48+
`osc ls openSUSE:Factory`.
49+
50+
51+
### Using the image labels
52+
53+
The image provides two labels: `run` and `runcwd`. The first includes the full command, to run the `osc` container, while the second to run the container with the local working directory mounted.
54+
55+
To view the labels, use the following command:
56+
57+
```ShellSession
58+
# podman container runlabel run --display registry.opensuse.org/opensuse/osc:%%osc_version%%
59+
# podman container runlabel runcwd --display registry.opensuse.org/opensuse/osc:%%osc_version%%
60+
```
61+
62+
The labels can be used to run the container with Podman version 5.1.0 or later:
63+
```ShellSession
64+
# podman container runlabel run registry.opensuse.org/opensuse/osc:%%osc_version%% \
65+
ls openSUSE:Factory
66+
```
67+
68+
69+
### Connecting to build.suse.de
70+
71+
build.suse.de uses an SSH-based authentication, which requires additional
72+
resources to be available in the container. You also must provide the internal certificate to the container:
73+
74+
```ShellSession
75+
# podman run --rm -it \
76+
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
77+
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
78+
-v /etc/ssl/ca-bundle.pem:/etc/ssl/ca-bundle.pem:ro,z \
79+
-v $SSH_AUTH_SOCK:/run/user/0/ssh-agent.socket:z \
80+
-e SSH_AUTH_SOCK=/var/run/user/0/ssh-agent.socket:z \
81+
-v "$PWD":/root/osc-workdir:z \
82+
registry.opensuse.org/opensuse/osc:%%osc_version%%
83+
```
84+
85+
86+
## Limitations
87+
88+
- Currently, it is not possible to build packages in a container.
89+
- The `runlabel run` command only works with Podman 5.1.0 and newer.
90+
91+
92+
## Volumes
93+
94+
The container image is preconfigured to put `/var/tmp` into a volume. This
95+
directory is used by `osc` to store the buildroot and the package cache.
96+
97+
## Licensing
98+
99+
`SPDX-License-Identifier: MIT`
100+
101+
This documentation and the build recipe are licensed as MIT.
102+
The container itself contains various software components under various open source licenses listed in the associated
103+
Software Bill of Materials (SBOM).
104+
105+
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 04 11:52:25 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
3+
4+
- First version of the Packaging BCI

0 commit comments

Comments
 (0)