@eclass/semantic-release-docker-swarm
v2.0.0
Published
semantic-release plugin to deploy docker swarm service
Downloads
55
Readme
@eclass/semantic-release-docker-swarm
semantic-release plugin to deploy docker swarm service
| Step | Description |
| ------------------ | ------------------------------------------ |
| verifyConditions
| Verify the presence of the plugin options. |
| publish
| Deploy app. |
Install
npm i -D @eclass/semantic-release-docker-swarm
Usage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
"@eclass/semantic-release-docker-swarm"
]
}
Configuration
Options
| Variable | Description |
| ------------- | ------------------------------------------------------------------------------------------------ |
| dockerHost
| URI for connect to remote docker host. Required. Example: ssh://username@host
|
| service
| Name of the docker swarm service. Required. |
| image
| Name of docker image. Required. Example: registry.gitlab.com/mygroup/myapp
|
| updateOrder
| Order to update the service. Only start-first
or stop-first
. Optional. Default: stop-first
|
Examples
{
"plugins": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
[
"@semantic-release/exec",
{
"prepareCmd": "sh .release/buildimage.sh"
}
],
[
"@eclass/semantic-release-docker",
{
"baseImageName": "registry.gitlab.com/mygroup/myapp",
"registries": [
{
"url": "registry.gitlab.com",
"imageName": "registry.gitlab.com/mygroup/myapp",
"user": "CI_REGISTRY_USER",
"password": "CI_REGISTRY_PASSWORD"
}
]
}
],
[
"@eclass/semantic-release-docker-swarm",
{
"dockerHost": "ssh://username@host",
"services": [
{
"name": "mystack_myservice",
"image": "registry.gitlab.com/mygroup/myapp",
"updateOrder": "start-first"
},
{
"name": "mystack_myworker",
"image": "registry.gitlab.com/mygroup/myapp",
"updateOrder": "stop-first"
}
]
}
]
]
}
# .gitlab-ci.yml
release:
image: node:alpine
stage: release
script:
- npx semantic-release
only:
- master
# .travis.yml
language: node_js
cache:
directories:
- ~/.npm
node_js:
- '12'
stages:
- test
- name: deploy
if: branch = master
jobs:
include:
- stage: test
script: npm t
- stage: deploy
script: npx semantic-release