Accepting request 717358 from home:kukuk:container

- Split from CaaSP image
  - add labes
  - include special etcd package
  - include etcd migraton script for kubeadm (disabled)

OBS-URL: https://build.opensuse.org/request/show/717358
OBS-URL: https://build.opensuse.org/package/show/devel:kubic:containers/kubic-etcd-image?expand=0&rev=7
This commit is contained in:
Richard Brown 2019-07-22 08:59:00 +00:00 committed by Git OBS Bridge
parent e79e82dcef
commit ce2fa3d780
7 changed files with 59 additions and 196 deletions

View File

@ -1,37 +1,10 @@
<services>
<service name="obs_scm" mode="disabled">
<param name="url">https://github.com/kubic-project/container-images.git</param>
<param name="scm">git</param>
<param name="subdir">etcd-image</param>
<param name="extract">etcd-image.kiwi.ini</param>
<param name="revision">master</param>
<param name="versionformat">%cd</param>
</service>
<service name="obs_scm" mode="disabled">
<param name="url">https://github.com/kubic-project/container-images.git</param>
<param name="scm">git</param>
<param name="subdir">etcd-image/root</param>
<param name="filename">root</param>
<param name="version">_none_</param>
<param name="revision">master</param>
</service>
<service name="obs_scm" mode="disabled">
<param name="url">https://github.com/kubic-project/container-images.git</param>
<param name="scm">git</param>
<param name="extract">pre_checkin.sh</param>
<param name="revision">master</param>
<param name="versionformat">%cd</param>
</service>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">kubic-etcd-image.kiwi</param>
<param name="regex">%%SHORT_VERSION%%</param>
<param name="parse-version">minor</param>
<param name="package">etcd</param>
</service>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">kubic-etcd-image.kiwi</param>
<param name="regex">%%LONG_VERSION%%</param>
<param name="regex">%PKG_VERSION%</param>
<param name="parse-version">patch</param>
<param name="package">etcd</param>
<param name="package">etcd-for-k8s-image</param>
</service>
<service mode="buildtime" name="kiwi_label_helper"/>
</services>

20
config.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/sh
#--------------------------------------
#test -f /.profile && . /.profile
#======================================
# Greeting...
#--------------------------------------
echo "Configure image: [$kiwi_iname]..."
for i in /usr/bin/etcdctl* ; do
ln -sf $i /usr/local/bin/`basename $i`
done
for i in /usr/sbin/etcd* ; do
ln -sf $i /usr/local/bin/`basename $i`
done
ln -sf /usr/bin/migrate /usr/local/bin/
ln -sf /usr/bin/migrate-if-needed.sh /usr/local/bin/
exit 0

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- OBS-AddTag: _NAMESPACE_/etcd:%%LONG_VERSION%% _NAMESPACE_/etcd:%%LONG_VERSION%%-<RELEASE> -->
<image schemaversion="6.5" name="_PRODUCT_-etcd-image">
<description type="system">
<author>SUSE Containers Team</author>
<contact>containers@suse.com</contact>
<specification>Etcd running on a _DISTRO_ container guest</specification>
</description>
<preferences>
<type
image="docker"
derived_from="obsrepositories:/_BASEIMAGE_">
<containerconfig
name="_NAMESPACE_/etcd"
tag="%%SHORT_VERSION%%"
maintainer="SUSE Containers Team &lt;containers@suse.com&gt;">
<expose>
<port number="2379"/>
<port number="2380"/>
<port number="4001"/>
<port number="7001"/>
</expose>
<entrypoint execute="bash">
<argument name="/usr/local/bin/entrypoint.sh"/>
</entrypoint>
</containerconfig>
</type>
<version>4.0.1</version>
<packagemanager>zypper</packagemanager>
<rpm-check-signatures>false</rpm-check-signatures>
<rpm-force>true</rpm-force>
<rpm-excludedocs>true</rpm-excludedocs>
<locale>en_US</locale>
<keytable>us.map.gz</keytable>
<hwclock>utc</hwclock>
</preferences>
<repository>
<source path="obsrepositories:/"/>
</repository>
<packages type="image">
<package name="etcd"/>
<package name="etcdctl"/>
</packages>
</image>

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sat Jul 20 10:22:15 CEST 2019 - kukuk@suse.de
- Split from CaaSP image
- add labes
- include special etcd package
- include etcd migraton script for kubeadm (disabled)
-------------------------------------------------------------------
Thu Jan 10 13:30:41 UTC 2019 - Containers Team <containers-bugowner@suse.de>

View File

@ -1,48 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- OBS-AddTag: kubic/etcd:%%LONG_VERSION%% kubic/etcd:%%LONG_VERSION%%-<RELEASE> -->
<!--
This is an autogenerated file from etcd-image.kiwi.ini template.
Do not manually modify this file.
-->
<image schemaversion="6.5" name="kubic-etcd-image">
<!-- OBS-ExcludeArch: i586 s390 -->
<image schemaversion="6.9" name="kubic-etcd-image" xmlns:suse_label_helper="com.suse.label_helper">
<description type="system">
<author>SUSE Containers Team</author>
<contact>containers@suse.com</contact>
<specification>Etcd running on a openSUSE Kubic container guest</specification>
<author>Thorsten Kukuk</author>
<contact>kukuk@suse.com</contact>
<specification>Image containing etcd for openSUSE Kubic.</specification>
</description>
<preferences>
<type
image="docker"
derived_from="obsrepositories:/opensuse/tumbleweed#latest">
derived_from="obsrepositories:/opensuse/busybox#latest">
<containerconfig
name="kubic/etcd"
tag="%%SHORT_VERSION%%"
maintainer="SUSE Containers Team &lt;containers@suse.com&gt;">
tag="latest"
additionaltags="%PKG_VERSION%,%PKG_VERSION%-%RELEASE%"
maintainer="Thorsten Kukuk &lt;kukuk@suse.com&gt;">
<expose>
<port number="2379"/>
<port number="2380"/>
<port number="4001"/>
<port number="7001"/>
</expose>
<entrypoint execute="bash">
<argument name="/usr/local/bin/entrypoint.sh"/>
</entrypoint>
<subcommand execute="/bin/sh"/>
<labels>
<suse_label_helper:add_prefix prefix="org.opensuse.kubic.etcd">
<label name="org.opencontainers.image.title" value="openSUSE Kubic etcd container"/>
<label name="org.opencontainers.image.description" value="Image containing etcd for openSUSE Kubic."/>
<label name="org.opencontainers.image.version" value="%PKG_VERSION%-%RELEASE%"/>
<label name="org.opencontainers.image.created" value="%BUILDTIME%"/>
<label name="org.opensuse.reference" value="registry.opensuse.org/kubic/etcd:%PKG_VERSION%-%RELEASE%"/>
<label name="org.openbuildservice.disturl" value="%DISTURL%"/>
</suse_label_helper:add_prefix>
</labels>
<history author="Thorsten Kukuk &lt;kukuk@suse.com&gt;">openSUSE Kubic etcd container</history>
</containerconfig>
</type>
<version>4.0.1</version>
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<rpm-check-signatures>false</rpm-check-signatures>
<rpm-force>true</rpm-force>
<rpm-excludedocs>true</rpm-excludedocs>
<locale>en_US</locale>
<keytable>us.map.gz</keytable>
<hwclock>utc</hwclock>
</preferences>
<repository>
<source path="obsrepositories:/"/>
</repository>
<packages type="image">
<package name="etcd"/>
<package name="etcdctl"/>
<packages type="bootstrap">
<package name="etcd-for-k8s-image"/>
<!-- package name="kubernetes-etcd-migrate"/ -->
</packages>
</image>

View File

@ -1,92 +0,0 @@
#!/bin/bash
## pre_checkin.sh script is expected to be called from
## a local copy of the build service image after running
## the _services file, e.g. `osc service disabledrun`
log() { echo ">>> $@" ; }
abort() { log "FATAL: $@" ; exit 1 ; }
endScript() { log "EXITING: $@" ; exit 0 ; }
usage() {
cat <<USAGE
usage:
./pre_checkin.sh [kubic|caasp]
./pre_checkin.sh kubic|caasp [OPTIONS]
options:
--mkchanges Create/update the changes file (mostly used for automation)
If no parameter is given defaults to 'kubic'
USAGE
}
namespace=${1:-kubic}
mkchanges=$2
[ -n "${mkchanges}" ] && [ "${mkchanges}" != "--mkchanges" ] && usage \
&& abort "Bad option"
make_changes_file() {
local previous_commit
local changes_log
local git_log_format="- Commit %h by %an %ae %n%n%w(77,2,2)%B"
if [ -f "${changes_file}" ]; then
previous_commit="$(sed "4q;d" "${changes_file}" | cut -d' ' -f3).."
fi
# Update the changes file
pushd container-images 1> /dev/null
changes_log=$(git log --pretty=format:"${git_log_format}" \
${previous_commit} -- pre_checkin.sh \
"${image}" | sed "1 s/- \(.*$\)/\1/")
popd 1> /dev/null
[ -z "${changes_log}" ] && endScript "Missing new changelog entries"
osc vc ${changes_file} -m "${changes_log}"
}
if [ "${namespace}" == "kubic" ]; then
product='kubic'
baseimage="opensuse/tumbleweed#latest"
distro="openSUSE Kubic"
elif [[ "${namespace}" =~ ^caasp/.* ]]; then
product='caasp'
baseimage="suse/sle15#latest"
distro="SLES15"
else
usage
abort "Unknown product. Product needs to match 'kubic|caasp/.*'"
fi
set -e
for file in *kiwi.ini; do
image="${file%%.kiwi.ini}"
changes_file="${product}-${image}.changes"
kiwi_file="${product}-${image}.kiwi"
extra_packages=""
extra_packages_file="${product}-extra-packages"
# Create a list of extra packages
if [ -f "${extra_packages_file}" ]; then
while read -r package; do
extra_packages+=" <package name=\"${package}\"\/>\n"
done < "${extra_packages_file}"
fi
# update the changes file, mostly used for automation in Concourse CI
[ -n "${mkchanges}" ] && make_changes_file
# create *.kiwi file from *kiwi.ini template
cp "${file}" "${kiwi_file}"
sed -i -e "s@_BASEIMAGE_@${baseimage}@g" \
-e "s@_DISTRO_@${distro}@g" \
-e "s@_NAMESPACE_@${namespace}@g" \
-e "s@_PRODUCT_@${product}@g" \
-e "/^<image/i\<!--\n\tThis is an autogenerated \
file from ${file} template.\n\tDo not manually modify \
this file.\n-->\n" \
-e "s@_EXTRA_PACKAGES_@${extra_packages}@g" "${kiwi_file}"
# Remove blank lines
sed -i "/^ *$/d" "${kiwi_file}"
log "${kiwi_file} has been created"
done

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3001903532fb915dac046447e24635682ac4abeec8d6d021a0990752cf9e356b
size 2057