From a4b9ad0a1ef86fd1d651a3d7995e7e4f2f334945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Wed, 24 Apr 2024 09:20:30 +0000 Subject: [PATCH] Test build for #1050 --- .obs/workflows.yml | 7 ++++ packaging-image/Dockerfile | 50 +++++++++++++++++++++++++ packaging-image/README.md | 47 +++++++++++++++++++++++ packaging-image/_service | 9 +++++ packaging-image/entrypoint.sh | 18 +++++++++ packaging-image/packaging-image.changes | 4 ++ 6 files changed, 135 insertions(+) create mode 100644 packaging-image/Dockerfile create mode 100644 packaging-image/README.md create mode 100644 packaging-image/_service create mode 100644 packaging-image/entrypoint.sh create mode 100644 packaging-image/packaging-image.changes diff --git a/.obs/workflows.yml b/.obs/workflows.yml index 16dab16d5..0f3e1814e 100644 --- a/.obs/workflows.yml +++ b/.obs/workflows.yml @@ -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 @@ -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 diff --git a/packaging-image/Dockerfile b/packaging-image/Dockerfile new file mode 100644 index 000000000..3f1faffa3 --- /dev/null +++ b/packaging-image/Dockerfile @@ -0,0 +1,50 @@ +# 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 + +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; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2} +ENV OSC_APIURL="https://api.opensuse.org" + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +WORKDIR /src/ +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +VOLUME /var/tmp diff --git a/packaging-image/README.md b/packaging-image/README.md new file mode 100644 index 000000000..343b61569 --- /dev/null +++ b/packaging-image/README.md @@ -0,0 +1,47 @@ +# 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` +mounted into the container: + +```ShellSession +# podman run --rm -it -v ~/.config/osc/oscrc:/root/.config/osc/oscrc: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. + +You can also let the container image's entrypoint generate a `oscrc` for you +using the environment variables `OSC_USER` and `OSC_PASSWORD`. It will create a +configuration for the OBS instance with the API URL saved in the environment variable +`OSC_APIURL` (defaults to api.opensuse.org): + +```ShellSession +# podman run --rm -it -e OSC_USER=my_user -e OSC_PASSWORD=mySecretPassword \ + registry.opensuse.org/opensuse/osc:%%osc_version%%-%RELEASE% +``` + +Note that you should disable your shell's history as it will otherwise container +your password in plain text. + + +## Limitations + +- It is currently not possible to build packages in a container. + +- Cannot communicate with build.suse.de + + +## 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. \ No newline at end of file diff --git a/packaging-image/_service b/packaging-image/_service new file mode 100644 index 000000000..37cff407b --- /dev/null +++ b/packaging-image/_service @@ -0,0 +1,9 @@ + + + + + Dockerfile + %%osc_version%% + osc + + \ No newline at end of file diff --git a/packaging-image/entrypoint.sh b/packaging-image/entrypoint.sh new file mode 100644 index 000000000..92ac76eea --- /dev/null +++ b/packaging-image/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eo pipefail + +if [ ! -f "$HOME/.config/osc/oscrc" ]; then + mkdir -p "$HOME/.config/osc" + if [ -z ${OSC_USER+x} ] && [ -z ${OSC_PASSWORD+y} ]; then + echo "[general] +apiurl = ${OSC_APIURL} + +[${OSC_APIURL}] +user = ${OSC_USER} +pass = ${OSC_PASSWORD} +" > "$HOME/.config/osc/oscrc" + fi +fi + +exec "$@" diff --git a/packaging-image/packaging-image.changes b/packaging-image/packaging-image.changes new file mode 100644 index 000000000..672684a00 --- /dev/null +++ b/packaging-image/packaging-image.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Apr 24 09:20:29 UTC 2024 - SUSE Update Bot + +- First version of the Packaging BCI