Commits (6)
......@@ -75,7 +75,7 @@ To start using the pvdeps-ci template, just import it in your project:
```
include:
remote: https://gitlab.com/pantacor/ci/device-ci/raw/master/yml/pvdeps-ci.yml
local: /device-ci/yml/pvdeps-ci.yml
```
### Set up gitlab CI variables
......@@ -103,7 +103,7 @@ To start using the pvdeps-ci template, just import it in your project:
```
include:
remote: https://gitlab.com/pantacor/ci/device-ci/raw/master/yml/bsp-ci.yml
local: /device-ci/yml/bsp-ci.yml
```
To configure the targets for the build jobs, you just need to configure these parameters for each target:
......
......@@ -53,7 +53,7 @@ case "$op" in
# write ci include
cat > .gitlab-ci.yml << EOF
include:
remote: https://gitlab.com/pantacor/ci/device-ci/raw/master/yml/${yml_template}
local: /device-ci/yml/${yml_template}
EOF
......
include:
remote: https://gitlab.com/pantacor/ci/device-ci/-/raw/master/yml/common-ci.yml
local: /device-ci/yml/common-ci.yml
stages:
- push
......
......@@ -32,12 +32,14 @@ variables:
script:
# check device status from pantahub is DONE or NEW (for non physical devices)
- TOKEN=`http --ignore-stdin POST https://api.pantahub.com/auth/login username=$PHUSER password=$PHPASS | jq -r .token`
- for d in $PH_TARGET_DEVICE; do
- for i in {0..3}; do
device_ps=`pvr -a $TOKEN device ps | grep $d`;
device_ps_array=($device_ps);
device_status=${device_ps_array[3]};
if [ "$device_status" != "DONE" ] && [ "$device_status" != "NEW" ]; then echo "Device post failed"; exit 1; fi;
if [ "$device_status" == "DONE" ] || [ "$device_status" == "NEW" ]; exit 0; fi;
sleep 60;
done
- exit 1
.check-status-pushed:
extends: .check-status
......
include:
remote: https://gitlab.com/pantacor/ci/device-ci/-/raw/master/yml/common-ci.yml
local: /device-ci/yml/common-ci.yml
stages:
- build
......
include:
remote: https://gitlab.com/pantacor/ci/device-ci/-/raw/master/yml/common-ci.yml
local: /device-ci/yml/common-ci.yml
stages:
- post
......@@ -130,7 +130,7 @@ push-metadata:
- test "$DEPLOY" = "no" && echo "Deploy will not be done"
- test "$DEPLOY" = "no" || POST_RESPONSE=$(pvr -a $TOKEN post -m "auto commit for $CI_COMMIT_TAG from job $CI_PIPELINE_ID" $PH_BASE_URL/$PHUSER/$PH_STABLE_DEVICE | grep Revision)
- test "$DEPLOY" = "no" || REFERENCE_REVISION=$(echo $POST_RESPONSE | sed -e 's/.*Revision \(.*\) (.*/\1/')
- test "$DEPLOY" = "no" || REFERENCE_DEVICE=$(echo $POST_RESPONSE | sed -e 's/.* //g')
- test "$DEPLOY" = "no" || REFERENCE_DEVICE=$PH_STABLE_DEVICE
- cd ..
- "echo \"Reference device: $PH_BASE_URL/$PHUSER/$REFERENCE_DEVICE/$REFERENCE_REVISION\" > $CI_JOB_NAME.meta"
# exit if aws was not set
......@@ -145,9 +145,10 @@ push-metadata:
- mkdir pipeline
- mv out/$PLATFORM/*.img pipeline/$PH_STABLE_DEVICE.img
- bash ../device-ci/tools/split.sh pipeline/$PH_STABLE_DEVICE.img
- IMG_SHA=($(sha256sum pipeline/$PH_STABLE_DEVICE.img))
- xz pipeline/$PH_STABLE_DEVICE.img
- AWS_DOWNLOAD_URL="https://$AWS_BUCKET.s3.amazonaws.com/$AWS_PROJECT_PATH/$AWS_TAG_PIPE_PATH/$PH_STABLE_DEVICE.img.xz"
- "jq -n --arg pl \"$PLATFORM\" --arg ta \"$TARGET\" --arg di \"$REFERENCE_DEVICE\" --arg pr \"$REFERENCE_REVISION\" --arg au \"$AWS_DOWNLOAD_URL\" '{platform: $pl, target: $ta, installer: \"no\", deviceid: $di, pantahubrevision: $pr, aws_url: $au, aws_installer_url: \"\"}' > pipeline/$PH_STABLE_DEVICE.json"
- "jq -n --arg pl \"$PLATFORM\" --arg ta \"$TARGET\" --arg di \"$REFERENCE_DEVICE\" --arg pr \"$REFERENCE_REVISION\" --arg au \"$AWS_DOWNLOAD_URL\" --arg is \"$IMG_SHA\" '{platform: $pl, target: $ta, installer: \"no\", deviceid: $di, pantahubrevision: $pr, aws_url: $au, aws_url_sha: $is, aws_installer_url: \"\",aws_installer_url_sha: \"\"}' > pipeline/$PH_STABLE_DEVICE.json"
# upload image to aws
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
......@@ -161,10 +162,12 @@ push-metadata:
# prepare img and metadata
- mv out/$PLATFORM/*installer*.img pipeline/$PH_STABLE_DEVICE-installer.img
- bash ../device-ci/tools/split.sh pipeline/$PH_STABLE_DEVICE-installer.img
- IMG_SHA=($(sha256sum pipeline/$PH_STABLE_DEVICE-installer.img))
- xz pipeline/$PH_STABLE_DEVICE-installer.img
- jq '.installer = "yes"' pipeline/$PH_STABLE_DEVICE.json > tmp && mv tmp pipeline/$PH_STABLE_DEVICE.json
- AWS_DOWNLOAD_URL="https://$AWS_BUCKET.s3.amazonaws.com/$AWS_PROJECT_PATH/$AWS_TAG_PIPE_PATH/$PH_STABLE_DEVICE-installer.img.xz"
- jq --arg au "$AWS_DOWNLOAD_URL" '.aws_installer_url = $au' pipeline/$PH_STABLE_DEVICE.json > tmp && mv tmp pipeline/$PH_STABLE_DEVICE.json
- jq --arg is "$IMG_SHA" '.aws_installer_url_sha = $is' pipeline/$PH_STABLE_DEVICE.json > tmp && mv tmp pipeline/$PH_STABLE_DEVICE.json
# upload image to aws
- aws s3 cp --recursive pipeline/ s3://$AWS_BUCKET_PATH/$AWS_TAG_PIPE_PATH/
only:
......@@ -186,7 +189,7 @@ deploy-stable:
- cd work
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws s3 cp s3://$AWS_BUCKET_PATH/stable.json stable.json
- aws s3 cp s3://$AWS_BUCKET_PATH/stable.json stable.json || echo "{\"release-candidate\":[],\"stable\":[]}" > stable.json
# prepare pipeline metadata
- GIT_DESCRIBE=$(git describe --tags --always)
- COMMIT_TIME=$(git show -s --format=%ci $CI_COMMIT_SHA)
......