Skip to content

Commit

Permalink
Add flags to separate generate_release_script parts (#1066)
Browse files Browse the repository at this point in the history
These flags will enable script invocations of the source and binary jobs
separately, supporting a build process more like the Jenkins buildfarm.
  • Loading branch information
cottsay authored Nov 1, 2024
1 parent 63548fe commit 12c18c3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
53 changes: 31 additions & 22 deletions ros_buildfarm/scripts/release/generate_release_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ def main(argv=sys.argv[1:]):
add_argument_os_name(parser)
add_argument_os_code_name(parser)
add_argument_arch(parser)
parser.add_argument(
'--skip-binary',
action='store_true',
help='Skip the entire binary package build process')
parser.add_argument(
'--skip-install',
action='store_true',
help='Skip trying to install binarydeb')
parser.add_argument(
'--skip-source',
action='store_true',
help='Skip the entire source package build process')
args = parser.parse_args(argv)

package_format = package_format_mapping[args.os_name]
Expand Down Expand Up @@ -103,28 +111,29 @@ def beforeInclude(self, *args, **kwargs):
args.package_name, args.os_name, args.os_code_name, args.arch)

separator_index = hook.scripts.index('--')
source_scripts = hook.scripts[:separator_index]
binary_scripts = hook.scripts[separator_index + 1:]

# inject additional argument to skip fetching sourcedeb from repo
script_name = '/run_binary%s_job.py ' % deb_or_pkg
additional_argument = '--skip-download-sourcepkg '
for i, script in enumerate(binary_scripts):
offset = script.find(script_name)
if offset != -1:
offset += len(script_name)
script = script[:offset] + additional_argument + script[offset:]
binary_scripts[i] = script
break

# remove rm command for sourcedeb location
rm_command = 'rm -fr $WORKSPACE/binary%s' % deb_or_pkg
for i, script in enumerate(binary_scripts):
offset = script.find(rm_command)
if offset != -1:
script = script[:offset] + script[offset + len(rm_command):]
binary_scripts[i] = script
break
source_scripts = [] if args.skip_source else hook.scripts[:separator_index]
binary_scripts = [] if args.skip_binary else hook.scripts[separator_index + 1:]

if source_scripts:
# inject additional argument to skip fetching sourcedeb from repo
script_name = '/run_binary%s_job.py ' % deb_or_pkg
additional_argument = '--skip-download-sourcepkg '
for i, script in enumerate(binary_scripts):
offset = script.find(script_name)
if offset != -1:
offset += len(script_name)
script = script[:offset] + additional_argument + script[offset:]
binary_scripts[i] = script
break

# remove rm command for sourcedeb location
rm_command = 'rm -fr $WORKSPACE/binary%s' % deb_or_pkg
for i, script in enumerate(binary_scripts):
offset = script.find(rm_command)
if offset != -1:
script = script[:offset] + script[offset + len(rm_command):]
binary_scripts[i] = script
break

if args.skip_install:
# remove install step
Expand Down
2 changes: 2 additions & 0 deletions ros_buildfarm/templates/release/release_script.sh.em
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ echo "Using workspace for binary: $WORKSPACE"
mkdir -p $WORKSPACE
cd $WORKSPACE

@[if source_scripts]@
echo ""
echo "Get artifacts from source job"
@[if package_format == 'deb']@
Expand All @@ -56,6 +57,7 @@ mkdir -p $WORKSPACE/binarypkg/source
@[else]@
@{assert False, "Unsupported packaging format '%s'" % package_format}@
@[end if]@
@[end if]@

@(TEMPLATE(
'devel/devel_script_build.sh.em',
Expand Down

0 comments on commit 12c18c3

Please sign in to comment.