суббота, 28 ноября 2020 г.

BluePrism AutmateC.exe PowerShell Automation

 


Load the Queues

    $automatec = "C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe"

    & $automatec /sso /startschedule /schedule "03.01 - Load AUH SCAL Queue" #577

    & $automatec /sso /startschedule /schedule "03.03 - Load PDR SCAL Queue" #575

    & $automatec /sso /startschedule /schedule "03.04 - Load PDR NCAL Queue" #574

    & $automatec /sso /startschedule /schedule "03.05 - Load AUH NW Queue" #563

    & $automatec /sso /startschedule /schedule "03.06 - Load PDR GA Queue" #570


Logout, Login, BotStart

# === Clean PowerShell ===

$ps = [PowerShell]::Create()

$ps.AddScript('Get-Variable | Select-Object -ExpandProperty Name') | Out-Null

$builtIn = $ps.Invoke()

$ps.Dispose()

$builtIn += "profile","psISE","psUnsupportedConsoleApplications" # keep some ISE-specific stuff


Remove-Variable (Get-Variable | Select-Object -ExpandProperty Name | Where-Object {$builtIn -NotContains $_})

# ======================

Function ShortLogoutLogin {

[CmdletBinding()]

Param($j)

    $h = $j + ":9003"

    Write-Host $j 

    Logout -VmName $h

    Login -VmName $j

}

Function Logout {

[CmdletBinding()]

Param($VmName)

    Write-Host "Execute LOGOUT ..."

    & $automatec /run $logout_process /resource $VmName /sso

    Start-Sleep -s 0

}

Function Login {

[CmdletBinding()]

Param($VmName)

    Write-Host "Execute LOGIN..."

    & $automatec /run $login_process /resource $VmName /sso /startp "<inputs><input name='Login Locally' type ='Flag' value='False' /><input name='Domain' type ='Text' value='cs' /><input name='Send Secure Attention Sequence' type ='Flag' value='True' /></inputs>"

    Start-Sleep -s 0

}

Function StartBot {

[CmdletBinding()]

Param($VmName, $BotName)

    $BotParams=$BotParamsMap[$BotName]

    & $automatec /run $BotName /resource $VmName /sso /startp $BotParams

    Start-Sleep -s 0

}

# ======================

$automatec = "C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe"

#$automate = "C:\Program Files\Blue Prism Limited\Blue Prism Automate\Automate.exe"

$SCAL_AUH = "W10_Tap_SCAL_A02_MainProcess_Run_AUH"

$SCAL_PDR = "W10_Tap_SCAL_A01_MainProcess_Run_PDR"

$login_process = "Login"

$logout_process = "Logout"

$VmPrefix = "MASDCVDI000"

#$Sessions = @()

$BotParamsMap = @{"W10_Tap_SCAL_A02_MainProcess_Run_AUH"="<inputs><input name='Test Mode' type ='Flag' value='False' /></inputs>"

          "W10_Tap_SCAL_A01_MainProcess_Run_PDR"="<inputs><input name='Test Mode' type ='Flag' value='False' /></inputs>"

          "W10_Tap_NCAL_A01_MainProcess_Run_PDR"="<inputs><input name='Test Mode' type ='Flag' value='False' /></inputs>"

          "W10_Tap_GA_A01_MainProcess_Run_PDR"="<inputs><input name='Test Mode' type ='Flag' value='False' /></inputs>"

         }

$BotNames= @("W10_Tap_SCAL_A02_MainProcess_Run_AUH",

            "W10_Tap_SCAL_A01_MainProcess_Run_PDR",

            "W10_Tap_NCAL_A01_MainProcess_Run_PDR",

            "W10_Tap_GA_A01_MainProcess_Run_PDR"

            )

For($i = 0; $i -lt $BotNames.Count; $i++){

    Write-Host $i ": "$BotNames[$i]

}

$BotIndex = Read-Host 'Enter name ofJobIndex:'


$Task = $BotNames[$BotIndex]

Write-Host $Task


$VM_except = @(560,561,562,564,565,566,568,569,570,578)

#$VM_except_flag = $true

$VM_except_flag = $false

$VM_Start = 554

$VM_End = 578

# === Loop Logout

For ($i = $VM_Start; $i -le $VM_End; $i++) {

    $j = $VmPrefix + $i

    $h = $j + ":9003"

    if ($VM_except_flag) {

        if (-Not ($VM_except.Contains($i))) {

            Logout -VmName $h

        }

    }

    else {

        if ($VM_except.Contains($i)) {

            Logout -VmName $h

        }

    }

}

# === Loop Login

For ($i = $VM_Start; $i -le $VM_End; $i++) {

    $j = $VmPrefix + $i

    $h = $j + ":9003"

    if ($VM_except_flag) {

        if (-Not ($VM_except.Contains($i))) {

            Login -VmName $j

        }

    }

    else {

        if ($VM_except.Contains($i)) {

            Login -VmName $j

        }

    }

}

# === Loop BotRun

For ($i = $VM_Start; $i -le $VM_End; $i++) {

    $j = $VmPrefix + $i

    $h = $j + ":9003"

    if ($VM_except_flag) {

        if (-Not ($VM_except.Contains($i))) {

            StartBot -VmName $h -BotName $Task

        }

    }

    else {

        if ($VM_except.Contains($i)) {

            StartBot -VmName $h -BotName $Task

        }

    }

}

Gitlab ECR Credentials Helper - Settings on Runner

 

vi /etc/gitlab-runner/config.toml

concurrent = 1

check_interval = 0

[session_server]

  session_timeout = 1800

[[runners]]

  name = "EC2_i-034aeb1a7a49cda81"

  url = "https://gitlab-sfo.dolby.net/"

  token = "4EnhzuihzRrszK_y"

  executor = "docker"

  [runners.custom_build_dir]

  [runners.cache]

    Type = "s3"

    Shared = true

    [runners.cache.s3]

      BucketName = "domain.build-agent.cache"

      BucketLocation = "us-west-2"

    [runners.cache.gcs]

    [runners.cache.azure]

  [runners.docker]

    tls_verify = false

    image = "alpine"

    privileged = false

    disable_entrypoint_overwrite = false

    oom_kill_disable = false

    disable_cache = false

    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/root/.docker/config.json:/root/.docker/config.json", "/usr/bin/docker-credential-ecr-login:/usr/bin/docker-credential-ecr-login", "/cache"]

    shm_size = 0


vi /root/.docker/config.json

"credHelpers":{"83678232.dkr.ecr.us-east-1.amazonaws.com":"ecr-login","8713175.dkr.ecr.us-west-2.amazonaws.com":"ecr-login", "8124058.dkr.ecr.us-west-1.amazonaws.com":"ecr-login"}}

воскресенье, 15 ноября 2020 г.

DevOps MacOS Setup

HomeBrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)


Setup SSH Key on RepoHub

ssh-keygen -t rsa -b 4096

pbcopy < ~/.ssh/id_rsa.pub

 - go to RepoHub settings > ssh keys and add paste the public part of the key


Docker

Docker Desktop for Mac

with homebrew
https://medium.com/crowdbotics/a-complete-one-by-one-guide-to-install-docker-on-your-mac-os-using-homebrew-e818eb4cfc3


AWS eksctl

brew tap weaveworks/tap
brew install weaveworks/tap/eksctl


kubectl

brew install kubectl
https://coreos.com/blog/kubectl-tips-and-tricks