Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Batch Changes - newlines in /tmp/*.logs #27860

@DaedalusG

Description

@DaedalusG
  • Sourcegraph version: raised at v3.32
  • Platform information: MacOS Catalina, Docker version 20.10.8, build 3967b7d

Steps to reproduce:

  1. Create a batch change spec utilizing the steps.outputs method with the template arg ${{ step.stdout }}
    For example:
name: doombot
description: test output

on:
  - repositoriesMatchingQuery: repo:Knights

steps:
  - run: |
      echo "I am the real Doctor Doom!";
      echo "Doom?";
      i=1
      while [ $i -le 3 ]
      do
        echo "Doom!"
        i=$(($i+1))
      done
      echo "I am the one true doom!";
      echo "Doom was here!" >> message.txt && cat message.txt;
    container: alpine:3
    outputs:
      stepOneOutput:
        value: "Doom says: ${{ step.stdout }}"
  - run: echo " ${{ outputs.stepOneOutput }}"
    container: alpine:3

changesetTemplate:
  title: doombot
  body: testing output
  branch: output-test
  commit:
    message: output param testing
  1. run the following command
src batch preview \
-f doombot3.batch.yaml \
--keep-logs
  1. Observe the logs outputted to /tmp/...
2021-10-11T17:28:21.898596-07:00 [Step 1] run: "echo \"I am the real Doctor Doom!\";\necho \"Doom?\";\ni=1\nwhile [ $i -le 3 ]\ndo\n  echo \"Doom!\"\n  i=$(($i+1))\ndone\necho \"I am the one true doom!\";\necho \"Doom was here!\" >> message.txt && cat message.txt;\n", container: "alpine:3"
2021-10-11T17:28:21.89865-07:00 [Step 1] full command: "docker run --rm --init --cidfile /tmp/github.com-DaedalusG-Knights_Travail-64f3070ab2a8219134ac680a0373371e9e3479b6-container-id003959215 --workdir /work --mount type=bind,source=/tmp/746420034,target=/tmp/tmp.NOgAPg,ro --user 0:0 --mount type=volume,source=5e2ed7f0df4c05c06e514f13ee4612163417160c6b3a0ea519db7e592f3aed07,target=/work --entrypoint /bin/sh -- sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab /tmp/tmp.NOgAPg"
2021-10-11T17:28:22.35766-07:00 stdout | I am the real Doctor Doom!
2021-10-11T17:28:22.357714-07:00 stdout | Doom?
2021-10-11T17:28:22.357722-07:00 stdout | Doom!
2021-10-11T17:28:22.357729-07:00 stdout | Doom!
2021-10-11T17:28:22.357737-07:00 stdout | Doom!
2021-10-11T17:28:22.357745-07:00 stdout | I am the one true doom!
2021-10-11T17:28:22.357751-07:00 stdout |
2021-10-11T17:28:22.358347-07:00 stdout | Doom was here!
2021-10-11T17:28:22.358374-07:00 stdout |
2021-10-11T17:28:22.467593-07:00 [Step 1] complete in 569ms
2021-10-11T17:28:24.806392-07:00 [Step 2] run: "echo \" ${{ outputs.stepOneOutput }}\"", container: "alpine:3"
2021-10-11T17:28:24.806411-07:00 [Step 2] full command: "docker run --rm --init --cidfile /tmp/github.com-DaedalusG-Knights_Travail-64f3070ab2a8219134ac680a0373371e9e3479b6-container-id799690323 --workdir /work --mount type=bind,source=/tmp/528985494,target=/tmp/tmp.memFHF,ro --user 0:0 --mount type=volume,source=5e2ed7f0df4c05c06e514f13ee4612163417160c6b3a0ea519db7e592f3aed07,target=/work --entrypoint /bin/sh -- sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab /tmp/tmp.memFHF"
2021-10-11T17:28:25.267379-07:00 stdout |  Doom says: I am the real Doctor Doom!
2021-10-11T17:28:25.267439-07:00 stdout | Doom?
2021-10-11T17:28:25.267449-07:00 stdout | Doom!
2021-10-11T17:28:25.26746-07:00 stdout | Doom!
2021-10-11T17:28:25.267468-07:00 stdout | Doom!
2021-10-11T17:28:25.267475-07:00 stdout | I am the one true doom!
2021-10-11T17:28:25.267481-07:00 stdout | Doom was here!
2021-10-11T17:28:25.267491-07:00 stdout |
2021-10-11T17:28:25.267501-07:00 stdout |
2021-10-11T17:28:25.371404-07:00 [Step 2] complete in 565ms

Expected behavior:

Logs produced should be predictable with either a newline appearing in logs after each call of echo or no newline between echo calls.

Actual behavior:

The placement of newlines in logs is unpredictable, and in some instances, intermediary container logs seem to log a newline after every statement.

Metadata

Metadata

Assignees

Labels

batch-changesIssues related to Batch ChangesbugAn error, flaw or fault that produces an incorrect or unexpected result, or behavior.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions