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
80 changes: 33 additions & 47 deletions .circle/docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,41 @@

set -e
# Source the build environment defintion (details in buildenv.sh)
# shellcheck disable=SC1090
. ~/.buildenv

# Used for `RABBITMQHOST`, `MONGODBHOST`, and `REDISHOST` see docker-compose.override.yml
HOST_IP=$(ifconfig docker0 | grep 'inet addr' | awk -F: '{print $2}' | awk '{print $1}')

set -x
case "$1" in
# Perform fake command invocation, technically provides images "pull" phase.
pull)
echo Pulling dependent Docker images for $2 ...
docker-compose -f docker-compose.circle.yml run \
-e ST2_GITURL=${ST2_GITURL} \
-e ST2_GITREV=${ST2_GITREV} \
-e ST2PKG_VERSION=${ST2PKG_VERSION} \
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
-e RABBITMQHOST=${HOST_IP} \
-e MONGODBHOST=${HOST_IP} \
-e REDISHOST=${HOST_IP} \
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
$2 /bin/true
;;
build)
echo Starting Packages Build for $2 ...
docker-compose -f docker-compose.circle.yml run \
-e ST2_GITURL=${ST2_GITURL} \
-e ST2_GITREV=${ST2_GITREV} \
-e ST2PKG_VERSION=${ST2PKG_VERSION} \
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
-e RABBITMQHOST=${HOST_IP} \
-e MONGODBHOST=${HOST_IP} \
-e REDISHOST=${HOST_IP} \
-e ST2_PACKAGES="${ST2_PACKAGES}" \
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
$2 build
;;
test)
[ "$TESTING" = 0 ] && { echo "Omitting Tests for $2 ..." ; exit 0; }
echo Starting Tests for $2 ...
docker-compose -f docker-compose.circle.yml run \
-e ST2_GITURL=${ST2_GITURL} \
-e ST2_GITREV=${ST2_GITREV} \
-e ST2PKG_VERSION=${ST2PKG_VERSION} \
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
-e RABBITMQHOST=${HOST_IP} \
-e MONGODBHOST=${HOST_IP} \
-e REDISHOST=${HOST_IP} \
-e ST2_PACKAGES="${ST2_PACKAGES}" \
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
$2 test
;;
clean)
# Clean up cached Docker containers from the previous CircleCI build
# With https://circleci.com/docs/2.0/docker-layer-caching/ and 'reusable: true' we may see
# containers running from the previous cached build
echo "Cleaning cached Docker containers which could be there from the previous build ..."
docker compose -f docker-compose.circle.yml -f docker-compose.override.yml rm -v --stop --force || true
;;
pull)
# Perform fake command invocation, technically provides images "pull" phase.
echo "Pulling dependent Docker images for $2 ..."
docker compose -f docker-compose.circle.yml -f docker-compose.override.yml pull --include-deps "$2"
;;
build)
echo "Starting Packages Build for $2 ..."
docker compose -f docker-compose.circle.yml -f docker-compose.override.yml run \
-e ST2_CHECKOUT=${ST2_CHECKOUT} \
-e ST2_GITURL=${ST2_GITURL} \
-e ST2_GITREV=${ST2_GITREV} \
-e ST2_GITDIR=${ST2_GITDIR} \
-e ST2PKG_VERSION=${ST2PKG_VERSION} \
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
-e ST2_PACKAGES="${ST2_PACKAGES}" \
-e ST2_CIRCLE_URL="${CIRCLE_BUILD_URL}" \
"$2" build
;;
test)
[ "$TESTING" = 0 ] && { echo "Omitting Tests for $2 ..." ; exit 0; }
echo "Starting Tests for $2 ..."
docker compose -f docker-compose.circle.yml -f docker-compose.override.yml run \
-e ST2_PACKAGES="${ST2_PACKAGES}" \
"$2" test
;;
esac

49 changes: 0 additions & 49 deletions .circle/docker-compose2.sh

This file was deleted.

14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
resource_class: large
docker:
# The primary container is an instance of the first list image listed. Your build commands run in this container.
- image: circleci/python:3.8
- image: cimg/python:3.8
working_directory: ~/st2-packages
environment:
DISTROS: "focal jammy el8 el9"
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
command: |
set -x
# Clean-up running containers
.circle/docker-compose2.sh clean
.circle/docker-compose.sh clean
# Remove st2-packages-vol container
docker rm -v --force st2-packages-vol || true
# Clean-up any created volumes
Expand All @@ -82,21 +82,21 @@ jobs:
docker cp ~/st2-packages st2-packages-vol:/root
- run:
name: Pull dependent Docker Images
command: .circle/docker-compose2.sh pull ${DISTRO} || .circle/docker-compose2.sh pull ${DISTRO}
command: .circle/docker-compose.sh pull ${DISTRO} || .circle/docker-compose.sh pull ${DISTRO}
- run:
name: Build the ${DISTRO} Packages
command: |
# Create necessary directories
mkdir -p ~/st2-packages/build/${DISTRO}/log/

# Run the build
.circle/docker-compose2.sh build ${DISTRO}
.circle/docker-compose.sh build ${DISTRO}

# Once build container finishes we can copy packages directly from it
docker cp st2-packages-vol:/root/build/. ~/st2-packages/build/${DISTRO}
- run:
name: Test the Packages
command: .circle/docker-compose2.sh test ${DISTRO}
command: .circle/docker-compose.sh test ${DISTRO}
- run:
when: always
name: Grab the st2 logs
Expand All @@ -118,7 +118,7 @@ jobs:
command: |
set -x
# Clean-up running containers
.circle/docker-compose2.sh clean
.circle/docker-compose.sh clean
# Remove st2-packages-vol container
docker rm -v --force st2-packages-vol || true
# Clean-up any created volumes
Expand All @@ -128,7 +128,7 @@ jobs:
deploy:
docker:
# The primary container is an instance of the first list image listed. Your build commands run in this container.
- image: circleci/ruby:2.7
- image: cimg/ruby:2.7
working_directory: /tmp/deploy
environment:
- DISTROS: "focal jammy el8 el9"
Expand Down
59 changes: 30 additions & 29 deletions docker-compose.circle.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: "3.8"
services:
focal:
image: quay.io/stackstorm/packagingrunner
extends:
file: docker-compose.override.yml
service: suite-compose
working_dir: /root/st2-packages
volumes_from:
- container:st2-packages-vol
environment:
- BUILDNODE=focalbuild
- TESTNODE=focaltest
Expand All @@ -18,9 +17,9 @@ services:

jammy:
image: quay.io/stackstorm/packagingrunner
extends:
file: docker-compose.override.yml
service: suite-compose
working_dir: /root/st2-packages
volumes_from:
- container:st2-packages-vol
environment:
- BUILDNODE=jammybuild
- TESTNODE=jammytest
Expand All @@ -34,13 +33,12 @@ services:

el8:
image: quay.io/stackstorm/packagingrunner
extends:
file: docker-compose.override.yml
service: suite-compose
working_dir: /root/st2-packages
volumes_from:
- container:st2-packages-vol
environment:
- BUILDNODE=rockylinux8build
- TESTNODE=rockylinux8test
- ST2_PACKAGES=st2
links:
- rockylinux8build
- rockylinux8test
Expand All @@ -50,13 +48,12 @@ services:

el9:
image: quay.io/stackstorm/packagingrunner
extends:
file: docker-compose.override.yml
service: suite-compose
working_dir: /root/st2-packages
volumes_from:
- container:st2-packages-vol
environment:
- BUILDNODE=rockylinux9build
- TESTNODE=rockylinux9test
- ST2_PACKAGES=st2
links:
- rockylinux9build
- rockylinux9test
Expand All @@ -65,64 +62,68 @@ services:
- redis

## Package build nodes
#
focalbuild:
image: stackstorm/packagingbuild:focal
volumes_from:
- st2-packages-vol
- container:st2-packages-vol

jammybuild:
image: stackstorm/packagingbuild:jammy
volumes_from:
- st2-packages-vol
- container:st2-packages-vol

rockylinux8build:
image: stackstorm/packagingbuild:rockylinux8
extends:
file: docker-compose.override.yml
service: volumes-compose
volumes_from:
- container:st2-packages-vol

rockylinux9build:
image: stackstorm/packagingbuild:rockylinux9
extends:
file: docker-compose.override.yml
service: volumes-compose
volumes_from:
- container:st2-packages-vol

## Package testing nodes
#
focaltest:
image: stackstorm/packagingtest:focal-systemd
privileged: true
cgroup: host
volumes_from:
- st2-packages-vol
- container:st2-packages-vol
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup

jammytest:
image: stackstorm/packagingtest:jammy-systemd
privileged: true
cgroup: host
volumes_from:
- st2-packages-vol
- container:st2-packages-vol
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup

rockylinux8test:
image: stackstorm/packagingtest:rockylinux8-systemd
privileged: true
cgroup: host
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined
volumes_from:
- container:st2-packages-vol
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup

rockylinux9test:
image: stackstorm/packagingtest:rockylinux9-systemd
privileged: true
cgroup: host
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined
volumes_from:
- container:st2-packages-vol
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup

Expand Down
Loading