Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circleci: anchors and aliases #17

Open
vsoch opened this issue Jul 25, 2018 · 0 comments
Open

circleci: anchors and aliases #17

vsoch opened this issue Jul 25, 2018 · 0 comments

Comments

@vsoch
Copy link
Contributor

vsoch commented Jul 25, 2018

I'm just figuring out that yaml has these definitions called "anchors" and then "aliases" that can be used together to define a function (or set of configuration values) and then reference / reuse across a build workflow! For example, I might set a default:

defaults: &defaults
  docker:
    - image: docker:18.01.0-ce-git
  working_directory: /tmp/src
  environment:
    - TZ: "/usr/share/zoneinfo/America/Los_Angeles"

and then reference it:

version: 2
jobs:
  setup:
    <<: *defaults
    steps:
      - run:
          name: Test if the user has defined the repository name
          command: apk add --no-cache pigz python3

using this for any repeated code would be ideal to clean / simplify the config files! I think we would also want a way to add a variable input to a function, I'm still looking into / testing if I can do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant