Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
72.8K

obtain-oidc-id-token obtain-oidc-id-token

Obtain ID token from Codefresh OIDC Provider

arguments

  • AUDIENCE - the audience of the ID token. For multiple audiences, use a comma-separated list. Defaults to the address of the Codefresh platform instance (For SaaS, https://g.codefresh.io)

returns

  • ID_TOKEN - the ID token obtained from Codefresh OIDC Provider
    version: '1.0'
steps:
  obtain_id_token:
    title: Obtain ID Token
    type: obtain-oidc-id-token
  print_output:
    title: Printing output from previous step
    image: alpine
    commands:
      - echo $ID_TOKEN
      - 'echo ${{steps.obtain_id_token.output.ID_TOKEN}}'

  
    version: '1.0'
steps:
  obtain_id_token:
    title: Obtain ID Token
    type: obtain-oidc-id-token
    arguments:
      AUDIENCE: 'https://my-audience.com'
  print_output:
    title: Printing output from previous step
    image: alpine
    commands:
      - echo $ID_TOKEN
      - 'echo ${{steps.obtain_id_token.output.ID_TOKEN}}'

  
    version: '1.0'
steps:
  obtain_id_token:
    title: Obtain ID Token
    type: obtain-oidc-id-token
  assume_role:
    title: Assume Role
    type: aws-sts-assume-role-with-web-identity
    arguments:
      ROLE_ARN: 'arn:aws:iam::123456789012:role/role-name'
      ROLE_SESSION_NAME: session-name
  s3_list_objects:
    title: List S3 Objects
    image: amazon/aws-cli
    commands:
      - 'aws s3 ls "s3://bucket-name/"'

  
github.com
Daniel Soifer
Apr 9, 2024