Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Jul 24, 2024
1 parent cf86478 commit 41dff44
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions testing/cloud_layouts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -445,21 +445,26 @@ function run-test() {
function test_requirements() {
>&2 echo "Start check requirements ..."
if [ ! -f /deckhouse/release.yaml ]; then
>&2 echo $(pwd)
pwd
ls -lh
>&2 echo "File /deckhouse/release.yaml not found"
return 1
fi
releaseFile=$(< /deckhouse/release.yaml)
export releaseFile

testScript=$(cat <<"END_SCRIPT"
>&2 echo "Variable initialized ..."
>&2 echo "Run script ... "

if $ssh_command -i "$ssh_private_key_path" $ssh_bastion "$ssh_user@$master_ip" sudo su -c /bin/bash <<<"END_SCRIPT"; then
export PATH="/opt/deckhouse/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export LANG=C
set -Eeuo pipefail

if [ -z ${releaseFile+x} ]; then >&2 echo "releaseFile variable is unset"; return 1; fi

wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_386 -O /usr/bin/yq &&\
chmod +x /usr/bin/yq
chmod +x /usr/bin/yq

command -v yq >/dev/null 2>&1 || return 1

Expand All @@ -468,34 +473,31 @@ echo "$releaseFile" > /tmp/releaseFile.yaml
echo 'apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
name: deckhouse
name: deckhouse
spec:
settings:
releaseChannel: Stable
update:
mode: Auto' | kubectl apply -f -
settings:
releaseChannel: Stable
update:
mode: Auto' | kubectl apply -f -

echo 'apiVersion: deckhouse.io/v1alpha1
approved: false
kind: DeckhouseRelease
metadata:
annotations:
dryrun: "true"
name: v1.96.3
annotations:
dryrun: "true"
name: v1.96.3
spec:
version: v1.96.3
requirements:' | yq '. | load(\"/tmp/releaseFile.yaml\") as \$d1 | .spec.requirements=\$d1.requirements' | kubectl apply -f -
version: v1.96.3
requirements:' | yq '. | load(\"/tmp/releaseFile.yaml\") as \$d1 | .spec.requirements=\$d1.requirements' | kubectl apply -f -

rm /tmp/releaseFile.yaml

>&2 echo "Release status: $(kubectl get deckhousereleases.deckhouse.io -o 'jsonpath={..status.phase}')"

[[ "$(kubectl get deckhousereleases.deckhouse.io -o 'jsonpath={..status.phase}')" == "Deployed" ]]
END_SCRIPT
)

if $ssh_command -i "$ssh_private_key_path" $ssh_bastion "$ssh_user@$master_ip" sudo su -c /bin/bash <<<"${testScript}"; then
return 0
return 0
fi

write_deckhouse_logs
Expand Down

0 comments on commit 41dff44

Please sign in to comment.