Fix step caching
Created by: eseliger
Src side change for https://github.com/sourcegraph/sourcegraph/pull/37240
This fixes two things, that I found today:
- It changes Stdout and Stderr on the StepResult struct to string, it is part of the marshalled cache result and *bytes.Buffer cannot be marshalled into JSON. This caused stdout/stderr to always be empty, thus breaking executions where
${{ previous_step.stdout }}
is used. - It fixes a misconception of the
PreviousStepResult
. When running the actual execution, it will eventually become the result of the previous step, but from the perspective of that particular cache result, it has to be the result from THAT step execution. Otherwise caching would only work from step 2 on and skip 1 step still.
Test plan
Test case and manual verification.