mirror of
https://git.icinga.com/packaging/rpm-icinga-php-thirdparty.git
synced 2025-07-15 18:14:27 +02:00
Merge branch 'fix/snapshots' into 'master'
Snapshots: Look for correct branch See merge request packaging/rpm-icinga-php-thirdparty!7
This commit is contained in:
commit
18bbbc1ec0
@ -6,7 +6,7 @@ stages:
|
|||||||
variables:
|
variables:
|
||||||
DOCKER_IMAGE_BASE: registry.icinga.com/build-docker
|
DOCKER_IMAGE_BASE: registry.icinga.com/build-docker
|
||||||
ICINGA_BUILD_TYPE: snapshot
|
ICINGA_BUILD_TYPE: snapshot
|
||||||
#ICINGA_BUILD_UPSTREAM_BRANCH:
|
ICINGA_BUILD_UPSTREAM_BRANCH: snapshot/nightly
|
||||||
|
|
||||||
.build: &build
|
.build: &build
|
||||||
stage: build
|
stage: build
|
||||||
|
87
get_snapshot
Executable file
87
get_snapshot
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2017 Icinga Development Team <info@icinga.com>
|
||||||
|
# Licensed as GPL-2.0+
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
while getopts ":p:U:b:" opt
|
||||||
|
do
|
||||||
|
case "$opt" in
|
||||||
|
p)
|
||||||
|
PROJECT="$OPTARG"
|
||||||
|
;;
|
||||||
|
U)
|
||||||
|
UPSTREAM_GIT_URL="$OPTARG"
|
||||||
|
;;
|
||||||
|
b)
|
||||||
|
UPSTREAM_GIT_BRANCH="$OPTARG"
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Unknown argument: $OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
: ${PROJECT:=icinga-php-thirdparty}
|
||||||
|
: ${UPSTREAM_GIT_URL:=https://github.com/Icinga/$PROJECT.git}
|
||||||
|
: ${UPSTREAM_GIT_BRANCH:=snapshot/nightly}
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [ -z "$UPSTREAM_GIT_NOREPO" ]; then
|
||||||
|
if [ -d "${PROJECT}.git/" ]; then
|
||||||
|
cd "${PROJECT}.git"
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
echo "This is not a GIT repository: $(pwd)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
||||||
|
if [ "$(git config remote.origin.url)" != "${UPSTREAM_GIT_URL}" ]; then
|
||||||
|
git remote set-url origin "${UPSTREAM_GIT_URL}"
|
||||||
|
fi
|
||||||
|
git fetch origin -p
|
||||||
|
git checkout -f "${UPSTREAM_GIT_BRANCH}"
|
||||||
|
git reset --hard "origin/${UPSTREAM_GIT_BRANCH}"
|
||||||
|
fi
|
||||||
|
git clean -fdx
|
||||||
|
elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
|
||||||
|
git clone -b "${UPSTREAM_GIT_BRANCH}" "${UPSTREAM_GIT_URL}" "${PROJECT}.git/"
|
||||||
|
cd "${PROJECT}.git"
|
||||||
|
else
|
||||||
|
echo "Missing '${PROJECT}.git' directory!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
git_version=$(git describe --tags "${UPSTREAM_GIT_BRANCH}")
|
||||||
|
git_commit=$(git rev-parse "${UPSTREAM_GIT_BRANCH}")
|
||||||
|
package_version=$(echo "$git_version" | sed -e 's/^v//' -e 's/-/./g')
|
||||||
|
prefix="${PROJECT}-${package_version}"
|
||||||
|
tarball="${prefix}.orig.tar"
|
||||||
|
|
||||||
|
git archive --format=tar --prefix="${prefix}/" -o "../${tarball}" "${UPSTREAM_GIT_BRANCH}"
|
||||||
|
|
||||||
|
cd ../
|
||||||
|
|
||||||
|
# create files with the properly set versions for snapshot
|
||||||
|
rm -rf "${prefix:?}/"
|
||||||
|
|
||||||
|
mkdir -p "${prefix:?}/"
|
||||||
|
echo "${package_version}" > "${prefix:?}/VERSION"
|
||||||
|
|
||||||
|
# add to tarball and remove tmpdir
|
||||||
|
tar --append -f "${tarball}" "${prefix}"/
|
||||||
|
rm -rf "${prefix:?}/"
|
||||||
|
|
||||||
|
# pack tarball
|
||||||
|
gzip -vf9 "${tarball}"
|
||||||
|
sha256sum "${tarball}.gz"
|
||||||
|
|
||||||
|
# store package version for build scripts
|
||||||
|
printf '%s\t%s\t%s\t%s' \
|
||||||
|
"${package_version}" \
|
||||||
|
"${git_commit}" \
|
||||||
|
"$(basename "${tarball}.gz")" \
|
||||||
|
"${UPSTREAM_GIT_BRANCH}" \
|
||||||
|
> "${PROJECT}.version"
|
Loading…
x
Reference in New Issue
Block a user