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

Defining aliases breaks the build #105

Closed
Martin-Narvar opened this issue Dec 20, 2023 · 5 comments · Fixed by #108
Closed

Defining aliases breaks the build #105

Martin-Narvar opened this issue Dec 20, 2023 · 5 comments · Fixed by #108
Assignees
Labels
bug An issue with the system 🐛.

Comments

@Martin-Narvar
Copy link

Martin-Narvar commented Dec 20, 2023

My .circleci/config.yml contains

version: 2.1

setup: true

orbs:
  dynamic: bjd2385/dynamic-continuation@3.7.1

workflows:
  generate-config:
    jobs:
      - dynamic/continue:
          name: Generate configs
          context: orb-publishing
          default-branch: master
          modules: |
            /java
            /typescript
            /golang

I created corresponding java.yml, golang.yml and typescript.yml files, and the orb does merge them correctly.

However my java.yaml contains aliases of the form

aliases:
  - &defaults
    docker:
      - image: $DOCKER_REPO/alpine-oraclejdk8:3.11-202-master
    working_directory: ~/soil-core

That are uses elsewhere in the script like this:

jobs:
  build_java:
    <<: *defaults
    steps:
      - checkout

During the merge, validation fails with

Error: config compilation contains errors: config compilation contains errors:
        - Unable to parse YAML
        - found undefined alias defaults
        -  in 'string', line 19, column 9:
        -         <<: *defaults
        -             ^

I think this is because this dynamic continuation orb moves all of the aliases to the end of the script.

@emmeowzing emmeowzing added the bug An issue with the system 🐛. label Dec 20, 2023
@emmeowzing emmeowzing self-assigned this Dec 20, 2023
@emmeowzing
Copy link
Owner

emmeowzing commented Dec 20, 2023

@Martin-Narvar sounds like I'd want to explode prior to reduction.

https://mikefarah.gitbook.io/yq/operators/anchor-and-alias-operators

I can cut a v3.8.1 with this fix.

@Martin-Narvar
Copy link
Author

That would be fantastic. Aliases are essential for DRY

@emmeowzing
Copy link
Owner

emmeowzing commented Dec 21, 2023

@Martin-Narvar please check out v3.8.1. I implemented a fix for this issue and a form of testing in #108.

@Martin-Narvar
Copy link
Author

With this version I get an error

Error calling job: 'dynamic/continue'
Unexpected argument(s): default-branch

Did you rename this option since 1.7.1

@Martin-Narvar
Copy link
Author

I changed default-branch to base-revision and now it works as expected.
Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the system 🐛.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants