github ci: push parameter metadata to s3

This commit is contained in:
Beat Küng
2021-03-24 10:08:41 -04:00
committed by Daniel Agar
parent c3985709e4
commit f528c5d206
6 changed files with 235 additions and 28 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
# Script to extract PX4_GIT_TAG_OR_BRANCH_NAME to be used by CI
build_dir="$1"
if [ ! -d "$build_dir" ]; then
echo "usage: $0 <build directory>"
exit -1
fi
version_file="$build_dir/src/lib/version/build_git_version.h"
if [ ! -f "$version_file" ]; then
echo "Version file not found. Did you run the target 'ver_gen'?"
exit -1
fi
sed -n 's/.*PX4_GIT_TAG_OR_BRANCH_NAME\s*"\(.*\)".*/version=\1/p' "$version_file"
+30 -21
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
@@ -37,8 +36,17 @@ header = """
# PX4
git_tag = subprocess.check_output('git describe --exclude ext/* --always --tags --dirty'.split(),
git_describe_cmd = 'git describe --exclude ext/* --always --tags --dirty'
git_tag = subprocess.check_output(git_describe_cmd.split(),
stderr=subprocess.STDOUT).decode('utf-8').strip()
try:
# get the tag if we're on a tagged commit
tag_or_branch = subprocess.check_output((git_describe_cmd+' --exact-match').split(),
stderr=subprocess.STDOUT).decode('utf-8').strip()
except:
tag_or_branch = None
if validate:
if verbose:
print("testing git tag: "+git_tag)
@@ -92,18 +100,23 @@ try:
except:
oem_tag = ''
header += """
#define PX4_GIT_VERSION_STR "{git_version}"
if tag_or_branch is None:
# replace / so it can be used as directory name
tag_or_branch = git_branch_name.replace('/', '-')
# either a release or master branch (used for metadata)
if not tag_or_branch.startswith('release-'):
tag_or_branch = 'master'
header += f"""
#define PX4_GIT_VERSION_STR "{git_version}"
#define PX4_GIT_VERSION_BINARY 0x{git_version_short}
#define PX4_GIT_TAG_STR "{git_tag}"
#define PX4_GIT_BRANCH_NAME "{git_branch_name}"
#define PX4_GIT_TAG_STR "{git_tag}"
#define PX4_GIT_BRANCH_NAME "{git_branch_name}"
#define PX4_GIT_OEM_VERSION_STR "{oem_tag}"
""".format(git_tag=git_tag,
git_version=git_version,
git_version_short=git_version_short,
git_branch_name=git_branch_name,
oem_tag=oem_tag)
#define PX4_GIT_TAG_OR_BRANCH_NAME "{tag_or_branch}" // special variable: git tag, release or master branch
"""
# ECL
@@ -115,11 +128,10 @@ if (os.path.exists('src/lib/ecl/.git')):
cwd='src/lib/ecl', stderr=subprocess.STDOUT).decode('utf-8').strip()
ecl_git_version_short = ecl_git_version[0:16]
header += """
header += f"""
#define ECL_LIB_GIT_VERSION_STR "{ecl_git_version}"
#define ECL_LIB_GIT_VERSION_BINARY 0x{ecl_git_version_short}
""".format(ecl_git_version=ecl_git_version,
ecl_git_version_short=ecl_git_version_short)
"""
# Mavlink
@@ -128,11 +140,10 @@ if (os.path.exists('mavlink/include/mavlink/v2.0/.git')):
cwd='mavlink/include/mavlink/v2.0', stderr=subprocess.STDOUT).decode('utf-8').strip()
mavlink_git_version_short = mavlink_git_version[0:16]
header += """
header += f"""
#define MAVLINK_LIB_GIT_VERSION_STR "{mavlink_git_version}"
#define MAVLINK_LIB_GIT_VERSION_BINARY 0x{mavlink_git_version_short}
""".format(mavlink_git_version=mavlink_git_version,
mavlink_git_version_short=mavlink_git_version_short)
"""
# NuttX
@@ -144,13 +155,11 @@ if (os.path.exists('platforms/nuttx/NuttX/nuttx/.git')):
cwd='platforms/nuttx/NuttX/nuttx', stderr=subprocess.STDOUT).decode('utf-8').strip()
nuttx_git_version_short = nuttx_git_version[0:16]
header += """
header += f"""
#define NUTTX_GIT_VERSION_STR "{nuttx_git_version}"
#define NUTTX_GIT_VERSION_BINARY 0x{nuttx_git_version_short}
#define NUTTX_GIT_TAG_STR "{nuttx_git_tag}"
""".format(nuttx_git_version=nuttx_git_version,
nuttx_git_version_short=nuttx_git_version_short,
nuttx_git_tag=nuttx_git_tag)
"""
if old_header != header: