npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

screwdriver-template-main

v2.9.0

Published

Validates, publishes, and tags templates

Downloads

634

Readme

template-main

Version Downloads Build Status Open Issues License

Validates and publishes templates

Usage

npm install screwdriver-template-main

Create a Screwdriver pipeline with your template repo and start the build to validate and publish it.

To update a Screwdriver template, make changes in your SCM repository and rerun the pipeline build.

Validating a template

Run the template-validate script. By default, the path ./sd-template.yaml will be read. However, a user can specify a custom path using the env variable: SD_TEMPLATE_PATH.

Example screwdriver.yaml:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - install: npm install screwdriver-template-main
            - validate: ./node_modules/.bin/template-validate
        environment:
            SD_TEMPLATE_PATH: ./path/to/template.yaml

template-validate can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/template-validate --json
{"valid":true}

Publishing a template

Run the template-publish script. By default, the path ./sd-template.yaml will be read. However, a user can specify a custom path using the env variable: SD_TEMPLATE_PATH.

Example screwdriver.yaml with validation and publishing:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - install: npm install screwdriver-template-main
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - install: npm install screwdriver-template-main
            - publish: ./node_modules/.bin/template-publish --tag stable

template-publish can print a result as json by passing --json option to the command. template-publish will tag the published version as well. The default tag is latest if none is specified.

$ ./node_modules/.bin/template-publish --json
{name:"template/foo",version:"1.2.3",tag:"stable"}

Removing a template

To remove a template, run the template-remove script. You'll need to add an argument for the template name. Removing a template will remove all of its versions.

Example screwdriver.yaml with validation and publishing, and template removal as a detached job:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - install: npm install screwdriver-template-main
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - install: npm install screwdriver-template-main
            - publish: ./node_modules/.bin/template-publish
    remove_template:
        steps:
            - install: npm install screwdriver-template-main
            - remove: ./node_modules/.bin/template-remove --name templateName

template-remove can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/template-remove --json --name templateName
{"name":"templateName"}

Removing a template version

To remove a specific version of a template, run the template-remove-version binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and version as arguments. Removing a template version will remove all the tags associated with it.

Example screwdriver.yaml with validation, publishing and tagging, and version removal as a detached job:

shared:
    image: node:18
    steps:
        - init: npm install screwdriver-template-main
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - publish: ./node_modules/.bin/template-publish
            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest
    detached_remove_version:
        steps:
            - remove: ./node_modules/.bin/template-remove-version --name templateName --version 1.0.0

template-remove-version can print a result as json by passing --json option to the command.

Tagging a template

Optionally, tag a template using the template-tag script. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag. You can optionally specify a version; the version must be an exact version, not just a major or major.minor one. If omitted, the latest version will be tagged.

Example screwdriver.yaml with validation and publishing and tagging:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - install: npm install screwdriver-template-main
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - install: npm install screwdriver-template-main
            - publish: ./node_modules/.bin/template-publish
            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.2.3 --tag stable

template-tag can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/template-tag --json --name templateName --version 1.2.3 --tag stable
{"name":"templateName","tag":"stable","version":"1.2.3"}

Removing a template tag

To remove a template tag, run the template-remove-tag binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and tag as arguments.

Example screwdriver.yaml with validation, publishing and tagging, and tag removal as a detached job:

shared:
    image: node:18
    steps:
        - init: npm install screwdriver-template-main
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - publish: ./node_modules/.bin/template-publish
            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest
    detached_remove_tag:
        steps:
            - remove: ./node_modules/.bin/template-remove-tag --name templateName --tag latest

template-remove-tag can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/template-remove-tag --json --name templateName --tag stable
{"name":"templateName","tag":"stable"}

Getting the version from a template tag

To get the version from a template tag, run the template-get-version-from-tag binary. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag.

Example screwdriver.yaml with validation, publishing and tagging, and getting a version as a detached job:

shared:
    image: node:18
    steps:
        - init: npm install screwdriver-template-main
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: ./node_modules/.bin/template-validate
    publish:
        requires: main
        steps:
            - publish: ./node_modules/.bin/template-publish
            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest
    detached_get_version_from_tag:
        steps:
            - get_version: ./node_modules/.bin/template-get-version-from-tag --name templateName --tag latest

Pipeline Templates

Validating a template

Run the pipeline-template-validate script. By default, the path ./sd-template.yaml will be read. However, a user can specify a custom path using the env variable: SD_TEMPLATE_PATH.

Example screwdriver.yaml:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
        environment:
            SD_TEMPLATE_PATH: ./path/to/pipeline-template.yaml

pipeline-template-validate can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/pipeline-template-validate --json
{"valid":true}

Usage with npx

$ npx -y -p screwdriver-template-main pipeline-template-validate
{"valid":true}

Publishing a pipeline template

Run the pipeline-template-publish script. By default, the path ./sd-template.yaml will be read. However, a user can specify a custom path using the env variable: SD_TEMPLATE_PATH.

Example screwdriver.yaml with validation and publishing:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: npx -y -p screwdriver-template-main pipeline-template-publish --tag stable

pipeline-template-publish can print a result as json by passing --json option to the command. pipeline-template-publish will tag the published version as well. The default tag is latest if none is specified.

$ ./node_modules/.bin/pipeline-template-publish --json
{namespace:"template", name:"foo",version:"1.2.3",tag:"stable"}

Usage with npx

$ npx -y -p screwdriver-template-main pipeline-template-publish --json
{namespace:"template", name:"foo",version:"1.2.3",tag:"stable"}

Removing a template

To remove a template, run the pipeline-template-remove script. You'll need to add an argument for the template namespace, name. Removing a template will remove all of its versions and tags.

Example screwdriver.yaml with validation and publishing, and template removal as a detached job:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: npx -y -p screwdriver-template-main pipeline-template-publish
    remove_template:
        steps:
            - remove: npx -y -p screwdriver-template-main pipeline-template-remove --namespace templateNamespace --name templateName

pipeline-template-remove can print a result as json by passing --json option to the command.

$ ./node_modules/.bin/pipeline-template-remove --json --namespace templateNamespace --name templateName 
{"namespace":"templateNamespace", "name":"templateName"}

Usage with npx

$ npx -y -p screwdriver-template-main pipeline-template-remove --json --namespace templateNamespace --name templateName 
{"namespace":"templateNamespace", "name":"templateName"}

Removing a pipeline template version

To remove a specific version of a template, run the pipeline-template-remove-version binary. This must be done in the same pipeline that published the template. You'll need to specify the template namespace, name and version as arguments. Removing a template version will remove all the tags associated with it.

Example screwdriver.yaml with validation, publishing and tagging, and version removal as a detached job:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: npx -y -p screwdriver-template-main pipeline-template-publish
            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest
    detached_remove_version:
        steps:
            - remove: npx -y -p screwdriver-template-main pipeline-template-remove-version --namespace templateNamespace --name templateName --version 1.0.0

pipeline-template-remove-version can print a result as json by passing --json option to the command.

Tagging a template

Optionally, tag a template using the pipeline-template-tag script. This must be done in the same pipeline that published the template. You'll need to add arguments for the template namespace, name and tag. You can optionally specify a version; the version must be an exact version, not just a major or major.minor one. If omitted, the latest version will be tagged.

Example screwdriver.yaml with validation and publishing and tagging:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: npx -y -p screwdriver-template-main pipeline-template-publish
            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.2.3 --tag stable

pipeline-template-tag can print a result as json by passing --json option to the command.

$ npx -y -p screwdriver-template-main pipeline-template-tag --json --name templateName --version 1.2.3 --tag stable
{"namespace":"templateNamespace", "name":"templateName","tag":"stable","version":"1.2.3"}

Removing a template tag

To remove a template tag, run the pipeline-template-remove-tag binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and tag as arguments.

Example screwdriver.yaml with validation, publishing and tagging, and tag removal as a detached job:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: ./node_modules/.bin/pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: ./node_modules/.bin/pipeline-template-publish
            - tag: ./node_modules/.bin/pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest
    detached_remove_tag:
        steps:
            - remove: ./node_modules/.bin/pipeline-template-remove-tag --namespace templateNamespace --name templateName --tag latest

pipeline-template-remove-tag can print a result as json by passing --json option to the command.

$ npx -y -p screwdriver-template-main pipeline-template-remove-tag --json --namespace templateNamespace --name templateName --tag stable
{"namespace":"templateNamespace", "name":"templateName","tag":"stable"}

Getting the version from a template tag

To get the version from a template tag, run the pipeline-template-get-version-from-tag binary. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag.

Example screwdriver.yaml with validation, publishing and tagging, and getting a version as a detached job:

shared:
    image: node:18
jobs:
    main:
        requires: [~pr, ~commit]
        steps:
            - validate: npx -y -p screwdriver-template-main pipeline-template-validate
    publish:
        requires: main
        steps:
            - publish: npx -y -p screwdriver-template-main pipeline-template-publish
            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest
    detached_get_version_from_tag:
        steps:
            - get_version: npx -y -p screwdriver-template-main pipeline-template-get-version-from-tag --namespace templateNamespace --name templateName --tag latest

Testing

npm test

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.