Skip to content

Commit bf26a3b

Browse files
bia1708nunojsa
authored andcommitted
ci: Rename prepare_artifacts.sh
Use `prepare_artifacts_rpi.sh` only for the rpi builds. The script called `prepare_artifacts.sh` is used for the default Linux builds. Update license. Signed-off-by: bia1708 <bianca-maria.popu@analog.com>
1 parent 1d71814 commit bf26a3b

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

azure-pipelines-rpi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ stages:
9595
displayName: 'Download rsa key'
9696
inputs:
9797
secureFile: 'id_rsa'
98-
- bash: ./ci/travis/prepare_artifacts.sh swdownloads
98+
- bash: ./ci/travis/prepare_artifacts_rpi.sh swdownloads
9999
env:
100100
DEST_SERVER: $(SERVER_ADDRESS)
101101
displayName: "Push to SWDownloads"
@@ -113,7 +113,7 @@ stages:
113113
- task: DownloadPipelineArtifact@2
114114
inputs:
115115
path: $(Build.SourcesDirectory)/bin
116-
- bash: ./ci/travis/prepare_artifacts.sh artifactory
116+
- bash: ./ci/travis/prepare_artifacts_rpi.sh artifactory
117117
env:
118118
ARTIFACTORY_PATH: $(PATH)
119119
ARTIFACTORY_TOKEN: $(TOKEN)

ci/travis/prepare_artifacts_rpi.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#!/bin/bash -e
3+
4+
timestamp=$(date +%Y_%m_%d-%H_%M)
5+
GIT_SHA=$(git rev-parse --short HEAD)
6+
GIT_SHA_DATE=$(git show -s --format=%cd --date=format:'%Y-%m-%d %H:%M' ${GIT_SHA} | sed -e "s/ \|\:/-/g")
7+
8+
#prepare the structure of the folder containing artifacts
9+
artifacts_structure() {
10+
cd ${SOURCE_DIRECTORY}
11+
mkdir ${timestamp}
12+
13+
echo "git_branch=${BUILD_SOURCEBRANCHNAME}" >> ${timestamp}/rpi_git_properties.txt
14+
echo "git_sha=${GIT_SHA}" >> ${timestamp}/rpi_git_properties.txt
15+
echo "git_sha_date=${GIT_SHA_DATE}" >> ${timestamp}/rpi_git_properties.txt
16+
17+
typeBCM=( "bcm2709" "bcm2711" "bcmrpi" )
18+
typeKERNEL=( "kernel7" "kernel7l" "kernel" )
19+
for index in "${!typeBCM[@]}"; do
20+
cd adi_"${typeBCM[$index]}"_defconfig
21+
mkdir overlays modules
22+
mv ./*.dtbo ./overlays
23+
tar -xf rpi_modules.tar.gz -C modules
24+
rm rpi_modules.tar.gz
25+
mv ./zImage ./"${typeKERNEL[$index]}".img
26+
cd ../
27+
cp -r ./adi_"${typeBCM[$index]}"_defconfig/* ./${timestamp}
28+
done
29+
tar -C ${SOURCE_DIRECTORY}/${timestamp}/modules -czvf ${SOURCE_DIRECTORY}/${timestamp}/rpi_modules.tar.gz .
30+
rm -r ${SOURCE_DIRECTORY}/${timestamp}/modules
31+
}
32+
33+
#upload artifacts to Artifactory
34+
artifacts_artifactory() {
35+
artifacts_structure
36+
cd ${SOURCE_DIRECTORY}
37+
python ../ci/travis/upload_to_artifactory.py --base_path="${ARTIFACTORY_PATH}" \
38+
--server_path="linux_rpi/${BUILD_SOURCEBRANCHNAME}" --local_path="${timestamp}" \
39+
--token="${ARTIFACTORY_TOKEN}" --log_file="upload_to_artifactory.log"
40+
}
41+
42+
#archive artifacts and upload to SWDownloads
43+
artifacts_swdownloads() {
44+
artifacts_structure
45+
cd ${SOURCE_DIRECTORY}/${timestamp} || exit 1
46+
chmod 600 ${KEY_FILE}
47+
scp -2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o HostKeyAlgorithms=+ssh-dss \
48+
-i ${KEY_FILE} -r *.tar.gz ${DEST_SERVER}/${BUILD_SOURCEBRANCHNAME}
49+
md5_modules=($(md5sum rpi_modules.tar.gz| cut -d ' ' -f 1))
50+
51+
rm rpi_modules.tar.gz rpi_git_properties.txt
52+
tar -C ${PWD} -czvf rpi_latest_boot.tar.gz *
53+
md5_boot=($(md5sum rpi_latest_boot.tar.gz| cut -d ' ' -f 1))
54+
scp -2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o HostKeyAlgorithms=+ssh-dss \
55+
-i ${KEY_FILE} -r rpi_latest_boot.tar.gz ${DEST_SERVER}/${BUILD_SOURCEBRANCHNAME}
56+
57+
echo "git_branch=${BUILD_SOURCEBRANCHNAME}" >> rpi_archives_properties.txt
58+
echo "https://swdownloads.analog.com/cse/linux_rpi/${BUILD_SOURCEBRANCHNAME}/rpi_modules.tar.gz" >> rpi_archives_properties.txt
59+
echo "https://swdownloads.analog.com/cse/linux_rpi/${BUILD_SOURCEBRANCHNAME}/rpi_latest_boot.tar.gz" >> rpi_archives_properties.txt
60+
echo "checksum_modules=${md5_modules}" >> rpi_archives_properties.txt
61+
echo "checksum_boot_files=${md5_boot}" >> rpi_archives_properties.txt
62+
echo "git_sha=${GIT_SHA}" >> rpi_archives_properties.txt
63+
echo "git_sha_date=${GIT_SHA_DATE}" >> rpi_archives_properties.txt
64+
65+
scp -2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o HostKeyAlgorithms=+ssh-dss \
66+
-i ${KEY_FILE} -r rpi_archives_properties.txt ${DEST_SERVER}/${BUILD_SOURCEBRANCHNAME}
67+
}
68+
69+
artifacts_${1}

0 commit comments

Comments
 (0)