steampipe plugin install jenkins

Jenkins + Steampipe

Jenkins is the leading open source automation server that provides hundreds of plugins to support building, deploying and automating any project.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

For example:

select
color,
name,
in_queue,
last_completed_build ->> 'URL' as last_completed_build
from
jenkins_freestyle;
+----------+----------------------+----------+---------------------------------------------------------+
| color | name | in_queue | last_completed_build |
+----------+----------------------+----------+---------------------------------------------------------+
| blue | stage-deploy | false | https://ci-cd.mycorp.com/job/stage-deploy/350/ |
| red | build-and-unit-test | true | https://ci-cd.mycorp.com/job/build-and-unit-test/245/ |
| blue | production-deploy | true | https://ci-cd.mycorp.com/job/build-and-unit-test/241/ |
+----------+----------------------+----------+---------------------------------------------------------+

Documentation

Quick start

Install

Download and install the latest Jenkins plugin:

steampipe plugin install jenkins

Credentials

ItemDescription
CredentialsJenkins requires server_url, username and password for all requests.
PermissionsUsernames and passwords have the same permissions as the user who creates them, and if the user permissions change, the connection's permissions also change.
RadiusEach connection represents a single Jenkins Installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/jenkins.spc)
2. Credentials specified in environment variables, e.g., JENKINS_URL, JENKINS_USERNAME and JENKINS_PASSWORD.

Configuration

Installing the latest jenkins plugin will create a config file (~/.steampipe/config/jenkins.spc) with a single connection named jenkins:

connection "jenkins" {
plugin = "jenkins"
# The Jenkins server URL is required for all requests. Required.
# It should be fully qualified (e.g. # https://...) and point to the root of the Jenkins server location.
# Can also be set via the JENKINS_URL environment variable.
# server_url = "https://ci-cd.internal.my-company.com"
# The Jenkins username for authentication is required for requests. Required.
# Can also be set via the JENKINS_USERNAME environment variable.
# username = "admin"
# Either the password or the API token is required for requests. Required.
# Can also be set via the JENKINS_PASSWORD environment variable.
# password = "aqt*abc8vcf9abc.ABC"
# Further information: https://www.jenkins.io/doc/book/using/using-credentials/
}

Alternatively, you can also use the standard Jenkins environment variables to obtain credentials only if other arguments (server_url, username and password) are not specified in the connection:

export JENKINS_URL=https://ci-cd.internal.my-company.com
export JENKINS_USERNAME=admin
export JENKINS_PASSWORD=aqt*abc8vcf9abc.ABC

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- jenkins

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_jenkins;
CREATE SERVER steampipe_jenkins FOREIGN DATA WRAPPER steampipe_postgres_jenkins OPTIONS (config '<your_config>');
CREATE SCHEMA jenkins;
IMPORT FOREIGN SCHEMA jenkins FROM SERVER steampipe_jenkins INTO jenkins;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- jenkins

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_jenkins function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_jenkins.so
sqlite> select steampipe_configure_jenkins('<your_config>');

Export

This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- jenkins

You can pass the configuration to the command with the --config argument:

steampipe_export_jenkins --config '<your_config>' <table_name>