Skip to content

Commit

Permalink
Test build for #1050
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak authored and SUSE Update Bot committed Apr 27, 2024
1 parent f21074f commit 238018b
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .obs/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ staging_build:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: openjdk-21-devel-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: packaging-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: pcp-image
Expand Down Expand Up @@ -288,6 +292,9 @@ refresh_devel_BCI:
- trigger_services:
project: devel:BCI:Tumbleweed
package: openjdk-21-devel-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: packaging-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: pcp-image
Expand Down
51 changes: 51 additions & 0 deletions packaging-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: MIT

# Copyright (c) 2024 SUSE LLC

# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon.

# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
# It is maintained by the BCI team and generated by
# https://github.com/SUSE/BCI-dockerfile-generator

# Please submit bugfixes or comments via https://bugs.opensuse.org/
# You can contact the BCI team via https://github.com/SUSE/bci/discussions


#!BuildTag: opensuse/osc:%%osc_version%%
#!BuildTag: opensuse/osc:%%osc_version%%-%RELEASE%
#!BuildTag: opensuse/osc:latest

FROM opensuse/tumbleweed:latest

MAINTAINER openSUSE (https://www.opensuse.org/)

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.application.osc
LABEL org.opencontainers.image.title="openSUSE Tumbleweed Packaging"
LABEL org.opencontainers.image.description="Packaging container based on the openSUSE Tumbleweed Base Container Image."
LABEL org.opencontainers.image.version="%%osc_version%%"
LABEL org.opencontainers.image.url="https://www.opensuse.org"
LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="openSUSE Project"
LABEL org.opencontainers.image.source="%SOURCEURL%"
LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/packaging-image/README.md"
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime"
LABEL org.opensuse.release-stage="released"

# endlabelprefix
LABEL run="podman run --rm -it -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z IMAGE"
LABEL runcwd="podman run --rm -it -v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z -v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z -v .:/root/osc-workdir:z IMAGE"

RUN set -euo pipefail; zypper -n in --no-recommends osc 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}
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/bin/bash"]
WORKDIR /root/osc-workdir
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

VOLUME /var/tmp
61 changes: 61 additions & 0 deletions packaging-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Packaging Container

This is the openSUSE packaging container image, it includes all the necessary
software to create and modify packages on the [Open Build
Service](https://build.opensuse.org/) using
[osc](https://github.com/openSUSE/osc/).


## How to use this container image

This container image is intended for interactive usage with your `.oscrc` and
the osc cookiejar mounted into the container:

```ShellSession
# podman run --rm -it \
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:rw,z \
registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE%
```

The above command launches an interactive shell where your local osc config will
be used. You can then proceed to checkout packages, perform modifications and
send submissions to OBS.

To work on an already checked out package, mount the current working directory
as well:

```ShellSession
# podman run --rm -it \
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
-v .:/root/osc-workdir:z \
registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE%
```

### Connecting to build.suse.de

build.suse.de uses a ssh based authentication and thus requires additional
resources to be available in the container:

```ShellSession
# podman run --rm -it \
-v ~/.config/osc/oscrc:/root/.config/osc/oscrc:ro,z \
-v ~/.local/state/osc/cookiejar:/root/.local/state/osc/cookiejar:z \
-v /etc/ssl/ca-bundle.pem:/etc/ssl/ca-bundle.pem:ro,z \
-v $SSH_AUTH_SOCK:/run/user/0/ssh-agent.socket:z \
-e SSH_AUTH_SOCK=/var/run/user/0/ssh-agent.socket:z \
-v "$PWD":/root/osc-workdir:z \
registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE%
```


## Limitations

- It is currently not possible to build packages in a container.


## Volumes

The container image is preconfigured to put `/var/tmp` into a volume. This
directory is used by `osc` to store the buildroot and the package cache.
9 changes: 9 additions & 0 deletions packaging-image/_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<services>
<service mode="buildtime" name="docker_label_helper"/>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">Dockerfile</param>
<param name="regex">%%osc_version%%</param>
<param name="package">osc</param>
</service>
</services>
13 changes: 13 additions & 0 deletions packaging-image/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ ! -e /root/.config/osc/oscrc ]]; then
cat << EOF
This container is expected to be launched with your oscrc mounted to
/root/.config/osc/oscrc
Please consult the README or the label 'run' for the full invocation.
EOF
fi


exec "$@"
4 changes: 4 additions & 0 deletions packaging-image/packaging-image.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------
Sat Apr 27 08:07:53 UTC 2024 - SUSE Update Bot <[email protected]>

- First version of the Packaging BCI

0 comments on commit 238018b

Please sign in to comment.