Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config/settings.yml
releases/*.tgz
releases/**/*.tgz
ci/scripts/stemcell/*.tgz
ci/scripts/stemcell-bionic/*.tgz
ci/scripts/stemcell-jammy/*.tgz
dev_releases
blobs/*
.blobs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import (
. "github.com/onsi/ginkgo/v2"
)

var _ = Describe("Bionic", func() {
It("Correctly proxies HTTP requests when using the Bionic stemcell", func() {
var _ = Describe("Jammy", func() {
It("Correctly proxies HTTP requests when using the Jammy stemcell", func() {

opsfileBionic := `---
# Configure Bionic stemcell
opsfileJammy := `---
# Configure Jammy stemcell
- type: replace
path: /stemcells/alias=default/os
value: ubuntu-bionic
value: ubuntu-jammy
`

haproxyBackendPort := 12000
haproxyInfo, _ := deployHAProxy(baseManifestVars{
haproxyBackendPort: haproxyBackendPort,
haproxyBackendServers: []string{"127.0.0.1"},
deploymentName: deploymentNameForTestNode(),
}, []string{opsfileBionic}, map[string]interface{}{}, true)
}, []string{opsfileJammy}, map[string]interface{}{}, true)

closeLocalServer, localPort := startDefaultTestServer()
defer closeLocalServer()
Expand Down
41 changes: 15 additions & 26 deletions acceptance-tests/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@
set -eu
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
source "${REPO_DIR}/ci/scripts/functions-ci.sh"
FOCUS=""
PARALLELISM=""
KEEP_RUNNING=""

usage() {
echo -e "Usage: $0 [-F <ginkgo focus target>] [-k]
echo -e "Usage: $0 [-F <ginkgo focus target>] [-P <ginkgo nodes>] [-k]

-F Focus on a particular test. Expects a Ginkgo test name. Keep bosh running afterwards.
-P Set Ginkgo parallel node count. Default is '-p' (smart parallelism).
-k Keep bosh container running. Useful for debug." 1>&2; exit 1;
}

while getopts ":F:k" o; do
while getopts ":F:P:k" o; do
case "${o}" in
F)
FOCUS=${OPTARG}
KEEP_RUNNING=true
;;
P)
PARALLELISM=${OPTARG}
;;
k)
KEEP_RUNNING=true
;;
Expand All @@ -28,25 +34,11 @@ while getopts ":F:k" o; do
done
shift $((OPTIND-1))

docker_mac_check_cgroupsv1() {
# Force cgroups v1 on Docker for Mac
# inspired by https://github.com/docker/for-mac/issues/6073#issuecomment-1018793677

SETTINGS=~/Library/Group\ Containers/group.com.docker/settings.json

cgroupsV1Enabled=$(jq '.deprecatedCgroupv1' "$SETTINGS")
if [ "$cgroupsV1Enabled" != "true" ]; then
echo "deprecatedCgroupv1 should be enabled in $SETTINGS. Otherwise the acceptance tests will not run on Docker for Mac."
echo "Check in the README.md for a convenient script to set deprecatedCgroupv1 and restart Docker."
exit 1
fi
}

check_required_files() {
PIDS=""
REQUIRED_FILE_PATTERNS=(
ci/scripts/stemcell/bosh-stemcell-*-ubuntu-jammy-*.tgz!https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-jammy-go_agent
ci/scripts/stemcell-bionic/bosh-stemcell-*-ubuntu-bionic-*.tgz!https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-bionic-go_agent
ci/scripts/stemcell/bosh-stemcell-*-ubuntu-noble.tgz!https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-noble
ci/scripts/stemcell-jammy/bosh-stemcell-*-ubuntu-jammy-*.tgz!https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-jammy-go_agent
)

for entry in "${REQUIRED_FILE_PATTERNS[@]}"; do
Expand All @@ -63,9 +55,10 @@ check_required_files() {
fi

(
echo "$filepattern not found, downloading latest."
echo "$filepattern not found, downloading."
cd "$folder" && \
resolved=$(curl -s --write-out '\n%{redirect_url}' "$url" | tail -n1) && \
resolved=$(curl -s --write-out '\n%{redirect_url}' "$url" | tail -n1 | tr -d '\n') && \
echo "Resolved URL: $resolved" && \
curl -s --remote-name --remote-header-name --location "$resolved" && \
echo "Downloaded '$url' successfully." && \
ls -1lh "$folder/"$filepattern
Expand All @@ -81,10 +74,6 @@ check_required_files() {

check_required_files

if [ "$(uname)" == "Darwin" ]; then
docker_mac_check_cgroupsv1
fi

build_image "${REPO_DIR}/ci"
prepare_docker_scratch

Expand All @@ -93,9 +82,9 @@ if [ -n "$KEEP_RUNNING" ] ; then
echo
echo "*** KEEP_RUNNING enabled. Please clean up docker scratch after removing containers: ${DOCKER_SCRATCH}"
echo
docker run --privileged -v "$REPO_DIR":/repo -v "${DOCKER_SCRATCH}":/scratch/docker -e REPO_ROOT=/repo -e FOCUS="$FOCUS" -e KEEP_RUNNING="${KEEP_RUNNING}" haproxy-boshrelease-testflight bash -c "cd /repo/ci/scripts && ./acceptance-tests ; sleep infinity"
docker run --privileged -v "$REPO_DIR":/repo -v "${DOCKER_SCRATCH}":/scratch/docker -e REPO_ROOT=/repo -e FOCUS="${FOCUS}" -e PARALLELISM="${PARALLELISM}" -e KEEP_RUNNING="${KEEP_RUNNING}" haproxy-boshrelease-testflight bash -c "cd /repo/ci/scripts && ./acceptance-tests ; sleep infinity"
else
docker run --rm --privileged -v "$REPO_DIR":/repo -v "${DOCKER_SCRATCH}":/scratch/docker -e REPO_ROOT=/repo -e KEEP_RUNNING="" haproxy-boshrelease-testflight bash -c "cd /repo/ci/scripts && ./acceptance-tests"
docker run --rm --privileged -v "$REPO_DIR":/repo -v "${DOCKER_SCRATCH}":/scratch/docker -e REPO_ROOT=/repo -e KEEP_RUNNING="" -e PARALLELISM="${PARALLELISM}" haproxy-boshrelease-testflight bash -c "cd /repo/ci/scripts && ./acceptance-tests"
echo "Cleaning up docker scratch: ${DOCKER_SCRATCH}"
sudo rm -rf "${DOCKER_SCRATCH}"
fi
13 changes: 9 additions & 4 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM bosh/docker-cpi:main
FROM ghcr.io/cloudfoundry/bosh/docker-cpi:latest

# Install all necessary tools for haproxy testflight and dependency autobump
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y wget jq git vim nano python3-pip && \
apt-get install -y wget jq git vim nano python3-pip python3-venv && \
apt-get clean

# Set bosh env at login
RUN echo "source /tmp/local-bosh/director/env" >> /root/.bashrc

# Copy ops files
COPY bosh-scaled-out.yml /usr/local/bosh-deployment/bosh-scaled-out.yml

# Install Python libraries needed for scripts
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
COPY scripts/requirements.txt /requirements.txt
RUN /usr/bin/python3 -m pip install -r /requirements.txt
RUN pip install -r /requirements.txt

# Install go dependencies
ENV GOBIN=/usr/local/bin
RUN go install github.com/geofffranks/spruce/cmd/spruce@latest
RUN go install github.com/geofffranks/spruce/cmd/spruce@latest
3 changes: 3 additions & 0 deletions ci/bosh-scaled-out.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- type: replace
path: /instance_groups/name=bosh/properties/director/workers?
value: 12
16 changes: 8 additions & 8 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
- in_parallel:
- { get: git, trigger: true, passed: [unit-tests] }
- { get: stemcell }
- { get: stemcell-bionic }
- { get: stemcell-jammy }
- get: haproxy-boshrelease-testflight
- task: acceptance-tests
privileged: true
Expand All @@ -131,7 +131,7 @@ jobs:
inputs:
- { name: git }
- { name: stemcell }
- { name: stemcell-bionic }
- { name: stemcell-jammy }
run:
path: ./git/ci/scripts/acceptance-tests
args: []
Expand All @@ -152,7 +152,7 @@ jobs:
- do:
- { get: git-pull-requests, trigger: true, version: every }
- { get: stemcell }
- { get: stemcell-bionic }
- { get: stemcell-jammy }
- get: haproxy-boshrelease-testflight
- put: git-pull-requests
params:
Expand All @@ -169,7 +169,7 @@ jobs:
inputs:
- { name: git-pull-requests }
- { name: stemcell }
- { name: stemcell-bionic }
- { name: stemcell-jammy }
run:
path: ./git-pull-requests/ci/scripts/acceptance-tests
args: []
Expand Down Expand Up @@ -403,15 +403,15 @@ resources:
- "dependabot"
- "CFN-CI"

- name: stemcell-bionic
- name: stemcell-jammy
type: bosh-io-stemcell
source:
name: bosh-warden-boshlite-ubuntu-bionic-go_agent
name: bosh-warden-boshlite-ubuntu-jammy-go_agent

- name: stemcell
type: bosh-io-stemcell
source:
name: bosh-warden-boshlite-ubuntu-jammy-go_agent
name: bosh-warden-boshlite-ubuntu-noble

- name: version
type: semver
Expand Down Expand Up @@ -453,7 +453,7 @@ resources:
- name: docker-cpi-image
type: docker-image
source:
repository: bosh/docker-cpi
repository: ghcr.io/cloudfoundry/bosh/docker-cpi

- name: git-ci
type: git
Expand Down
14 changes: 11 additions & 3 deletions ci/scripts/acceptance-tests
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ echo "----- Running tests"
export PATH=$PATH:$GOPATH/bin
ginkgo version

PARALLELISM="-p"
if [ -n "$FOCUS" ]; then
echo "------------------------------------------------------------------"
if [ -n "${FOCUS:-}" ]; then
PARALLELISM="--nodes=1"
echo "FOCUS is set, thus PARALLELISM is set to '$PARALLELISM'"
elif [ -n "${PARALLELISM:-}" ]; then
PARALLELISM="--nodes=$PARALLELISM"
echo "PARALLELISM is set. Will run ginkgo with '$PARALLELISM'"
else
PARALLELISM="-p"
echo "PARALLELISM is not set. Using default '$PARALLELISM'"
fi
echo "------------------------------------------------------------------"

ginkgo -v "$PARALLELISM" -r --trace --show-node-events --randomize-all --flake-attempts 5 "${ADDITIONAL_ARGS[@]}"

keep_running_info
keep_running_info
14 changes: 7 additions & 7 deletions ci/scripts/functions-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ function bosh_release() {
}

function bosh_assets() {
stemcell_jammy_path="$START_DIR/stemcell/*.tgz"
stemcell_bionic_path="$START_DIR/stemcell-bionic/*.tgz"
stemcell_noble_path="$START_DIR/stemcell/*.tgz"
stemcell_jammy_path="$START_DIR/stemcell-jammy/*.tgz"

echo "----- Uploading Noble stemcell"
bosh -n upload-stemcell $stemcell_noble_path

echo "----- Uploading Jammy stemcell"
bosh -n upload-stemcell $stemcell_jammy_path

echo "----- Uploading Bionic stemcell"
bosh -n upload-stemcell $stemcell_bionic_path

echo "----- Uploading os-conf (used for tests only)"
bosh -n upload-release --sha1 386293038ae3d00813eaa475b4acf63f8da226ef \
https://bosh.io/d/github.com/cloudfoundry/os-conf-release?v=22.1.2
bosh -n upload-release --sha1 sha256:efcf30754ce4c5f308aedab3329d8d679f5967b2a4c3c453204c7cb10c7c5ed9 \
https://bosh.io/d/github.com/cloudfoundry/os-conf-release?v=23.0.0

export BOSH_PATH=$(command -v bosh)
export BASE_MANIFEST_PATH="$PWD/manifests/haproxy.yml"
Expand Down
Loading