chore: script removal and cleanup (#388)

This commit is contained in:
Bert Kleewein 2023-06-12 15:22:49 -07:00 коммит произвёл GitHub
Родитель 20ea717b4f
Коммит 39214d679d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
21 изменённых файлов: 96 добавлений и 600 удалений

Просмотреть файл

@ -164,17 +164,6 @@ def set_command_args(parser):
"--variant", type=str, help="sdk variant", choices=utilities.all_variants
)
lkg_parser = target_subparsers.add_parser("lkg", help="deploy based on vsts LKG")
lkg_parser.add_argument(
"--language",
type=str,
help="sdk language",
required=True,
choices=utilities.all_languages,
)
lkg_parser.add_argument(
"--variant", type=str, help="sdk variant", choices=utilities.all_variants
)
def handle_command_args(args):
@ -182,12 +171,6 @@ def handle_command_args(args):
if args.target == "image":
image = args.image_name
print("Using new image: {}".format(image))
elif args.target == "lkg":
if args.variant:
image = "{}-e2e-v3:lkg-{}".format(args.language, args.variant)
else:
image = "{}-e2e-v3:lkg".format(args.language)
print("Using LKG image: {}".format(image))
elif args.target == "vsts":
if args.variant:
image = "{}-e2e-v3:vsts-{}-{}".format(

Просмотреть файл

@ -1,108 +0,0 @@
#!/usr/bin/env pwsh
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
#
# filename: Tag-DockerImage.ps1
# author: v-greach@microsoft.com
# created: 03/11/2019
# Rev: 03/11/2019 E
Param
(
[Parameter(Position=0)]
[string]$Repository,
[Parameter(Position=1)]
[string]$TAG_OLD,
[Parameter(Position=2)]
[string]$TAG_NEW
)
$EnvRepo = $Env:IOTHUB_E2E_REPO_ADDRESS
$UserName = $Env:IOTHUB_E2E_REPO_USER
$Password = $Env:IOTHUB_E2E_REPO_PASSWORD
$Registry = "https://" + $EnvRepo
if($TAG_OLD -eq "--ListAll") {
$TAG_NEW = " "
}
if($Repository -eq "" -or $TAG_OLD -eq "" -or $TAG_NEW -eq "" -or
$EvnRepo -eq "" -or $UserName -eq "" -or
$Password -eq "") {
Write-Output "ERROR- Missing parameter or environment variable"
Write-Output "ENV must have IOTHUB_E2E_REPO_ADDRESS, IOTHUB_E2E_REPO_USER, IOTHUB_E2E_REPO_PASSWORD"
Write-Output "Usage:"
Write-Output "Tag-DockerImage.ps1 <repository_Name> <current_tag_name> <tag_to_add_to_image"
Write-Output "Tag-DockerImage.ps1 <repository_Name> <tag_name_to_verify> --VerifyTagExists"
Write-Output "Tag-DockerImage.ps1 <repository_Name> --ListAll"
exit 1
}
$ContentType = 'application/vnd.docker.distribution.manifest.v2+json'
if($TAG_OLD -eq "--ListAll") {
$TAG_URI = "$Registry/v2/$Repository/tags/list"
}
else {
$TAG_URI = "$Registry/v2/$Repository/manifests/$TAG_OLD"
}
$Params = @{
UseBasicParsing = $true
Method = 'Get'
Uri = "$TAG_URI"
Headers = @{
Accept = $ContentType
}
}
$pair = "$($UserName):$($Password)"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($Pair))
$Params.Headers.Add('Authorization', "Basic $encodedCredentials")
try {
$Response = Invoke-WebRequest @Params
if($TAG_OLD -eq "--ListAll") {
$tag_json = ConvertFrom-Json $Response.Content
foreach($tag in $tag_json.tags) {
Write-Output $tag
}
exit 0
}else{
$Manifest = ConvertFrom-ByteArray -Data $Response.Content -Encoding ASCII
}
}
catch {
Write-Output $_
Write-Output "ERROR: Getting Tag [$TAG_OLD] in [$Repository]"
exit 1
}
if($TAG_NEW -eq "--VerifyTagExists") {
Write-Output "Tag [$TAG_OLD] exits in [$Repository]"
exit 0
}
$Params = @{
UseBasicParsing = $true
Method = 'Put'
Uri = "$Registry/v2/$Repository/manifests/$TAG_NEW"
Headers = @{
'Content-Type' = $ContentType
}
Body = $Manifest
}
$Params.Headers.Add('Authorization', "Basic $encodedCredentials")
try {
$Response = Invoke-WebRequest @Params
$RespCode = $Response.StatusCode
if($RespCode -eq 201) {
Write-Output "SUCCESS: Created new tag:$TAG_NEW from:$TAG_OLD in:$Repository"
} else {
Write-Output "FAILED: Status:$RespCode Creating new tag:$TAG_NEW from:$TAG_OLD in:$Repository"
}
}
catch {
Write-Output $Error[0]
}

Просмотреть файл

@ -1,55 +0,0 @@
# Copyright (c) Microsoft. All rights teserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
language=$1
case "$language" in
node | c | csharp | java | pythonv2)
echo "running tests for for $language"
;;
*)
echo "Usage: $0 [node | c | csharp | java | pythonv2]"
exit 1
;;
esac
module=testMod
status=$(docker inspect --format='{{.State.Status}}' $module)
if [ $? -ne 0 ] || [ $status != "running" ]; then
echo $module is not running
exit 1
fi
dest=$(pwd)/${language}_source
mkdir $dest
echo "Copying source and ssh key for $language into $dest"
docker cp $module:/sdk $dest/sdk
[ $? -eq 0 ] || { echo "failed copying sdk from container"; exit 1; }
docker cp $module:/wrapper $dest/wrapper
[ $? -eq 0 ] || { echo "failed copying wrapper from container"; exit 1; }
echo Source for $module is in $dest
port=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}' $module)
if [ $? -ne 0 ]; then
echo "SSH port 22 is not exposed from $module"
else
docker cp $module:/root/.ssh/remote-debug $dest/remote-debug-ssh-key
[ $? -eq 0 ] || { echo "failed copying ssh key from container"; exit 1; }
echo ""
echo "SSH key for $module is in $dest/remote-debug-ssh-key"
echo "$module has ssh exposed on port $port"
echo ""
echo "to connect to $module, call:"
echo "ssh -i ${dest}/remote-debug-ssh-key root@$(hostname) -p $port"
echo ""
echo "Before using SSH, connect with docker exec:"
echo "docker exec -it $module /bin/bash"
echo "Then restart the sshd service:"
echo "service ssh restart"
fi

Просмотреть файл

@ -0,0 +1,23 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
set -o pipefail
echo "Checking for azure CLI"
which az
if [ $? -eq 0 ]; then
echo "Azure CLI installed"
else
echo "Installing Azure CLI"
curl -L https://aka.ms/InstallAzureCli | bash
[ $? -eq 0 ] || { echo "install-microsoft-apt-repo failed"; exit 1; }
fi
az --version
[ $? -eq 0 ] || { echo "az --version failed"; exit 1; }
az extension add --name azure-iot
[ $? -eq 0 ] || { echo "az extension add failed"; exit 1; }

Просмотреть файл

@ -3,8 +3,8 @@
script_dir=$(cd "$(dirname "$0")" && pwd)
$script_dir/setup-microsoft-apt-repo.sh
[ $? -eq 0 ] || { echo "setup-microsoft-apt-repo failed"; exit 1; }
$script_dir/install-microsoft-apt-repo.sh
[ $? -eq 0 ] || { echo "install-microsoft-apt-repo failed"; exit 1; }
# install iotedge
sudo apt-get install -y aziot-edge

Просмотреть файл

@ -2,13 +2,12 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
source "$script_dir/../colorecho.sh"
source /etc/os-release
colorecho $_yellow "Checking for Microsoft APT repo registration"
if [ -f /etc/apt/sources.list.d/microsoft-prod.list ]; then
colorecho $_green "Microsoft APT repo already registered. Done."
echo "Checking for Microsoft APT repo registration"
if [ -f /etc/apt/sources.list.d/microsoft-prod.list ]; then
echo "Microsoft APT repo already registered. Done."
exit 0
fi
@ -32,7 +31,7 @@ case $ID in
raspbian)
if [ "$VERSION_CODENAME" == "bullseye" ] || [ "$VERSION_ID" == "11" ];
then
os_platform="$ID_LIKE/11"
os_platform="$ID_LIKE/11"
else
os_platform="$ID_LIKE/stretch/multiarch"
fi
@ -40,30 +39,30 @@ case $ID in
esac
if [ "${os_platform}" == "" ]; then
colorecho $_red "ERROR: This script only works on Ubunto and Raspbian distros"
echo "ERROR: This script only works on Ubunto and Raspbian distros"
exit 1
fi
curl https://packages.microsoft.com/config/${os_platform}/prod.list > ./microsoft-prod.list
[ $? -eq 0 ] || { colorecho $_red "curl failed"; exit 1; }
[ $? -eq 0 ] || { echo "curl failed"; exit 1; }
# Register the Microsoft repository GPG keys
sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/
[ $? -eq 0 ] || { colorecho $_red "sudo cp microsoft-prod.list failed"; exit 1; }
[ $? -eq 0 ] || { echo "sudo cp microsoft-prod.list failed"; exit 1; }
rm microsoft-prod.list
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
[ $? -eq 0 ] || { colorecho $_red "curl microsoft.asc failed"; exit 1; }
[ $? -eq 0 ] || { echo "curl microsoft.asc failed"; exit 1; }
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/
[ $? -eq 0 ] || { colorecho $_red "cp microsoft.gpg failed"; exit 1; }
[ $? -eq 0 ] || { echo "cp microsoft.gpg failed"; exit 1; }
rm microsoft.gpg
# Update the list of products
sudo apt-get update
[ $? -eq 0 ] || { colorecho $_red "apt update failed"; exit 1; }
[ $? -eq 0 ] || { echo "apt update failed"; exit 1; }
colorecho $_green "Microsoft APT repo successfully registered"
echo "Microsoft APT repo successfully registered"

Просмотреть файл

@ -2,9 +2,8 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
source "$script_dir/../colorecho.sh"
colorecho $_yellow "Checking for moby install"
echo "Checking for moby install"
unset moby_cli_installed
dpkg -s moby-cli | grep -q "install ok installed"
if [ $? -eq 0 ]; then moby_cli_installed=true; fi
@ -15,44 +14,44 @@ if [ $? -eq 0 ]; then moby_engine_installed=true; fi
need_moby=true
if [ $moby_engine_installed ] && [ $moby_cli_installed ]; then
colorecho $_yellow "moby is already installed"
unset need_moby
echo "moby is already installed"
unset need_moby
fi
if [ "$need_moby" ]; then
colorecho $_yellow "checking for docker install"
if [ "$need_moby" ]; then
echo "checking for docker install"
which docker > /dev/null
if [ $? -eq 0 ]; then
colorecho $_yellow "docker is already installed"
echo "docker is already installed"
unset need_moby
fi
fi
if [ "$need_moby" ]; then
$script_dir/setup-microsoft-apt-repo.sh
[ $? -eq 0 ] || { echo "setup-microsoft-apt-repo failed"; exit 1; }
if [ "$need_moby" ]; then
$script_dir/install-microsoft-apt-repo.sh
[ $? -eq 0 ] || { echo "install-microsoft-apt-repo failed"; exit 1; }
colorecho $_yellow "installing moby"
echo "installing moby"
sudo apt-get install -y moby-engine
[ $? -eq 0 ] || { colorecho $_red "apt-get failed"; exit 1; }
[ $? -eq 0 ] || { echo "apt-get failed"; exit 1; }
sudo apt-get install -y moby-cli
[ $? -eq 0 ] || { colorecho $_red "apt-get failed"; exit 1; }
[ $? -eq 0 ] || { echo "apt-get failed"; exit 1; }
# wait for the docker engine to start.
sleep 10s
fi
# add a group called 'docker' so we can add ourselves to it. Sometimes it gets automatically created, sometimes not.
colorecho $_yellow "creating docker group"
echo "creating docker group"
sudo groupadd docker
# allowed to fail if the group already exists
# add ourselves to the docker group. The user will have to restart the bash prompt to run docker, so we'll just
# sudo all of our docker calls in this script.
colorecho $_yellow "adding $USER to docker group"
echo "adding $USER to docker group"
sudo usermod -aG docker $USER
[ $? -eq 0 ] || { colorecho $_yellow "usermod failed"; exit 1; }
[ $? -eq 0 ] || { echo "usermod failed"; exit 1; }
colorecho $_green "Moby/Docker successfully installed"
echo "Moby/Docker successfully installed"

13
scripts/new/install-prereqs.sh Executable file
Просмотреть файл

@ -0,0 +1,13 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
$script_dir/install-azure-cli.sh
[ $? -eq 0 ] || { echo "install-azure-cli.sh failed"; exit 1; }
$script_dir/install-moby.sh
[ $? -eq 0 ] || { echo "install-moby.sh failed"; exit 1; }
$script_dir/install-iotedge.sh
[ $? -eq 0 ] || { echo "install-moby.sh failed"; exit 1; }

Просмотреть файл

Просмотреть файл

@ -0,0 +1,11 @@
# wait for a docker container to be running
CONTAINER_NAME=$1
while true; do
state=$(docker inspect -f {{.State.Running}} ${CONTAINER_NAME})
if [ $? -eq 0 ] && [ "${state}" == "true" ]; then
echo ${CONTAINER_NAME} is running
exit 0
else
sleep 5
fi
done;

Просмотреть файл

@ -1,23 +0,0 @@
#!/usr/bin/env pwsh
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
function IsWin32 {
if("$env:OS" -ne "") {
if ($env:OS.Indexof('Windows') -ne -1) {
return $true
}
}
return $false
}
function Invoke-PyCmd($py_cmd) {
$py = ""
if(IsWin32) {
$py = "python $py_cmd"
}
else {
$py = "python3 $py_cmd"
}
Invoke-Expression $py
}

Просмотреть файл

@ -1,79 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "ERROR: You must source this script: source $0" >&2
exit 33
fi
pushd .
RUNTIME=3.7.7
sudo apt-get update
[ $? -eq 0 ] || { echo "APT failed"; return 1; }
sudo apt-get install -y make build-essential zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev dos2unix libssl1.0-dev dos2unix
[ $? -eq 0 ] || { echo "APT failed"; return 1; }
which pyenv &> /dev/null
if [ $? -ne 0 ]; then
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
[ $? -eq 0 ] || { echo "failed installing pyenv"; return 1; }
cd ${HOME}/.pyenv
[ $? -eq 0 ] || { echo "failed cd ${HOME}/.pyenv"; return 1; }
# pyenv-installer gives us CRLF when we just want LF. Force LF
find -type f -a -not \( -path './versions/*' \) -print0 | \
xargs -0 -I @@ bash -c 'file "$@" | grep ASCII &>/dev/null && dos2unix $@' -- @@
export PATH="${HOME}/.pyenv/bin:${PATH}"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
eval "$(pyenv init -)"
fi
pyenv install -s $RUNTIME
[ $? -eq 0 ] || { echo "failed installing Python $RUNTIME"; build_failure_help; return 1; }
pyenv shell $RUNTIME
[ $? -eq 0 ] || { echo "failed calling pyenv to use Python $RUNTIME for this script"; return 1; }
python -m pip install --upgrade pip
[ $? -eq 0 ] || { echo "failed upgrading PIP for Python $RUNTIME"; return 1; }
python -m pip install virtualenv
[ $? -eq 0 ] || { echo "failed installing virtualenv for Python $RUNTIME"; return 1; }
python -m virtualenv "${HOME}/env/Python-${RUNTIME}"
[ $? -eq 0 ] || { echo "failed setting up a virtual environment for Python $RUNTIME"; return 1; }
echo Success!
echo
echo "Use the following commands to switch python versions (or use the aliases below):"
echo "source ~/env/Python-${RUNTIME}/bin/activate"
echo
echo "Add the following to your .bashrc file:"
echo "export PATH=\"${HOME}/.pyenv/bin:\$PATH\""
echo "eval \"\$(pyenv init -)\""
echo "eval \"\$(pyenv virtualenv-init -)\""
echo "alias pip='python -m pip $@'"
echo "alias py-${RUNTIME}='source ~/env/Python-${RUNTIME}/bin/activate'"
source ~/env/Python-${RUNTIME}/bin/activate
popd

Просмотреть файл

@ -1,4 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
docker login -u $IOTHUB_E2E_REPO_USER -p $IOTHUB_E2E_REPO_PASSWORD $IOTHUB_E2E_REPO_ADDRESS
[ $? -eq 0 ] || { echo "docker login failed"; exit 1; }

Просмотреть файл

@ -1,31 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
source "$script_dir/../colorecho.sh"
colorecho $_yellow "Checking for powershell install"
pwsh -v > /dev/null
if [ $? -eq 0 ]; then
colorecho $_green "Powershell is already installed. done"
exit 0
fi
# Register the Microsoft repository
$script_dir/setup-microsoft-apt-repo.sh
[ $? -eq 0 ] || { echo "setup-microsoft-apt-repo failed"; exit 1; }
# Enable the "universe" repositories
sudo add-apt-repository universe
[ $? -eq 0 ] || { colorecho $_red "add-apt-repository failed"; exit 1; }
# Update the list of products
sudo apt-get update
[ $? -eq 0 ] || { colorecho $_red "apt update failed"; exit 1; }
# Install PowerShell
sudo apt-get install -y powershell
[ $? -eq 0 ] || { colorecho $_red "apt install powershell failed"; exit 1; }
colorecho $_green "powershell successfully installed"

Просмотреть файл

@ -1,43 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
script_dir=$(cd "$(dirname "$0")" && pwd)
source "$script_dir/../colorecho.sh"
function header {
color="$1"
shift
colorecho $color "----------------------------------------------------------"
colorecho $color $@
colorecho $color "----------------------------------------------------------"
}
function failure {
header $_red $@
exit 1
}
header $_cyan "installing moby"
$script_dir/setup-moby.sh
[ $? -eq 0 ] || failure "setup-moby failed"
header $_cyan "installing local container registry"
$script_dir/setup-registry.sh
[ $? -eq 0 ] || failure "setup-registry failed"
header $_cyan "installing iotedge"
$script_dir/setup-iotedge.sh
[ $? -eq 0 ] || failure "setup-iotedge failed"
header $_green "\n\
setup-ubuntu succeeded\n\
\n\
Please open a new bash prompt before continuing\n\
\n\
If you get permission errors from docker, reboot your VM\n\
for group changes to take effect\n\
\n\
"

Просмотреть файл

@ -1,61 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
language=$1
tag=$2
function usage {
echo "Usage: $0 [node | c | csharp | java | pythonv2] [tag]"
echo "eg: $0 pythonv2 vsts-12345"
}
if [ "$language" == "" ] || [ "$tag" == "" ]; then
usage
exit 1
fi
case "$language" in
node | c | csharp | java | pythonv2)
echo "tagging ${language} ${tag} as LKG"
;;
*)
usage
exit 1
;;
esac
variants=""
case "$language" in
node)
variants="node18"
;;
pythonv2)
variants="py37 py38 py39 py310"
;;
esac
base=${IOTHUB_E2E_REPO_ADDRESS}/${language}-e2e-v3
docker login -u ${IOTHUB_E2E_REPO_USER} -p ${IOTHUB_E2E_REPO_PASSWORD} ${IOTHUB_E2E_REPO_ADDRESS}
[ $? -eq 0 ] || { echo "docker login failed"; exit 1; }
docker pull ${base}:${tag}
[ $? -eq 0 ] || { echo "docker pull ${base}:${tag} failed"; exit 1; }
docker tag ${base}:${tag} ${base}:lkg
[ $? -eq 0 ] || { echo "docker tag ${base}:${tag} ${base}:lkg failed"; exit 1; }
docker push ${base}:lkg
[ $? -eq 0 ] || { echo "docker push ${base}:lkg failed"; exit 1; }
for variant in ${variants}; do
docker pull ${base}:${tag}-${variant}
[ $? -eq 0 ] || { echo "docker pull ${base}:${tag}-${variant} failed"; exit 1; }
docker tag ${base}:${tag}-${variant} ${base}:lkg-${variant}
[ $? -eq 0 ] || { echo "docker tag ${base}:${tag}-${variant} ${base}:lkg-${variant} failed"; exit 1; }
docker push ${base}:lkg-${variant}
[ $? -eq 0 ] || { echo "docker push ${base}:lkg failed"; exit 1; }
done

Просмотреть файл

@ -1,85 +0,0 @@
#!/usr/bin/env pwsh
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
Param
(
[Parameter(Position=0)]
[AllowEmptyString()]
[string]$container_name="",
[Parameter(Position=1)]
[AllowEmptyString()]
[string]$image_name=""
)
$path = $MyInvocation.MyCommand.Path
if (!$path) {$path = $psISE.CurrentFile.Fullpath}
if ( $path) {$path = split-path $path -Parent}
. $path/pwsh-helpers.ps1
$isWin32 = IsWin32
if( "$container_name" -eq "" -or "$image_name" -eq "") {
Write-Host "Usage: verify-deployment [container_name] [image_name]" -ForegroundColor Red
Write-Host "eg: verify-deployment nodeMod localhost:5000/node-test-image:latest" -ForegroundColor Red
exit 1
}
$expectedImg = ""
$actualImg = ""
$expectedImg = ""
$running = $true
$out_progress = "."
$expectedImg = ""
if($isWin32) {
$container_name = $container_name.ToLower()
$image_name = $image_name.ToLower()
}
Write-Host "getting image ID for Image:($image_name) Container:($container_name)" -ForegroundColor Green
$ErrorActionPreference = "SilentlyContinue"
foreach($i in 1..37) {
if("$out_progress" -eq ".") {
Write-Host "calling docker inspect ($image_name)" -ForegroundColor Green
}
if($isWin32) {
$expectedImg = docker image inspect $image_name --format="{{.Id}}"
}
else {
$expectedImg = sudo docker image inspect $image_name --format="{{.Id}}"
}
if("$expectedImg" -ne "") {
if("$out_progress" -eq ".") {
Write-Host "Inspecting Image ($container_name) for .State.Running" -ForegroundColor Green
}
if($isWin32) {
$running = docker image inspect --format="{{.State.Running}}" $container_name
}
else {
$running = sudo docker inspect --format="{{.State.Running}}" $container_name
}
if($running) {
Write-Host "Container is running. Checking image" -ForegroundColor Green
if($isWin32) {
$actualImg = docker inspect $container_name --format="{{.Image}}"
}
else {
$actualImg = sudo docker inspect $container_name --format="{{.Image}}"
}
if($expectedImg -eq $actualImg) {
Write-Host "IDs match. Deployment is complete" -ForegroundColor Green
exit 0
}
else {
Write-Host "container is not running. Waiting" -ForegroundColor Yellow
}
}
}
Write-Host "Waiting$out_progress" -ForegroundColor Blue
$out_progress += "."
Start-Sleep -s 10
}
exit 1

Просмотреть файл

@ -104,12 +104,3 @@ jobs:
forced_image: $(Horton.ForcedImage)
suite: $(suite)
- job: "tag_lkg_amd64"
pool:
vmImage: 'ubuntu-20.04'
dependsOn:
"test_linux_amd64"
steps:
- template: templates/steps-tag-lkg.yaml
parameters:
language: pythonv2

Просмотреть файл

@ -84,7 +84,11 @@ steps:
}
if ( $CommitToPass -like "master" ) {
$CommitToPass="main"
if ($LanguageToPass -like 'pythonv2') {
$CommitToPass="v2"
} else {
$CommitToPass="main"
}
}
$Architecture=GetArchitecture

Просмотреть файл

@ -11,8 +11,8 @@ parameters:
deployment_type: ''
steps:
- bash: ${HORTON_FRAMEWORKROOT}/scripts/setup/setup-iotedge.sh
displayName: 'Install iotedge packages'
- bash: ${HORTON_FRAMEWORKROOT}/scripts/new/install-prereqs.sh
displayName: 'Install prerequisites'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- bash: |
@ -23,18 +23,6 @@ steps:
displayName: 'docker login'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['usesDocker'], 'yes'))
- bash: |
docker pull ${{ parameters.image_testMod }} || docker pull ${{ parameters.image_testMod }}
displayName: 'pre-cache test image'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['usesDocker'],'yes'))
- bash: |
( docker pull ${{ parameters.image_edgeAgent }} || docker pull ${{ parameters.image_edgeAgent }} ) &&
( docker pull ${{ parameters.image_edgeHub }} || docker pull ${{ parameters.image_edgeHub }} ) &&
( docker pull ${{ parameters.image_friendmod }} || docker pull ${{ parameters.image_friendmod }} )
displayName: 'pre-cache edge images'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- bash:
${HORTON_FRAMEWORKROOT}/bin/horton deploy ${{ parameters.deployment_type }} image ${{ parameters.image_testMod }}
displayName: 'Create new identites and deploy containers (docker)'
@ -46,38 +34,24 @@ steps:
IOTEDGE_DEBUG_LOG: $(IOTEDGE_DEBUG_LOG)
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['usesDocker'],'yes'))
- powershell: $(Horton.FrameworkRoot)/scripts/verify-deployment.ps1 edgeHub ${{ parameters.image_edgeHub }}
displayName: 'Verify edgeHub deployment'
- bash: |
cd ${HORTON_FRAMEWORKROOT}/scripts/new/ &&
./wait-for-container.sh edgeHub &&
./wait-for-container.sh edgeAgent &&
./wait-for-container.sh friendMod
displayName: 'wait for iot edge containers'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- powershell: $(Horton.FrameworkRoot)/scripts/verify-deployment.ps1 edgeAgent ${{ parameters.image_edgeAgent }}
displayName: 'Verify edgeAgent deployment'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- powershell: $(Horton.FrameworkRoot)/scripts/verify-deployment.ps1 friendMod ${{ parameters.image_friendMod }}
displayName: 'Verify friendMod deployment'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- powershell: $(Horton.FrameworkRoot)/scripts/verify-deployment.ps1 testMod ${{ parameters.image_testMod }}
displayName: 'Verify testMod deployment'
- bash: |
cd ${HORTON_FRAMEWORKROOT}/scripts/new/ &&
./wait-for-container.sh testMod
displayName: 'wait for testMod container'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['usesDocker'],'yes'))
- bash:
source ${HORTON_FRAMEWORKROOT}/bin/activate_horton &&
python pyscripts/ensure_container.py testMod
displayName: 'Verify that testMod is responding'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['usesDocker'],'yes'))
- bash:
source ${HORTON_FRAMEWORKROOT}/bin/activate_horton &&
python pyscripts/ensure_container.py friendMod
displayName: 'Verify that friendMod is responding'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
- bash: sleep 30
displayName: 'give edgeHub 30 seconds to start up'
condition: and(succeeded(), ne(variables['skipTest'],'yes'), eq(variables['deploymentType'], 'iotedge'))
displayName: '30 seconds to start up'
condition: and(succeeded(), ne(variables['skipTest'],'yes'))
- bash:
${HORTON_FRAMEWORKROOT}/bin/horton get_credentials
displayName: 'Get credentials'

Просмотреть файл

@ -1,12 +0,0 @@
parameters:
langauge: ''
steps:
- bash: |
${HORTON_FRAMEWORKROOT}/scripts/tag-lkg.sh ${{ parameters.language }} vsts-${BUILD_BUILDID}
displayName: "tag LKG ${{ parameters.language }}"
env:
IOTHUB_E2E_REPO_ADDRESS: $(IOTHUB-E2E-REPO-ADDRESS)
IOTHUB_E2E_REPO_USER: $(IOTHUB-E2E-REPO-USER)
IOTHUB_E2E_REPO_PASSWORD: $(IOTHUB-E2E-REPO-PASSWORD)
condition: and(succeeded(), or(eq(variables['Horton.Commit'],'master'), eq(variables['Horton.Commit'],'main')))