feat: create deploy-esb action
This commit is contained in:
parent
f6549e5a5b
commit
5b6f2cfd28
3 changed files with 91 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ on:
|
|||
- aws-configure
|
||||
- cache
|
||||
- checkout
|
||||
- deploy-esb
|
||||
- download-artifact
|
||||
- helm-deploy
|
||||
- i18n-sync
|
||||
|
|
|
|||
30
esb-deploy/README.md
Normal file
30
esb-deploy/README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# esb-deploy
|
||||
|
||||
Deploy a service to an ESB docker host.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Required | Default | Description |
|
||||
|-------|----------|---------|-------------|
|
||||
| `docker-host` | Yes | - | esbdb3.schmalzgroup.net, esbdb4.schmalzgroup.net, esbdb2-stage.schmalzgroup.net|
|
||||
| `java-version` | Yes | 25 | Same as default of the maven-build action |
|
||||
| `maven-profile` | No | `test` | Maven profile to activate during deploy |
|
||||
| `maven-settings` | **Yes** | — | Secret containing the `settings.xml` content used for repository authentication |
|
||||
| `service-name` | Yes | — | Name of the service to deploy |
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/esb-deploy@esb-deploy-v1
|
||||
with:
|
||||
service-name: my-service
|
||||
docker-host: esbdocker2-stage.schmalzgroup.net
|
||||
java-version: 8
|
||||
maven-profile: test
|
||||
maven-settings: ${{ secrets.MAVEN_SETTINGS }}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The compose files are extracted from variables. They can be provided on the organization or repository level.
|
||||
- The action uses the maven-build action to build the service. The pom.xml has to be in the root directory
|
||||
60
esb-deploy/action.yml
Normal file
60
esb-deploy/action.yml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
name: Deploy ESB
|
||||
description: Deploy a service to an ESB docker host.
|
||||
|
||||
inputs:
|
||||
docker-host:
|
||||
description: Docker host to deploy to
|
||||
required: true
|
||||
maven-profile:
|
||||
required: false
|
||||
default: 'test'
|
||||
description: 'Maven profile to use for the build'
|
||||
maven-settings:
|
||||
description: Secret containing the settings.xml content used for repository authentication
|
||||
required: true
|
||||
java-version:
|
||||
description: Java version to use for the build
|
||||
required: true
|
||||
service:
|
||||
description: Name of the service to deploy
|
||||
required: false
|
||||
default: 'true'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create compose files
|
||||
shell: bash
|
||||
env:
|
||||
BASE_COMPOSE: ${{ vars.DOCKER_COMPOSE }}
|
||||
SU_COMPOSE: ${{ vars.DOCKER_COMPOSE_SU }}
|
||||
run: |
|
||||
printf '%s\n' "$BASE_COMPOSE" > compose.yml
|
||||
printf '%s\n' "$SU_COMPOSE" > compose-su.yml
|
||||
|
||||
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/maven-build@maven-build-v1
|
||||
with:
|
||||
phase: verify
|
||||
maven-settings: ${{ inputs.maven-settings }}
|
||||
verify-goals: clean package
|
||||
java-version: ${{ inputs.java-version }}
|
||||
|
||||
- name: Compose stage
|
||||
if: ${{ inputs.stage == 'true' }}
|
||||
shell: bash
|
||||
env:
|
||||
SERVICE: ${{ inputs.service }}
|
||||
run: |
|
||||
echo "Deploying $SERVICE to stage environment"
|
||||
export DOCKER_HOST="tcp://${{ inputs.docker-host }}:2375"
|
||||
docker compose -f compose.yml -f compose-su.yml up -d --build --no-deps "$SERVICE"
|
||||
|
||||
- name: Compose prod
|
||||
if: ${{ inputs.stage != 'true' }}
|
||||
shell: bash
|
||||
env:
|
||||
SERVICE: ${{ inputs.service }}
|
||||
run: |
|
||||
echo "Deploying $SERVICE to production environment"
|
||||
export DOCKER_HOST="tcp://${{ inputs.docker-host }}:2375"
|
||||
docker compose -f compose.yml up -d --build --no-deps "$SERVICE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue