New build step: build-export-dir
New set of scripts for generating & publlishing the "export" directory. It allows one to specify a custom command to populate a directory with arbitrary files, at the end of the build. Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: Ic071f395b4c1ef5ffe8a373564074e0a399ae6b8
This commit is contained in:
parent
bdc2b96b4a
commit
9aab4bf431
|
@ -308,6 +308,9 @@ pipeline {
|
|||
}
|
||||
} // stages
|
||||
} // stage('IMAGES')
|
||||
stage('export-dir') { steps {
|
||||
runPart ("build-export-dir")
|
||||
} }
|
||||
} }// stage('X1')
|
||||
} // stages
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// vim: syn=groovy
|
||||
|
||||
//
|
||||
// Copyright (c) 2022 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
library "common@${params.JENKINS_SCRIPTS_BRANCH}"
|
||||
|
||||
setBuildDescr()
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
timestamps()
|
||||
}
|
||||
parameters {
|
||||
string (
|
||||
name: 'MASTER_JOB_NAME'
|
||||
)
|
||||
string (
|
||||
name: 'MASTER_BUILD_NUMBER'
|
||||
)
|
||||
string (
|
||||
name: 'JENKINS_SCRIPTS_BRANCH'
|
||||
)
|
||||
string (
|
||||
name: 'BUILD_HOME'
|
||||
)
|
||||
string (
|
||||
name: 'TIMESTAMP'
|
||||
)
|
||||
booleanParam (
|
||||
name: 'DRY_RUN'
|
||||
)
|
||||
}
|
||||
stages {
|
||||
stage ("build-export-dir") {
|
||||
steps {
|
||||
sh ("${Constants.SCRIPTS_DIR}/build-export-dir.sh")
|
||||
sh ("${Constants.SCRIPTS_DIR}/publish-export-dir.sh")
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
cleanupPartJob()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
source $(dirname "$0")/lib/job_utils.sh
|
||||
|
||||
load_build_env
|
||||
|
||||
declare_env EXTRA_EXPORT_DIR_CMD
|
||||
|
||||
WORKSPACE_EXPORT_DIR="$WORKSPACE_ROOT/export"
|
||||
|
||||
# create the export dir
|
||||
if ! $DRY_RUN && [[ -d "$WORKSPACE_EXPORT_DIR" ]] ; then
|
||||
rm -rfv --one-file-system "$WORKSPACE_EXPORT_DIR"
|
||||
fi
|
||||
mkdir -p "$WORKSPACE_EXPORT_DIR"
|
||||
|
||||
# if a custom export command is given, run it
|
||||
if [[ -n "$EXTRA_EXPORT_DIR_CMD" ]] ; then
|
||||
|
||||
cmd="\
|
||||
cd \$MY_WORKSPACE/export && {
|
||||
$EXTRA_EXPORT_DIR_CMD
|
||||
}
|
||||
"
|
||||
|
||||
stx_docker_cmd $DRY_RUN_ARG "$cmd"
|
||||
|
||||
fi
|
||||
|
||||
# print it
|
||||
notice "export dir content follows"
|
||||
ls -alR "$WORKSPACE_EXPORT_DIR"
|
||||
|
|
@ -91,3 +91,11 @@ same_path() {
|
|||
b="$(readlink -f "$2")" || exit 1
|
||||
[[ "$a" == "$b" ]]
|
||||
}
|
||||
|
||||
dir_is_empty() {
|
||||
if [[ -d "$1" ]] ; then
|
||||
local any_child
|
||||
any_child="$(find "$1" -mindepth 1 -maxdepth 1 -print -quit)" || return 0
|
||||
[[ -z "$any_child" ]]
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
source $(dirname "$0")/lib/job_utils.sh
|
||||
|
||||
load_build_env
|
||||
|
||||
$DRY_RUN && bail "DRY_RUN not supported, bailing out" || :
|
||||
|
||||
src_dir="$WORKSPACE_ROOT/export"
|
||||
dst_dir="$PUBLISH_DIR/export"
|
||||
|
||||
rm -rfv --one-file-system "$dst_dir"
|
||||
! dir_is_empty "$src_dir" || exit 0
|
||||
|
||||
notice "copying export dir $dst_dir"
|
||||
cp -avr "$src_dir" "$dst_dir"
|
||||
|
|
@ -42,6 +42,12 @@ SIGN_ISO=false # If false, don't signe the ISO
|
|||
SIGNING_SERVER="some.host.org"
|
||||
SIGNING_USER="some_user_id"
|
||||
|
||||
# Run this command inside the build container at the end of the build
|
||||
# Current directory will be set to $MY_WORKSPACE/export.
|
||||
# This command must leave any additional files to be published in that
|
||||
# directory.
|
||||
EXTRA_EXPORT_DIR_CMD=
|
||||
|
||||
##################################################
|
||||
# Build outputs
|
||||
##################################################
|
||||
|
|
Loading…
Reference in New Issue