Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
Open
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
114 changes: 104 additions & 10 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Build Packages
on: [ push ]
permissions:
contents: write
jobs:
build-deb-20-04:
name: Build DEB package (Ubuntu 20.04)
Expand All @@ -11,7 +13,7 @@ jobs:
sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools
sudo gem install fpm
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build package
run: >
fpm --input-type python \
Expand All @@ -29,7 +31,7 @@ jobs:
--depends systemd \
setup.py
- name: Save artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: DEB package (Ubuntu 20.04)
path: |
Expand All @@ -45,7 +47,7 @@ jobs:
sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools
sudo gem install fpm
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build package
run: >
fpm --input-type python \
Expand All @@ -62,12 +64,45 @@ jobs:
--depends systemd \
setup.py
- name: Save artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: DEB package (Ubuntu 22.04)
path: |
*.deb

build-deb-24-04:
name: Build DEB package (Ubuntu 24.04)
runs-on: ubuntu-24.04
steps:
- name: Install fpm
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools
sudo gem install fpm
- name: Check out repository code
uses: actions/checkout@v4
- name: Build package
run: >
fpm --input-type python \
--output-type deb \
--python-bin=python3 \
--python-install-bin /usr/bin \
--deb-systemd debian/systemd-resolved-docker.service \
--no-auto-depends \
--depends python3-docker \
--depends python3-dnslib \
--depends python3-dbus \
--depends python3-pyroute2 \
--depends python3-systemd \
--depends systemd \
setup.py
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: DEB package (Ubuntu 24.04)
path: |
*.deb

build-rpm:
name: Build RPM package
runs-on: ubuntu-22.04
Expand All @@ -77,26 +112,26 @@ jobs:
- name: Install tito
run: dnf install -y tito python3-devel
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List contents
run: git config --global --add safe.directory $(pwd)
- name: Build package
run: tito build --rpm --offline --test
- name: Save artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: RPM package
path: |
/tmp/tito/noarch/*.rpm

tests:
name: Run tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install packages
run: |
sudo apt-get update
Expand All @@ -111,7 +146,7 @@ jobs:
- build-deb-20-04
steps:
- name: Download DEB package
uses: actions/download-artifact@master
uses: actions/download-artifact@v4
with:
name: DEB package (Ubuntu 20.04)
path: /tmp
Expand All @@ -133,7 +168,7 @@ jobs:
- build-deb-22-04
steps:
- name: Download DEB package
uses: actions/download-artifact@master
uses: actions/download-artifact@v4
with:
name: DEB package (Ubuntu 22.04)
path: /tmp
Expand All @@ -147,3 +182,62 @@ jobs:
run: resolvectl status
- name: Test Query
run: resolvectl query test-container.docker

test-deb-24-04:
name: Test DEB package (Ubuntu 24.04)
runs-on: ubuntu-24.04
needs:
- build-deb-24-04
steps:
- name: Download DEB package
uses: actions/download-artifact@v4
with:
name: DEB package (Ubuntu 24.04)
path: /tmp
- name: Install package
run: sudo apt install /tmp/python-systemd-resolved-docker_*.deb
- name: Start service
run: sudo systemctl start systemd-resolved-docker
- name: Start continaer
run: docker run --detach --interactive --hostname test-container alpine
- name: resolvectl status
run: resolvectl status
- name: Test Query
run: resolvectl query test-container.docker

upload-artifacts-to-release:
name: Upload artifacts to release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build-rpm
- tests
- test-deb-20-04
- test-deb-22-04
- test-deb-24-04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: all-artifacts
- name: Rename Ubuntu deb packages
shell: bash
run: |
cd "all-artifacts/DEB package (Ubuntu 24.04)" || exit 1
FILENAME_24_04="$(ls python-systemd-resolved-docker_*_all.deb)"
mv "${FILENAME_24_04}" "${FILENAME_24_04/_all/_24.04_all}"
cd - || exit 1
cd "all-artifacts/DEB package (Ubuntu 22.04)" || exit 1
FILENAME_22_04="$(ls python-systemd-resolved-docker_*_all.deb)"
mv "${FILENAME_22_04}" "${FILENAME_22_04/_all/_22.04_all}"
cd - || exit 1
cd "all-artifacts/DEB package (Ubuntu 20.04)" || exit 1
FILENAME_20_04="$(ls python-systemd-resolved-docker_*_all.deb)"
mv "${FILENAME_20_04}" "${FILENAME_20_04/_all/_20.04_all}"
cd - || exit 1
- name: Upload artifacts
uses: softprops/action-gh-release@v2
with:
files: |
all-artifacts/*/*.deb
all-artifacts/*/*.rpm
28 changes: 21 additions & 7 deletions test/integration/test_compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
. ./functions.sh

exec 10<<EOF
version: "2.1"
services:
webserver:
image: nginx
Expand All @@ -29,7 +28,6 @@ networks:
EOF

exec 20<<EOF
version: "2.1"
services:
broker:
image: redis
Expand All @@ -48,13 +46,24 @@ networks:
driver: default
EOF

echo 'Before ALLOWED_DOMAINS'

ALLOWED_DOMAINS=.docker,.$TEST_PREFIX start_systemd_resolved_docker

docker-compose --file /dev/fd/10 --project-name $TEST_PREFIX up --detach --scale webserver=2
echo 'After ALLOWED_DOMAINS'
echo 'Before first docker compose'

docker compose --file /dev/fd/10 --project-name $TEST_PREFIX up --detach --scale webserver=2

echo 'After first docker compose'
echo "Before docker_ip ${TEST_PREFIX}-broker-1"

broker1_ip=$(docker_ip ${TEST_PREFIX}_broker_1)
webserver1_ip=$(docker_ip ${TEST_PREFIX}_webserver_1)
webserver2_ip=$(docker_ip ${TEST_PREFIX}_webserver_2)
broker1_ip=$(docker_ip ${TEST_PREFIX}-broker-1)
echo "broker1_ip is ${broker1_ip}"
webserver1_ip=$(docker_ip ${TEST_PREFIX}-webserver-1)
echo "webserver1_ip is ${webserver1_ip}"
webserver2_ip=$(docker_ip ${TEST_PREFIX}-webserver-2)
echo "webserver2_ip is ${webserver2_ip}"

query_ok broker.$TEST_PREFIX $broker1_ip
query_ok 1.broker.$TEST_PREFIX $broker1_ip
Expand All @@ -66,5 +75,10 @@ query_ok 2.webserver.$TEST_PREFIX $webserver2_ip

query_ok broker.docker $broker1_ip

docker-compose --file /dev/fd/20 --project-name ${TEST_PREFIX}_2 up --detach
echo 'Before second docker compose'

docker compose --file /dev/fd/20 --project-name ${TEST_PREFIX}_2 up --detach

echo 'After second docker compose'

query_fail broker.docker