ci: add integration container for samba and refactor duo (#3480)

This change utilises a specific integration container for the ActiveDirectory suite and simplifies the DuoPush suite.
pull/3481/head
Amir Zarrinkafsh 2022-06-05 03:51:33 +10:00 committed by GitHub
parent 74a7e96409
commit 9861467831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 40 additions and 22 deletions

View File

@ -37,12 +37,16 @@ if [[ "${BUILDKITE_LABEL}" =~ ":selenium:" ]]; then
if [[ "${BUILD_DUO}" == "true" ]] && [[ "${SUITE}" == "DuoPush" ]]; then
CONTAINER="integration-duo"
FILE="internal/suites/example/compose/duo-api/docker-compose.dist.yml"
FILE="internal/suites/example/compose/duo-api/docker-compose.yml"
INTEGRATION
elif [[ "${BUILD_HAPROXY}" == "true" ]] && [[ "${SUITE}" == "HAProxy" ]]; then
CONTAINER="integration-haproxy"
FILE="internal/suites/example/compose/haproxy/docker-compose.yml"
INTEGRATION
elif [[ "${BUILD_SAMBA}" == "true" ]] && [[ "${SUITE}" == "ActiveDirectory" ]]; then
CONTAINER="integration-samba"
FILE="internal/suites/example/compose/samba/docker-compose.yml"
INTEGRATION
fi
fi

View File

@ -22,6 +22,9 @@ if [[ "${BUILDKITE_PIPELINE_NAME}" == "integration-duo" ]]; then
elif [[ "${BUILDKITE_PIPELINE_NAME}" == "integration-haproxy" ]]; then
DIRECTORY="internal/suites/example/compose/haproxy"
GROUP="haproxy-deployments"
elif [[ "${BUILDKITE_PIPELINE_NAME}" == "integration-samba" ]]; then
DIRECTORY="internal/suites/example/compose/samba"
GROUP="samba-deployments"
fi
cat << EOF

View File

@ -6,12 +6,14 @@ DIVERGED=$(git merge-base --fork-point origin/master > /dev/null; echo $?)
if [[ "${DIVERGED}" == 0 ]]; then
if [[ "${BUILDKITE_TAG}" == "" ]]; then
if [[ "${BUILDKITE_BRANCH}" == "master" ]]; then
BUILD_DUO=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/duo-api/.* && echo true || echo false)
BUILD_DUO=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/duo-api/Dockerfile && echo true || echo false)
BUILD_HAPROXY=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/haproxy/Dockerfile && echo true || echo false)
BUILD_SAMBA=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/samba/Dockerfile && echo true || echo false)
CI_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|README\.md|SECURITY\.md|crowdin\.yml|\.all-contributorsrc|\.editorconfig|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
else
BUILD_DUO=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/duo-api/.* && echo true || echo false)
BUILD_DUO=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/duo-api/Dockerfile && echo true || echo false)
BUILD_HAPROXY=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/haproxy/Dockerfile && echo true || echo false)
BUILD_SAMBA=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/samba/Dockerfile && echo true || echo false)
CI_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|README\.md|SECURITY\.md|crowdin\.yml|\.all-contributorsrc|\.editorconfig|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
fi
@ -21,11 +23,13 @@ if [[ "${DIVERGED}" == 0 ]]; then
else
BUILD_DUO="false"
BUILD_HAPROXY="false"
BUILD_SAMBA="false"
CI_BYPASS="false"
fi
else
BUILD_DUO="false"
BUILD_HAPROXY="false"
BUILD_SAMBA="false"
CI_BYPASS="false"
fi
@ -33,6 +37,7 @@ cat << EOF
env:
BUILD_DUO: ${BUILD_DUO}
BUILD_HAPROXY: ${BUILD_HAPROXY}
BUILD_SAMBA: ${BUILD_SAMBA}
CI_BYPASS: ${CI_BYPASS}
steps:
@ -83,6 +88,21 @@ cat << EOF
depends_on: ~
EOF
fi
if [[ "${BUILD_SAMBA}" == "true" ]]; then
cat << EOF
- label: ":rocket: Trigger Pipeline [integration-samba]"
trigger: "integration-samba"
build:
message: "${BUILDKITE_MESSAGE}"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
env:
BUILDKITE_PULL_REQUEST: "${BUILDKITE_PULL_REQUEST}"
BUILDKITE_PULL_REQUEST_BASE_BRANCH: "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
BUILDKITE_PULL_REQUEST_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
depends_on: ~
EOF
fi
cat << EOF
- label: ":docker: Build Image [coverage]"
command: "authelia-scripts docker build --container=coverage"

View File

@ -35,9 +35,9 @@ cat << EOF
agents:
suite: "all"
EOF
fi
cat << EOF
env:
SUITE: "${SUITE_NAME}"
EOF
fi
done

View File

@ -5,8 +5,6 @@ WORKDIR /usr/app/src
ADD package.json package.json
RUN yarn install --frozen-lockfile --production --silent
ADD duo_api.js duo_api.js
EXPOSE 3000
CMD ["node", "duo_api.js"]

View File

@ -1,9 +0,0 @@
---
version: '3'
services:
duo-api:
build:
context: ./example/compose/duo-api
networks:
- authelianet
...

View File

@ -3,6 +3,8 @@ version: '3'
services:
duo-api:
image: authelia/integration-duo
volumes:
- ./example/compose/duo-api/duo_api.js:/usr/app/src/duo_api.js
networks:
- authelianet
...

View File

@ -8,5 +8,4 @@ apk add --no-cache \
samba-dc \
supervisor
ADD init.sh /init.sh
CMD /init.sh setup

View File

@ -2,8 +2,9 @@
version: '3'
services:
sambaldap:
build:
context: ./example/compose/samba
image: authelia/integration-samba
volumes:
- ./example/compose/samba/init.sh:/init.sh
cap_add:
- SYS_ADMIN
hostname: ldap.example.com

View File

@ -16,7 +16,7 @@ func init() {
"internal/suites/example/compose/authelia/docker-compose.frontend.{}.yml",
"internal/suites/example/compose/nginx/backend/docker-compose.yml",
"internal/suites/example/compose/nginx/portal/docker-compose.yml",
"internal/suites/example/compose/duo-api/docker-compose.{}.yml",
"internal/suites/example/compose/duo-api/docker-compose.yml",
})
setup := func(suitePath string) error {