Table: circleci_context_environment_variable - Query CircleCI Context Environment Variables using SQL
CircleCI Context Environment Variables are resources within CircleCI that allow you to store environment variable data. These variables can be shared across multiple projects within a CircleCI organization. They are used to store sensitive information and can be used across multiple jobs, providing a secure and efficient way to manage environment-specific data.
Table Usage Guide
The circleci_context_environment_variable
table provides insights into the environment variables within CircleCI Contexts. As a DevOps engineer, explore environment variable-specific details through this table, including their names, contexts, and values. Utilize it to uncover information about the variables, such as those that are shared across multiple projects, and efficiently manage environment-specific data.
Examples
Environment variables in a context
Explore the environment variables associated with a specific context in CircleCI to understand when they were created and last updated. This can be useful for auditing and managing configurations across projects.
select context_id, variable, created_at, updated_atfrom circleci_context_environment_variablewhere context_id = '60d77d33-a62c-4167-90be-3e02ee38a75b';
select context_id, variable, created_at, updated_atfrom circleci_context_environment_variablewhere context_id = '60d77d33-a62c-4167-90be-3e02ee38a75b';
Environment variables not updated for more than 90 days
Determine the areas in which CircleCI environment variables have not been updated for more than 90 days. This could be useful for auditing and maintaining best practices for regular updates and security.
select context_id, variable, created_at, updated_atfrom circleci_context_environment_variablewhere context_id = '60d77d33-a62c-4167-90be-3e02ee38a75b' and updated_at < current_date - interval '90' day;
select context_id, variable, created_at, updated_atfrom circleci_context_environment_variablewhere context_id = '60d77d33-a62c-4167-90be-3e02ee38a75b' and updated_at < date('now', '-90 day');
Schema for circleci_context_environment_variable
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
context_id | text | Unique key for the context. | |
created_at | timestamp with time zone | Timestamp of when pipeline was created. | |
login_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the account login. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
updated_at | timestamp with time zone | Timestamp of when variable was updated. | |
variable | text | Variable name. |
Export
This table is available as a standalone Exporter 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)" -- circleci
You can pass the configuration to the command with the --config
argument:
steampipe_export_circleci --config '<your_config>' circleci_context_environment_variable