3 Commits

Author SHA1 Message Date
253c77489b Fixes changelog et version computation 2020-09-03 08:45:00 +02:00
9a46f34f73 SSH for Jenkins 2020-09-02 15:49:20 +02:00
5a4c17a959 Add script for using ssh with options 2020-09-02 15:10:50 +02:00
4 changed files with 31 additions and 9 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
cd src
if [ -f debian/changelog ] || [ ! -d .git ]; then
tamarin_info "Not a Git repository or Debian changelog already exists !"
@ -13,7 +12,7 @@ pkg_tags="$(git for-each-ref --format '%(refname)' refs/tags | tac)"
# Set starting commit
ceiling_commit=$(git describe --match "build/*" --abbrev=0 2>/dev/null)
if [ -n "ceiling_commit" ]
if [ -z "ceiling_commit" ]
then
ceiling_commit="HEAD"
fi
@ -55,7 +54,7 @@ function get_short_hash {
function get_previous_pkg_tag {
# Return previous pkg/* tag or current tag if no previous pkg/* exists.
commit="$1"
echo "$(git describe --abbrev=0 --always --match='pkg/*' $commit)"
echo "$(git describe --abbrev=0 --match='pkg/*' $commit 2>/dev/null)"
}
function parse_tag {
@ -103,6 +102,18 @@ function get_package_version_from_tag {
echo "$package"
}
function get_distribution_from_tag {
# tag pkg like pkg/<level>/<distrib>/<version>
# <distrib> may be composed
set -x
tag="$1"
distribution="${tag#pkg/*/}"
distribution="${distribution%/*}"
distribution="${distribution/\//-}"
echo $distribution
set +x
}
function get_previous_release_tag {
# Return previous pkg/* tag or current tag if no previous pkg/* exists.
commit="$1"
@ -113,7 +124,7 @@ function on_pkg_tag {
# Return 1 if current commit is tagged with pkg/* tag.
commit="$1"
nearest_old_pkg_tag="$(get_previous_pkg_tag $commit)"
if [ "$(get_hash ${commit})" = "$(get_hash ${nearest_old_pkg_tag})" ]
if [ -n "${nearest_old_pkg_tag}" ] && [ "$(get_hash ${commit})" = "$(get_hash ${nearest_old_pkg_tag})" ]
then
return 0
else
@ -159,13 +170,13 @@ function date_from_commit {
function packager_from_commit {
# Return Name <mail> id format, suitable for changelog entry signature
commit="$1"
if [ "${commit}" = "HEAD" ]
if on_pkg_tag "${commit}"
then
maintainer="$(git log -n1 --format='%cn <%ce>')"
else
maintainer_commit="$(get_previous_pkg_tag $commit)"
maintainer="$(git tag -l --format='%(creator)' ${maintainer_commit})"
maintainer="${maintainer%>*}>"
else
maintainer="$(git log -n1 --format='%cn <%ce>')"
fi
maintainer=$(tamarin_db get maintainer "${maintainer}")
echo "$maintainer"
@ -190,6 +201,7 @@ function next_version {
fi
elif [ -n "$previous_release" ]
then
distance_from_release=$(get_distance_from_tag "$previous_release" "$commit")
distance=$distance_from_release
version="$(get_upstream_version_from_tag $previous_release)-1"
elif [ -n "$previous_pkg" ]
@ -219,11 +231,13 @@ function gen_changelog_entry {
if on_pkg_tag $ceiling_commit
then
version="$(get_upstream_version_from_tag $ceiling_commit)-$(get_package_version_from_tag $ceiling_commit)"
distribution="$(get_distribution_from_tag $ceiling_commit)"
else
tamarin_info "current commit $ceiling_commit"
version=$(next_version $ceiling_commit)
distribution="UNRELEASED"
fi
#current_release="$(git describe --abbrev=0 --always --match='release/*' $ceiling_commit)"
tamarin_info "Création de lentrée de changelog entre ${ceiling_commit} et ${floor_commit}"

View File

@ -18,6 +18,9 @@ def get_hooks_dir():
def get_lib_dir():
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../lib")
def get_utils_dir():
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../utils")
def load_profile(profile_name, debug=False):
profile_filename = profile_name+".conf"
for profile_file in get_available_profiles():

View File

@ -80,6 +80,8 @@ if __name__ == "__main__":
pid = os.getpid()
build_workspace = tamarin.get_workspace_subdir('tmp/build_{:d}'.format(pid))
shutil.copytree(tamarin.get_utils_dir(), os.path.join(build_workspace, 'utils'))
base_image = args.base if args.base != '' else profile['profile']['default_image']
image_tag = build_image(build_workspace, base_image, args.profile, profile, debug=args.debug, rebuild=args.rebuild)
@ -107,7 +109,8 @@ if __name__ == "__main__":
"-v", "{:s}:/dist".format(output_dir),
"-v", "{:s}:/tamarin/hooks:ro".format(tamarin.get_hooks_dir()),
"-v", "{:s}:/tamarin/lib:ro".format(tamarin.get_lib_dir()),
"-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir())
"-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir()),
"-v", "{:s}:/tamarin/utils:ro".format(tamarin.get_utils_dir())
]
# Use environment proxy if defined

2
utils/sshForJenkins.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"