1.4.26 • Published 5 months ago

@kelsus/api-spot-package v1.4.26

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Kelsus Spot API Package

BORRAR

Description

Post deploy script for Kelsus Spot

Spot Repository

  • Once the script is executed, it will send a POST request to the Spot API
  • This request will generate a new service/application with an activity.
  • On the app you will be able to assign the service to a client, and on each deploy it will trigger the script again, generating a new activity.
  • The script supports differents environments for the same app.
  • Support for different CIs

How to use it

Set the SPOT_API_KEY environment variable. (Ask Spot team members to provide it).

Call the service either by

  1. Using NPX from a CLI, passing arguments if needed:
npx @kelsus/api-spot-package
  1. Or installing this package on you deployer and then invoking main():
const SPOT = require('@kelsus/api-spot-package')

SPOT.main(args)

Dry run mode

If you just want to try out the execution safely without making any external calls to SPOT API, you can do it so by simply passing the --dryRun flag. You should see logs with [DRY RUN MODE] label to confirm that is beign executed in dry run mode. For example:

npx @kelsus/api-spot-package --dryRun

Or on your local, after cloning this repo, try:

node ./bin/npx.js --dryRun

Execute

Run the npx command with optional args to execute the post deploy script.

npx @kelsus/api-spot-package

Parameters

For CI

The Spot script takes variables from differents CIs in order to fill the data that will be sent to the API.

  • SEED:
    • application: "SEED_APP_NAME",
    • service: "SEED_SERVICE_NAME",
    • environment: "SEED_STAGE_NAME",
    • version: "SEED_BUILD_ID",
  • CircleCI:
    • service: "CIRCLE_PROJECT_REPONAME",
    • environment: "CIRCLE_BRANCH",
    • version: "CIRCLE_BUILD_NUM",
    • repoUrl: "CIRCLE_REPOSITORY_URL"
  • Netlify:
    • url: "URL",
    • application: "SITE_NAME",
    • environment: "CONTEXT",
    • version: "BUILD_ID",
  • Amplify:
    • environment: "AWS_BRANCH",
    • version: "AWS_JOB_ID"

Allowed args parameters

You can still customize parameters calling them on the npx execution.

e.g:

npx @kelsus/api-spot-package --service=api-spot-package
--id
--eventType
--createdAt
--commitId
--commitBranch
--commitMessage
--commitDate
--application
--service
--status
--environment
--version
--serviceType
--runtime
--runtimeVersion
--ciRuntime
--ciRuntimeVersion
--serviceUrl
--repoUrl
--lastDeploy
--changelog
--organization

Alternative Env Variables

In case that you want to overwrite data, Spot will look for these Env Variables

- application = "APP_NAME"
- service = "SERVICE_NAME"
- environment = "ENVIRONMENT_NAME"
- status = "BUILD_STATUS"
- version = "VERSION"
- url = "APP_URL"

Call the function

  • npm install @kelsus/api-spot-package
  • When configuring the installation on the CI, it is recomended to set the flag engine-strict true so it will be installed only when Node engine version is supported. Ref: https://docs.npmjs.com/cli/v9/using-npm/config#engine-strict
  • You can invoke the main() function with require('@kelsus/api-spot-package') and pass the parameters through the function.
  • E.g:
// Require package
const SPOT = require('@kelsus/api-spot-package');

//Call the function an pass parameters as an object
SPOT.main({application: 'api-spot-package', env: 'develop'});

Request body

activity: 
    {
        id,
        service,
        eventType,
        createdAt,
        commitId,
        commitMessage,
        commitDate,
        commitBranch,
        application,
        status,
        environment,
        version,
        serviceType,
        runtime,
        runtimeVersion,
        ciRuntime,
        ciRuntimeVersion,
        serviceUrl,
        repoUrl,
        lastDeploy,
        changelog,
        organization,
        dependencies,
        devDependencies,
    }

Publish a new version

  • Publishing is automated via CircleCI as well as versioning: everytime a commit is merged into main branch auto version bump will be executed (patch semver bump).

  • After pushing a new version, you can check the changelog on https://spot.kelsus.com/

CircleCI Environment Variables

Circle is used as the Continuous Integration service: Running test, build, publish on npm and notifying to spot: https://app.circleci.com/pipelines/github/Kelsus/api-spot-package

NPM_TOKEN: NPM personal access token.
SSH_KEY_FINGERPRINT: fingerprint generated with github ssh deploy key
SPOT_API_KEY: used to notify spot
1.4.26

5 months ago

1.4.25

5 months ago

1.4.20

9 months ago

1.4.22

8 months ago

1.4.21

8 months ago

1.4.24

8 months ago

1.4.23

8 months ago

1.4.19

11 months ago

1.4.13

1 year ago

1.4.12

1 year ago

1.4.15

1 year ago

1.4.14

1 year ago

1.4.17

1 year ago

1.4.16

1 year ago

1.4.18

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.9

1 year ago

1.4.11

1 year ago

1.4.8

1 year ago

1.4.10

1 year ago

1.4.7

1 year ago

1.2.8

2 years ago

1.4.1

1 year ago

1.3.10

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.11

1 year ago

1.3.12

1 year ago

1.3.17

1 year ago

1.3.18

1 year ago

1.3.15

1 year ago

1.3.16

1 year ago

1.3.19

1 year ago

1.3.20

1 year ago

1.3.21

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.24

1 year ago

1.3.25

1 year ago

1.2.13

2 years ago

1.3.22

1 year ago

1.2.10

2 years ago

1.3.23

1 year ago

1.2.11

2 years ago

1.3.28

1 year ago

1.3.29

1 year ago

1.3.26

1 year ago

1.2.14

2 years ago

1.3.27

1 year ago

1.2.15

2 years ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.3.31

1 year ago

1.3.32

1 year ago

1.3.30

1 year ago

1.3.35

1 year ago

1.3.33

1 year ago

1.3.34

1 year ago

1.3.39

1 year ago

1.3.37

1 year ago

1.3.38

1 year ago

1.3.42

1 year ago

1.3.43

1 year ago

1.3.40

1 year ago

1.3.41

1 year ago

1.2.9

2 years ago

1.3.46

1 year ago

1.3.47

1 year ago

1.3.44

1 year ago

1.3.45

1 year ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago