-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Integration tests to Github actions:
- Integration tests for edge capi linux - Integration tests for min capi - Integration tests for windows - Integration tests for client credentials Co-authored-by: Juan Diego Gonzalez <[email protected]> Co-authored-by: Cristhian Peña <[email protected]>
- Loading branch information
1 parent
aa79b15
commit b621bb1
Showing
10 changed files
with
765 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
$ErrorActionPreference = "Stop" | ||
trap { $host.SetShouldExit(1) } | ||
|
||
echo "Work Directory: $pwd" | ||
$Env:ROOT="$pwd" | ||
|
||
$null = New-Item -ItemType Directory -Force -Path $Env:TEMP | ||
|
||
# TODO: consider migrating choco to winget https://github.com/microsoft/winget-cli as preferred MS solution | ||
if ((Get-Command "choco" -ErrorAction SilentlyContinue) -eq $null) { | ||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | ||
$tempvar = (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1') | ||
iex ($tempvar) | ||
} | ||
|
||
function Refresh-Choco-Env { | ||
Import-Module "C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1" | ||
refreshenv | ||
cd $Env:ROOT | ||
} | ||
|
||
Refresh-Choco-Env | ||
|
||
$Env:GOPATH="$Env:ROOT\go" | ||
|
||
$Env:PATH="$Env:HOME\go\bin;" + "$Env:PATH" | ||
$Env:PATH="$Env:GOPATH\bin;" + "$Env:PATH" | ||
$Env:PATH="$Env:GOROOT\bin;" + "$Env:PATH" | ||
$Env:PATH="$pwd;" + "$Env:PATH" | ||
$Env:PATH="$pwd\cli\out;" + "$Env:PATH" | ||
|
||
# This is for DEBUG | ||
# function Get-Env-Info { | ||
# echo "Powershell: $((Get-Host).Version)" | ||
# echo "Working Directory: $pwd" | ||
# echo "GOPATH: $Env:GOPATH" | ||
# echo "PATH:" | ||
# $Env:PATH.split(";") | ||
|
||
# echo "-------------" | ||
|
||
# Get-ChildItem Env: | Format-Table -Wrap -AutoSize | ||
# } | ||
|
||
# Get-Env-Info | ||
|
||
$Env:RUN_ID=(openssl rand -hex 16) | ||
$Env:GOFLAGS = "-mod=mod" | ||
|
||
if ((Get-Command "ginkgo" -ErrorAction SilentlyContinue) -eq $null) { | ||
go install -v github.com/onsi/ginkgo/ginkgo@v1.16.4 | ||
} | ||
|
||
$CF_INT_NAME=(Get-Content $pwd\metadata.json -Raw| Out-String | ConvertFrom-Json).name.trim() | ||
$Env:CF_INT_PASSWORD=(Get-Content $pwd\cf-password -Raw).trim() | ||
$Env:CF_INT_OIDC_PASSWORD=(Get-Content $pwd\uaa-oidc-password -Raw).trim() | ||
$Env:CF_INT_OIDC_USERNAME="admin-oidc" | ||
$Env:CF_INT_API="https://api.$CF_INT_NAME.cf-app.com" | ||
$Env:CF_DIAL_TIMEOUT=15 | ||
# Enable SSL vaildation once toolsmiths supports it | ||
# $Env:SKIP_SSL_VALIDATION="false" | ||
|
||
Import-Certificate -Filepath "$pwd\$CF_INT_NAME.router.ca" -CertStoreLocation "cert:\LocalMachine\root" | ||
|
||
New-Item "go/src/code.cloudfoundry.org" -Type Directory | ||
New-Item -ItemType SymbolicLink -Path "$pwd/go/src/code.cloudfoundry.org/cli" -Target "$pwd/cli" | ||
|
||
cd go/src/code.cloudfoundry.org/cli | ||
|
||
go install github.com/akavel/rsrc@v0.10.2 | ||
|
||
make out/cf-cli_winx64.exe | ||
Move-Item -Path ./out/cf-cli_winx64.exe -Destination ./out/cf.exe -Force | ||
|
||
ginkgo.exe -r ` | ||
-nodes=16 ` | ||
-flakeAttempts=2 ` | ||
-slowSpecThreshold=60 ` | ||
-randomizeAllSpecs ` | ||
./integration/shared/isolated ` | ||
./integration/v7/isolated ` | ||
./integration/shared/experimental ` | ||
./integration/v7/experimental ` | ||
./integration/v7/push | ||
|
||
if ($LASTEXITCODE -gt 0) | ||
{ | ||
exit 1 | ||
} | ||
|
||
ginkgo.exe -r ` | ||
-flakeAttempts=2 ` | ||
-slowSpecThreshold=60 ` | ||
-randomizeAllSpecs ` | ||
./integration/shared/global ` | ||
./integration/v7/global | ||
|
||
if ($LASTEXITCODE -gt 0) | ||
{ | ||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
name: Setup CF Environment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
capi-version: | ||
required: true | ||
type: string | ||
outputs: | ||
environment-name: | ||
description: "Name of claimed environment" | ||
value: ${{ jobs.cf-env-setup.outputs.environment-name }} | ||
|
||
jobs: | ||
cf-env-setup: | ||
name: Setting Up CF env | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
outputs: | ||
environment-name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} | ||
steps: | ||
- id: claim-toolsmiths-env | ||
name: Claim Toolsmiths Environment | ||
env: | ||
api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} | ||
hostname: ${{ secrets.TOOLSMITHS_HOSTNAME }} | ||
notes: CF CLI Github Actions Integration Tests | ||
pool_name: cf-deployment | ||
run: | | ||
while true; do | ||
curl -s --show-error -D >(tee headers.txt >&2) -H 'Accept: application/json' \ | ||
-X POST "https://${hostname}/pooled_gcp_engineering_environments/claim" \ | ||
--data-urlencode "api_token=${api_token}" \ | ||
--data-urlencode "pool_name=${pool_name}" \ | ||
--data-urlencode "notes=${notes}" > metadata.json \ | ||
|| echo "Unable to reach server, trying again in 30 seconds..." | ||
ERR_500="Sorry, the Toolsmiths Environments app is currently encountering issues. Trying again in 30 seconds..." | ||
ERR_429="Sorry, Toolsmiths are out of environments in your requested pool. New environments are on their way but you can stop by the Toolsmiths slack channel for more help." | ||
ERR_409="Sorry, was not able to claim an environment. Trying again in 30 seconds..." | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 401" headers.txt && exit 1 | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && exit 2 | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 500" headers.txt && echo "$ERR_500" | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 200" headers.txt && break | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 429" && echo "$ERR_429" | ||
grep -q -E "HTTP/[[:digit:]\.]{1,3} 409" && echo "$ERR_409" | ||
sleep 30 | ||
done | ||
ENV=$(cat metadata.json | jq -r '.name') | ||
echo "::set-output name=environment-name::${ENV}" | ||
- name: 'Upload Metadata' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} | ||
path: metadata.json | ||
|
||
- name: Checkout cli-ci | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: cloudfoundry/cli-ci | ||
path: cli-ci | ||
|
||
- name: Checkout cf-deployment Min CAPI | ||
if: ${{ inputs.capi-version != 'edge' }} | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: cloudfoundry/cf-deployment | ||
path: cf-deployment | ||
ref: ${{ inputs.capi-version }} | ||
|
||
- name: Checkout cf-deployment | ||
uses: actions/checkout@v3 | ||
if: ${{ inputs.capi-version == 'edge' }} | ||
with: | ||
repository: cloudfoundry/cf-deployment | ||
path: cf-deployment | ||
|
||
- name: Checkout CF deployment tasks | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: cloudfoundry/cf-deployment-concourse-tasks | ||
path: cf-deployment-concourse-tasks | ||
|
||
- name: Checkout cli | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: cloudfoundry/cli | ||
path: cli | ||
ref: linux-min-capi-int-test | ||
|
||
- name: Install Tools | ||
run: | | ||
wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp | ||
mv /tmp/bbl-* /usr/local/bin/bbl | ||
chmod +x /usr/local/bin/bbl | ||
bbl --version | ||
wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/local/bin/bosh" | ||
chmod +x /usr/local/bin/bosh | ||
bosh --version | ||
- name: Deploy edge CAPI with Isolation Segment and OIDC Provider | ||
if: ${{ inputs.capi-version == 'edge' }} | ||
run: | | ||
# find latest capi | ||
FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')" | ||
aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1 | ||
eval "$(bbl print-env --metadata-file metadata.json)" | ||
bosh upload-release --sha2 "$FILENAME" | ||
rm $FILENAME | ||
# deploy | ||
bosh -d cf manifest > /tmp/manifest.json | ||
bosh -n -d cf deploy /tmp/manifest.json \ | ||
-o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \ | ||
-o cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml \ | ||
-o cli-ci/ci/infrastructure/operations/add-oidc-provider.yml | ||
echo "Deployed CAPI version:" | ||
bosh -d cf releases | grep capi | ||
- name: Deploy MIN CAPI with Isolation Segment and OIDC Provider | ||
if: ${{ inputs.capi-version != 'edge' }} | ||
run: | | ||
# Creates vars files | ||
mkdir vars-files | ||
echo "cs = ${{ secrets.CLIENT_SECRET }}" | ||
cat << EOF > vars-files/vars.yml | ||
client-secret: ${{ secrets.CLIENT_SECRET }} | ||
EOF | ||
# Copy Ops files | ||
mkdir ops-files | ||
cp cf-deployment/operations/scale-to-one-az.yml ops-files/ | ||
cp cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml ops-files/ | ||
cp cf-deployment/operations/use-compiled-releases.yml ops-files/ | ||
cp cf-deployment/operations/use-internal-lookup-for-route-services.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/add-dummy-windows-stack.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/add-oidc-provider.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/add-uaa-client-cf-custom.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/adjust-user-retry-attempts.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/cli-isolation-cell-overrides.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/default-app-memory.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/diego-cell-instances.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/doppler-instances.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/enable-v3-deployments-endpoint.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/give-cf-admin-clients-read-scope.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/reduce-async-service-polling.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/skip-ssl-override.yml ops-files/ | ||
cp cli-ci/ci/infrastructure/operations/uaa-vm_type-override.yml ops-files/ | ||
# Deletes CF-D | ||
eval "$(bbl print-env --metadata-file metadata.json)" | ||
bosh -d cf delete-deployment -n | ||
# Deploy CF-D | ||
mkdir toolsmiths-env | ||
cp metadata.json toolsmiths-env/metadata | ||
cat metadata.json | jq -r .name > toolsmiths-env/name | ||
export VARS_FILES="vars.yml" | ||
export MANIFEST_FILE="cf-deployment.yml" | ||
export SYSTEM_DOMAIN="" | ||
export REGENERATE_CREDENTIALS=false | ||
export DEPLOY_WITH_UPTIME_MEASUREMENTS=false | ||
export MEASURE_SYSLOG_AVAILABILITY=false | ||
export TCP_DOMAIN="" | ||
export AVAILABLE_PORT="" | ||
export FAIL_ON_DOWNTIME=false | ||
export APP_PUSHABILITY_THRESHOLD=0 | ||
export HTTP_AVAILABILITY_THRESHOLD=0 | ||
export RECENT_LOGS_THRESHOLD=0 | ||
export STREAMING_LOGS_THRESHOLD=0 | ||
export APP_SYSLOG_AVAILABILITY_THRESHOLD=0 | ||
export USE_SINGLE_APP_INSTANCE=false | ||
export BOSH_DEPLOY_ARGS="" | ||
export BOSH_LITE=false | ||
export BBL_JSON_CONFIG="" | ||
export OPS_FILES="add-persistent-isolation-segment-diego-cell.yml \ | ||
use-compiled-releases.yml \ | ||
cli-isolation-cell-overrides.yml \ | ||
default-app-memory.yml \ | ||
skip-ssl-override.yml \ | ||
scale-to-one-az.yml \ | ||
diego-cell-instances.yml \ | ||
doppler-instances.yml \ | ||
uaa-vm_type-override.yml \ | ||
add-uaa-client-credentials.yml \ | ||
add-dummy-windows-stack.yml \ | ||
reduce-async-service-polling.yml \ | ||
add-oidc-provider.yml \ | ||
adjust-user-retry-attempts.yml \ | ||
enable-v3-deployments-endpoint.yml \ | ||
give-cf-admin-clients-read-scope.yml \ | ||
add-uaa-client-cf-custom.yml \ | ||
use-internal-lookup-for-route-services.yml" | ||
./cf-deployment-concourse-tasks/bosh-deploy/task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.