semantic-release-rancher

Set of semantic-release plugins for upgrade service in rancher

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
semantic-release-rancher
0402.1.24 years ago6 years agoMinified + gzip package size for semantic-release-rancher in KB

Readme

semantic-release-rancher
npm build downloads dependencies devDependency Status Maintainability semantic-release
Set of semantic-release plugins for upgrade service in Rancher.

| Step | Description | |--------------------|--------------------| | verifyConditions | Verify the presence and the validity of the rancher api key (set via environment variables). | | publish | Upgrade a service with a new version. |

Install

npm i -D semantic-release-rancher

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",
    "semantic-release-gitlab-registry",
    "semantic-release-rancher"
  ]
}

Example .gitlab-ci.yml
stages:
  - test
  - release

test:
  image: node:alpine
  stage: test
  before_script:
    - npm i
  script:
    - npm t

release:
  image: node:alpine
  stage: release
  before_script:
    - npm i
    - docker build -t $CI_REGISTRY_IMAGE .
  script:
    - npx semantic-release
  only:
    - master

Configuration

Environment variables

| Variable | Description | | --------------------- | ----------------------------------------------------------------------------- | | RANCHER_URL | Required. The url of rancher server. Example: https://rancher.example.com | | RANCHER_ENVIRONMENT | Required. The environment id. Example: 1a11 | | RANCHER_ACCESS_KEY | Required. The API access key. | | RANCHER_SECRET_KEY | Required. The API secret key. | | RANCHER_STACK | Required. The stack name. | | RANCHER_SERVICE | Required. The service name. | | RANCHER_SERVICES | Optional JSON array with objects stack/service to upgrade multiple services. Example: [{"stack": "myStack1", "service": "myService1"},{"stack": "myStack2", "service": "myService2"}] |

Options

| Variable | Description | | -------------------- | -------------------------------- | | rancherUrl | The url of rancher server. Example: https://rancher.example.com | | rancherEnvironment | The environment id. Example: 1a11 | | services | Array of object services. Example: [{"stack": "MyStack", "service": "MyService"}, {"stack": "MyStack", "service": "MyOtherService", "startFirst": false}] |

Examples

{
  "plugins": [
    "@semantic-release/changelog",
    "@semantic-release/npm",
    "@semantic-release/git",
    "@semantic-release/gitlab",
    "semantic-release-gitlab-registry",
    [
      "semantic-release-rancher",
      {
        "rancherUrl": "https://rancher.example.com",
        "rancherEnvironment": "1a11",
        "services": [
          {
            "stack": "MyStack",
            "service": "MyService"
          },
          {
            "stack": "MyStack",
            "service": "MyOtherService",
            "startFirst": false
          }
        ]
      }
    ]
  ]
}

License

MIT