The Context Documentation needs work

anyone else have the same experience of trying to access env vars within workflows? and getting messed up by yaml errors all day?

pretty frustrating that the examples are not helpful, no debug steps, pitfalls, etc, within the docs?

I decided to just hard code the env vars directly into the codebase, since the context is almost unusable and hard to debug.

Kept running into issues where the key isn’t expected.

things tried:

jobs:
  pylint:
    resource_class: xlarge
    docker:
      - image: cimg/python:3.9.10
    steps:
      - checkout
      - restore_cache:
          <<: *restore-python-cache
      - run:
          <<: *pre-commit-install
      - save_cache:
          <<: *save-python-cache
      - run:
          no_output_timeout: 20m
          command: |
            . venv_3_9_10/bin/activate
            pre-commit run --all-files -c .pre-commit-circleci.yaml

workflows:
  build-and-test:
    jobs:
      - pylint
        context: fury

Also:



version: 2.1

orbs:
  aws-s3: circleci/aws-s3@2.0.0
  browser-tools: circleci/browser-tools@1.1.3

jobs:
  pylint:
    context: fury
    resource_class: xlarge
    docker:
      - image: cimg/python:3.9.10
    steps:
      - checkout
      - restore_cache:
          <<: *restore-python-cache
      - run:
          <<: *pre-commit-install
      - save_cache:
          <<: *save-python-cache
      - run:
          no_output_timeout: 20m
          command: |
            . venv_3_9_10/bin/activate
            pre-commit run --all-files -c .pre-commit-circleci.yaml

workflows:
  build-and-test:
    jobs:
      - pylint

Error:

# 5. [#/jobs/unit-tests] 0 subschemas matched instead of one
# |   1. [#/jobs/unit-tests] only 1 subschema matches out of 2
# |   |   1. [#/jobs/unit-tests] extraneous key [context] is not permitted
# |   |   |   Permitted keys:
# |   |   |     - description
# |   |   |     - parallelism
# |   |   |     - macos
# |   |   |     - resource_class
# |   |   |     - docker
# |   |   |     - steps
# |   |   |     - working_directory
# |   |   |     - circleci_ip_ranges
# |   |   |     - machine
# |   |   |     - environment
# |   |   |     - executor
# |   |   |     - shell
# |   |   |     - parameters
# |   |   |   Passed keys:
# |   |   |     - context
# |   |   |     - parallelism
# |   |   |     - resource_class
# |   |   |     - docker
# |   |   |     - steps
# |   2. [#/jobs/unit-tests] expected type: String, found: Mapping
# |   |   Job may be a string reference to another job

so anyways, it looks like it was an indentation, yaml thing:

workflows:
  build-and-test:
    jobs:
      - pylint:
          context: fury

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.