Add step for building stx-remote-cli tarball

This step was missed when we created these scripts for Debian.

Story: 2010226
Task: 48670

Change-Id: I73f90b5a018fc32b39ab6d265acfbbb7fc275415
Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
(cherry picked from commit 1c1371cc5a)
This commit is contained in:
Davlet Panech 2023-08-23 14:59:14 -04:00
parent a579327e43
commit 818cda3811
7 changed files with 165 additions and 0 deletions

View File

@ -39,6 +39,7 @@ def loadEnv() {
final props = parseProps (configText)
data.BUILD_OUTPUT_HOME_URL = props.BUILD_OUTPUT_HOME_URL
data.PUBLISH_URL = props.PUBLISH_URL
data.BUILD_REMOTE_CLI = props.BUILD_REMOTE_CLI == "true"
PROPS = data
return data.NEED_BUILD
}
@ -359,6 +360,12 @@ or with paths relative to repo root:
}
} // stages
} // stage('IMAGES')
stage('remote-cli') {
when { expression { PROPS.BUILD_REMOTE_CLI } }
steps {
runPart ("build-remote-cli")
}
}
stage('export-dir') { steps {
runPart ("build-export-dir")
} }

View File

@ -0,0 +1,55 @@
// 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'
)
booleanParam (
name: 'SHELL_XTRACE'
)
}
stages {
stage ("build-export-dir") {
steps {
sh ("${Constants.SCRIPTS_DIR}/build-remote-cli.sh")
sh ("${Constants.SCRIPTS_DIR}/archive-remote-cli.sh")
sh ("${Constants.SCRIPTS_DIR}/publish-remote-cli.sh")
}
}
}
post {
cleanup {
cleanupPartJob()
}
}
}

26
scripts/archive-remote-cli.sh Executable file
View File

@ -0,0 +1,26 @@
#!/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
src_dir="$WORKSPACE_ROOT/std/build-remote-cli"
dst_dir="$BUILD_OUTPUT_HOME/workspace/std/build-remote-cli"
notice "copying remote-cli files to $dst_dir"
if [[ -d "$dst_dir" ]] ; then
maybe_run rm -rf --one-file-system "$dst_dir"
fi
if [[ -d "$src_dir" ]] ; then
maybe_run cp -arv "$src_dir" "$dst_dir"
fi

46
scripts/build-remote-cli.sh Executable file
View File

@ -0,0 +1,46 @@
#!/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
require_job_env DOCKER_BASE_OS
require_job_env BUILD_STREAM stable
PLATFORM_IMAGE="stx-platformclients"
APPLICATION_IMAGE="stx-openstackclients"
notice "building remote CLI tarball"
# Usage: filter_image IMAGE_NAME LIST_FILE
filter_image() {
\grep --no-filename -E "^([^#].*/)*$1:" "$2" | tail -n 1
}
# Find images we built during this run
full_platform_image=
full_application_image=
if [[ -f "$WORKSPACE_ROOT/std/build-images/images-debian-stable-versioned.lst" ]] ; then
full_platform_image=$(filter_image "$PLATFORM_IMAGE" "$WORKSPACE_ROOT/std/build-images/images-debian-stable-versioned.lst")
full_application_image=$(filter_image "$APPLICATION_IMAGE" "$WORKSPACE_ROOT/std/build-images/images-debian-stable-versioned.lst")
fi
build_args=
if [[ "$full_platform_image" ]] ; then
build_args+=" --platform-image $full_platform_image"
else
warn "docker image $PLATFORM_IMAGE not built, using default"
fi
if [[ "$full_application_image" ]] ; then
build_args+=" --application-image $full_application_image"
else
warn "docker image $APPLICATION_IMAGE not built, using default"
fi
# Creates $MY_WORKSPACE/std/build-remote-cli/*.tgz
stx_docker_cmd $DRY_RUN_ARG "\$MY_REPO/build-tools/build-remote-cli.sh $build_args"

View File

@ -13,3 +13,4 @@ load_build_env
echo "BUILD_OUTPUT_HOME_URL=$BUILD_OUTPUT_HOME_URL"
echo "PUBLISH_URL=$PUBLISH_URL"
echo "BUILD_REMOTE_CLI=$BUILD_REMOTE_CLI"

27
scripts/publish-remote-cli.sh Executable file
View File

@ -0,0 +1,27 @@
#!/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
remote_cli_dir="$WORKSPACE_ROOT/std/build-remote-cli"
oidc_auth="$REPO_ROOT/cgcs-root/stx/oidc-auth-armada-app/oidc-auth-tools/oidcauthtools/oidcauthtools/oidc_auth.py"
dst_dir="$PUBLISH_DIR/outputs/remote-cli"
notice "publishing remote-cli to $dst_dir"
maybe_run mkdir -p "$dst_dir"
if [[ -d "$remote_cli_dir" ]] || $DRY_RUN ; then
maybe_run find "$remote_cli_dir" -mindepth 1 -maxdepth 1 -name '*.tgz' -exec \
cp -v -f --preserve=timestamps -t "$dst_dir" '{}' '+'
fi
if [[ -f "$oidc_auth" ]] || $DRY_RUN ; then
maybe_run cp -v -f --preserve=mode,timestamps "$oidc_auth" "$dst_dir/oidc-auth"
maybe_run chmod +x "$dst_dir/oidc-auth"
fi

View File

@ -66,6 +66,9 @@ EXTRA_EXPORT_DIR_CMD=
# $MY_WORKSPACE/export will be copied to the publish area at the end.
EXTRA_EXPORT_FILES=
# Build & publish stx-remote-cli tarball (StarlingX only)
BUILD_REMOTE_CLI=false
##################################################
# Build outputs
##################################################