1
0

Accepting request 657073 from home:dcassany:branches:devel:kubic:containers

Remove caasp files and add pre_checkin.sh

OBS-URL: https://build.opensuse.org/request/show/657073
OBS-URL: https://build.opensuse.org/package/show/devel:kubic:containers/kubic-etcd-image?expand=0&rev=2
This commit is contained in:
Panagiotis Georgiadis 2018-12-11 09:33:00 +00:00 committed by Git OBS Bridge
parent f3fe6777f3
commit 3b8accf71c
6 changed files with 94 additions and 75 deletions

View File

@ -27,12 +27,6 @@
<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">caasp-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>
@ -40,10 +34,4 @@
<param name="parse-version">patch</param>
<param name="package">etcd</param>
</service>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">caasp-etcd-image.kiwi</param>
<param name="regex">%%LONG_VERSION%%</param>
<param name="parse-version">patch</param>
<param name="package">etcd</param>
</service>
</services>

View File

@ -1,12 +0,0 @@
-------------------------------------------------------------------
Fri Nov 16 10:50:18 UTC 2018 - mjura@suse.com
- Commit 61f2a43 by Michal Jura mjura@suse.com
Build etcd container image for kubic project
-------------------------------------------------------------------
Thu Nov 14 09:10:29 UTC 2018 - mjura@suse.com
- Initial etcd image build

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- OBS-AddTag: caasp/etcd:%%LONG_VERSION%% caasp/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="caasp-etcd">
<description type="system">
<author>SUSE Containers Team</author>
<contact>containers@suse.com</contact>
<specification>Etcd running on a SLES15 container guest</specification>
</description>
<preferences>
<type
image="docker"
derived_from="obsrepositories:/suse/sle15#current">
<containerconfig
name="caasp/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,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- OBS-AddTag: _PRODUCT_/etcd:%%LONG_VERSION%% _PRODUCT_/etcd:%%LONG_VERSION%%-<RELEASE> -->
<!-- OBS-AddTag: _NAMESPACE_/etcd:%%LONG_VERSION%% _NAMESPACE_/etcd:%%LONG_VERSION%%-<RELEASE> -->
<image schemaversion="6.5" name="_PRODUCT_-etcd">
<description type="system">
@ -13,7 +13,7 @@
image="docker"
derived_from="obsrepositories:/_BASEIMAGE_">
<containerconfig
name="_PRODUCT_/etcd"
name="_NAMESPACE_/etcd"
tag="%%SHORT_VERSION%%"
maintainer="SUSE Containers Team &lt;containers@suse.com&gt;">
<expose>

91
pre_checkin.sh Normal file
View File

@ -0,0 +1,91 @@
#!/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 ; }
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}" ] && abort "Missing new changelog entries"
osc vc ${changes_file} -m "${changes_log}"
}
if [ "${namespace}" == "kubic" ]; then
product='kubic'
baseimage="opensuse/tumbleweed#current"
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 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:27bc3876588c05f815a2d314c6906d0d8f5335cd0f4e070d85ae73f2b9e92c87
oid sha256:8dcb027d73094373b7e1453af531a9f709066452cfce140984d852cf2c15ee70
size 2057