Previously, TA ISO build used to push artifacts to Nexus repository in
a subdirectory that included in its path the BUILD_ID (Jenkins job ID,
e.g. [1]), but no further specifics like the artifact architecture.
Since amd64 and arm64 build jobs are completely separate, the
BUILD_ID for the two jobs are not correlated in any way, so the arm64
job (since it's newer) pushes artifacts to directories that were
previously created by the amd64 job some time ago (e.g. #109 has amd64
artifacts from August 2019 and arm64 artifacts from February 2020).
This change splits the output artifacts into arch-specific directories,
while dropping the "release-1" subdir from the path, so:
TA/images/release-1/images/{<BUILD_ID>, latest}
becomes:
TA/images/<arch>/{<BUILD_ID>,latest}
e.g. instead of [1] we will have [2] and [3].
[1] https://nexus.akraino.org/content/repositories/ \
images-snapshots/TA/release-1/images/123/
[2] https://nexus.akraino.org/content/repositories/ \
images-snapshots/TA/images/amd64/56/
[3] https://nexus.akraino.org/content/repositories/ \
images-snapshots/TA/images/arm64/45/
Change-Id: Ie3e189c1ab61bb9e395663c9882ee869929e0b76
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
set +f # Ensure filename expansion (globbing) is enabled
NEXUS_REPO=images-snapshots
-release_path=TA/release-1
+release_path=TA/images/${JOB_NAME##*-}
repo_dir="$WORKSPACE/work/nexus/$NEXUS_REPO"
-upload_dir1="$repo_dir/$release_path/images/$BUILD_ID"
-upload_dir2="$repo_dir/$release_path/images/latest"
+upload_dir1="$repo_dir/$release_path/$BUILD_ID"
+upload_dir2="$repo_dir/$release_path/latest"
nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
mkdir -p "$upload_dir1"
echo "-----> Upload ISOs to Nexus"
lftools deploy nexus "$nexus_repo_url" "$repo_dir"
+rm -rf "$repo_dir"
set +x # Disable trace since we no longer need it.
echo "ISOs location: <a href=\"$nexus_repo_url\">$nexus_repo_url</a>"