Skip to content

Commit

Permalink
LDEV-4979 GHA use alternate workflows for docker services
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 11, 2024
1 parent 03d62c1 commit b2c89f2
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 62 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-services-no-credentials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Load Services via Docker

on:
workflow_call:

jobs:
start-services:
runs-on: ubuntu-latest
services:
ldap:
# image: kwart/ldap-server
image: rroemhild/test-openldap
ports:
- 10389:10389
- 10636:10636
sql-server:
# Docker Hub image
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_PID: Express
ACCEPT_EULA: Y
SA_PASSWORD: Lucee!1433 # password must be complex or the service won't start
ports:
- 1433:1433
options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
greenmail:
image: greenmail/standalone:1.6.9
ports:
- 3025:3025 #SMTP
- 3110:3110 #POP3
- 3143:3143 #IMAP
- 3465:3465 #SMTPS
- 3993:3993 #IMAPS
- 3995:3995 #POP3S
- 8080:8080 #API
mongo:
image: mongo-express
memcached:
image: bitnami/memcached:latest
67 changes: 67 additions & 0 deletions .github/workflows/build-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Load Docker Images

on:
workflow_call:
workflow_dispatch:

jobs:
start-services:
runs-on: ubuntu-latest
services:
ldap:
# image: kwart/ldap-server
image: rroemhild/test-openldap
ports:
- 10389:10389
- 10636:10636
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
sql-server:
# Docker Hub image
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_PID: Express
ACCEPT_EULA: Y
SA_PASSWORD: Lucee!1433 # password must be complex or the service won't start
ports:
- 1433:1433
options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
greenmail:
image: greenmail/standalone:1.6.9
ports:
- 3025:3025 #SMTP
- 3110:3110 #POP3
- 3143:3143 #IMAP
- 3465:3465 #SMTPS
- 3993:3993 #IMAPS
- 3995:3995 #POP3S
- 8080:8080 #API
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
mongo:
image: mongo-express
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
memcached:
image: bitnami/memcached:latest
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
78 changes: 16 additions & 62 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,63 +28,24 @@ jobs:
DO_DEPLOY: "${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/6.1') }}"
LUCEE_BUILD_JAVA_VERSION: 21
LUCEE_TEST_JAVA_VERSION: ''
services:
ldap:
# image: kwart/ldap-server
image: rroemhild/test-openldap
ports:
- 10389:10389
- 10636:10636
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
sql-server:
# Docker Hub image
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_PID: Express
ACCEPT_EULA: Y
SA_PASSWORD: Lucee!1433 # password must be complex or the service won't start
ports:
- 1433:1433
options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
greenmail:
image: greenmail/standalone:1.6.9
ports:
- 3025:3025 #SMTP
- 3110:3110 #POP3
- 3143:3143 #IMAP
- 3465:3465 #SMTPS
- 3993:3993 #IMAPS
- 3995:3995 #POP3S
- 8080:8080 #API
credentials:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
steps:
# when workflow is run via a workflow_call, these vars are found under input, which doesn't exist otherwise
# so lets copy them over to the normal env vars

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}
- name: Check for Docker Hub secrets (DOCKERHUB_PUBLIC_USERNAME, DOCKERHUB_PUBLIC_TOKEN)
run: |
if [[ ! -z "$DOCKERHUB_PUBLIC_USERNAME" ]]; then
echo "Docker hub credentials defined"
else
echo "No Docker hub credentials defined, you may be rate limited"
fi
env:
DOCKERHUB_PUBLIC_USERNAME: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}

- name: Start Docker Services (with credentials)
if: ${{ env.DOCKERHUB_PUBLIC_USERNAME != '' }}
uses: ./.github/workflows/build-services.yml
- name: Start Docker Services (without credentials)
if: ${{ env.DOCKERHUB_PUBLIC_USERNAME != '' }}
uses: ./.github/workflows/build-services-no-credentials.yml

- name: Configure Build Java Version
if: ${{ inputs.LUCEE_BUILD_JAVA_VERSION != '' }}
Expand Down Expand Up @@ -152,13 +113,6 @@ jobs:
sudo -u postgres psql -c 'create database lucee;'
sudo -u postgres psql -c "create user lucee with encrypted password 'lucee'";
sudo -u postgres psql -c 'grant all privileges on database lucee to lucee;'
- name: Start MongoDB (docker)
uses: supercharge/[email protected]
with:
mongodb-version: 4.4
mongodb-port: 27017
- name: Setup Memcached (docker)
uses: niden/actions-memcached@v7
- name: Extract version number
id: extract-version
run: |
Expand Down

0 comments on commit b2c89f2

Please sign in to comment.