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

jenkins-runner

v1.1.15

Published

a simple jenkins runner cli and apis

Downloads

11

Readme

jenkins-runner

npm version

jenkins 调用的 cli 和 api, 使用了 npm 包jenkins的 api 也可作为快速接入钉钉机器人的 cli

cli

  • jenkins-runner init [-d <configFolderPath>] 初始化项目配置
  • jenkins-runner run <runnerName> [-c <configFile> --yes] 执行 jenkins 任务
  • jenkins-runner info [-c <configFile>] 尝试连接 jenkins,并获取信息

jenkins 发送钉钉消息

  • jenkins-runner ding -t <text> [-c <configFile> --yes] 指定发送消息(默认 markdown 格式,可指定格式,可指定消息内容的文件地址)

首次使用步骤

  1. 安装 npm install -D jenkins-runner
  2. 配置 npx jenkins-runner init
  3. 配置生成的文件
    1. config 文件: jenkins_runner.config.js
    2. 配置环境变量/生成的私有文件 local.private.config.js
  4. 检查 jenkins 账号配置 npx jenkins-runner info
  5. 配置 package.json
    1. scripts 配置节 "deploy:pn":"jenkins-runner run deployPN"
  6. 执行 runner npm run deploy:pn

重新下仓库时的配置

  1. 执行npx jenkins-runner init

local.private.config.js

export const jenkinsConfig = {
  user: "<JenkinsUserName>",
  password: "<JenkinsPassword>",
};

Command 使用示例

run job

# get help
jenkins-runner run -h


# 执行第一个runnerSchema
npx jenkins-runner run

# 执行指定的runnerSchema
npx jenkins-runner run <runnerName>

# 指定配置文件
npx jenkins-runner run  <runnerName> -c ./xxx.config.js

# 忽略确认消息
npx jenkins-runner run  <runnerName>  -y

send text

# 查看用法
npx jenkins-runner ding -h

# 简单的消息发送,默认markdown格式
npx jenkins-runner ding -t "Something happens [change](http://xxx.zzz)"

# 发送文件消息
npx jenkins-runner ding -t "将在文件消息前面" -p "./xxx.md"

# 指定格式
npx jenkins-runner ding -f link  -t "将在文件消息前面" --title "Link 标题" --picUrl "https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png" --messageUrl "https://developers.dingtalk.com/document/robots/custom-robot-access?spm=ding_open_doc.document.0.0.62846573S3KCDL#topic-2026027"

钉钉群消息助手

自定义脚本调用

import JenkinsClient, { tryLoadConfigFile } from "jenkins-runner";
const JenkinsRunnerConfig = tryLoadConfigFile("./jenkins_runner.config.js");
const jkClient = new JenkinsClient(JenkinsRunnerConfig.jenkinsConfig);
// 也可自定义markdown数据
jkClient.runSchema(
  jkClient.getRunnerSchemaItem(JenkinsRunnerConfig),
  JenkinsRunnerConfig.dingtalkList
);