Skip to content

Ordering of child elements (artifacts, tabs, and tasks) of a job #124

@rkrisztian

Description

@rkrisztian

I have a problem with the ordering of child elements under a job in your examples, let me reason why.

Original ordering:

          jobs:
            csharp: # name of the job
              resources:
               - net45
              artifacts:
               - build:
                   source: bin/
                   destination: build
               - test:
                   source: tests/
                   destination: test-reports/
               - test:
                   source: coverage.xml
              tabs:
                report: test-reports/index.html
              tasks: # ordered list of tasks to execute in job csharp
               - fetch:
                   pipeline: pipe2
                   stage: build
                   job: test
                   source: test-bin/
                   destination: bin/

               - exec: # indicates type of task
                   command: make
                   arguments:
                    - "VERBOSE=true"
               # shorthand for script-executor plugin
               - script: ./build.sh ci

So this ordering prefers artifacts -> tabs -> tasks. When I read a configuration like this, I got the following problems:

  • What generates these artifacts? How are they derived? Why do I need to start reading the config with these questions in my head raised from the start? (Casuality order.)
  • It's not the first thing I want to know when I check what a job does, because it's not what gets done first. Artifacts are only generated after executing the tasks. And Artifacts aren't the first things you write either, but the commands. (Timely order.)
  • More often than not, the artifacts are the least important things to check in a build configuration. Then I will have to scroll down, and find what I really need. (Importance order.)

So what I miss here is a sort-of Given-When-Then structure, meaning like, with these resources and environment vars, when I execute these commands, I want GoCD to store these artifacts, and these tabs should be created from those artifacts. Which leads to my preferred ordering tasks -> artifacts -> tabs. I don't think one writes tests like, expectations first, and only then what is executed, as that would be weird too.

The reason this is important to me is, your example codes essentially impose a recommended style, which people follow. Thus I find it important that the examples are in good shape.

Also, not everyone thinks this is an important readability concern, which I find weird. Maybe we should discuss, as I'm trying to see why this styling should rather be viewed as highly opinionated.

Thank you for your consideration in advance, all I can ask.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions