Contexts/environments?

12 views
Skip to first unread message

Victor Sudakov

unread,
Jan 27, 2023, 4:42:58 AM1/27/23
to jenkins...@googlegroups.com
Dear Colleagues,

Some CI/CD tools support the concept of contexts or environments. In each
environment/context, you define a set of variables or secrets with
different values, and refer to the contexts from the pipeline. For example,
for Github Actions you can create the "main" and "dev" environments and
then mention them in your pipeline:

jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Test secrets
run: something
env:
SUPER_SECRET: ${{ secrets.TEST_SECRET }}

and the value of secrets.TEST_SECRET will be different for different
branches.

Do you know of a plugin for Jenkins with a similar functionality for its
Multibranch Pipelines?

Jenkins has the concept of "credential domains", can they be used for this
purpose (like referring to a credential domain from the environment{} block for
example)?

--
Victor Sudakov
Systems Administrator
Streamline - Property Management Software
Website: www.streamlinevrs.com

Victor Sudakov

unread,
Jan 29, 2023, 10:38:58 PM1/29/23
to jenkins...@googlegroups.com
Any ideas or thoughts on this?

Mark Waite

unread,
Jan 29, 2023, 10:43:44 PM1/29/23
to Jenkins Users
On Sunday, January 29, 2023 at 8:38:58 PM UTC-7 Victor Sudakov wrote:
Any ideas or thoughts on this?

On 27.01.2023 16:42, Victor Sudakov wrote:
> Dear Colleagues,
>
> Some CI/CD tools support the concept of contexts or environments. In each
> environment/context, you define a set of variables or secrets with
> different values, and refer to the contexts from the pipeline. For example,
> for Github Actions you can create the "main" and "dev" environments and
> then mention them in your pipeline:


I've used folders as a way to provide additional context for a job.  If one folder is for dev and another is for main, the environment variables on the main folder can be different than the environment variables on the dev folder.  Credentials can be assigned to the folder as well.  If the same credential ID is used in both contexts, the job should be able to reference credentials from the folder.

Victor Sudakov

unread,
Jan 30, 2023, 3:47:06 AM1/30/23
to jenkins...@googlegroups.com
Mark Waite wrote:
>
>
> I've used folders as a way to provide additional context for a job. If one
> folder is for dev and another is for main, the environment variables on the
> main folder can be different than the environment variables on the dev
> folder. Credentials can be assigned to the folder as well. If the same
> credential ID is used in both contexts, the job should be able to reference
> credentials from the folder.

Hello Mark!

But Multibranch job children are not real folders! Only the parent Multibranch pipeline has a "Credentials" menu.

I'm still thinking that I've overlooked some intelligent and useful way of
using credential domains. That would be the equivalent of Github's
environments, right?
Reply all
Reply to author
Forward
0 new messages