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

cleanup: remove more set-outputs #1194

Merged
merged 10 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/detect-workflow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ func main() {
fmt.Printf("ref:%s\n", ref)

// Output of the Action.
fmt.Println(fmt.Sprintf(`::set-output name=repository::%s`, repository))
fmt.Println(fmt.Sprintf(`::set-output name=ref::%s`, ref))
fmt.Println(fmt.Sprintf(`repository=%s >> $GITHUB_OUTPUT`, repository))
fmt.Println(fmt.Sprintf(`ref=%s >> $GITHUB_OUTPUT`, ref))
}
1 change: 0 additions & 1 deletion .github/workflows/builder_go_slsa3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ jobs:
run: |
set -euo pipefail

# Disable set-output command.
asraa marked this conversation as resolved.
Show resolved Hide resolved
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"

echo "$GITHUB_WORKSPACE/$BUILDER_BINARY" build "$CONFIG_FILE" "$UNTRUSTED_ENVS"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/builder_node_slsa3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ jobs:

# cp output into upper folder to make the tarball accessible to
# next step.
echo '::set-output name=filename::$TARBALL'
echo 'filename=$TARBALL >> $GITHUB_OUTPUT'
asraa marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload generated tarball
id: upload
Expand Down
4 changes: 2 additions & 2 deletions internal/builders/generic/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ run in the context of a Github Actions workflow.`,
check(err)

// Print the provenance name and sha256 so it can be used by the workflow.
fmt.Printf("::set-output name=provenance-name::%s\n", attPath)
fmt.Printf("::set-output name=provenance-sha256::%x\n", sha256.Sum256(attBytes))
fmt.Printf("provenance-name=%s >> $GITHUB_OUTPUT\n", attPath)
fmt.Printf("provenance-sha256=%x >> $GITHUB_OUTPUT\n", sha256.Sum256(attBytes))
},
}

Expand Down
4 changes: 2 additions & 2 deletions internal/builders/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ func runProvenanceGeneration(subject, digest, commands, envs, workingDir, rekor
return err
}

fmt.Printf("::set-output name=signed-provenance-name::%s\n", filename)
fmt.Printf("signed-provenance-name=%s >> $GITHUB_OUTPUT\n", filename)

h, err := computeSHA256(filename)
if err != nil {
return err
}

fmt.Printf("::set-output name=signed-provenance-sha256::%s\n", h)
fmt.Printf("signed-provenance-sha256=%s >> $GITHUB_OUTPUT\n", h)

return nil
}
Expand Down
10 changes: 6 additions & 4 deletions internal/builders/go/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"os"
"os/exec"
Expand Down Expand Up @@ -360,17 +361,18 @@ func (r *run) end() string {
}

func extract(lines string) ([]string, []string, string, string, error) {
rsubject := regexp.MustCompile("^::set-output name=go-binary-name::(.*)$")
rcmd := regexp.MustCompile("^::set-output name=go-command::(.*)$")
renv := regexp.MustCompile("^::set-output name=go-env::(.*)$")
rwd := regexp.MustCompile("^::set-output name=go-working-dir::(.*)$")
rsubject := regexp.MustCompile("^go-binary-name=(.*) >> \\$GITHUB_OUTPUT$")
rcmd := regexp.MustCompile("^go-command=(.*) >> \\$GITHUB_OUTPUT$")
renv := regexp.MustCompile("^go-env=(.*) >> \\$GITHUB_OUTPUT$")
rwd := regexp.MustCompile("^go-working-dir=(.*) >> \\$GITHUB_OUTPUT$")
var subject string
var scmd string
var senv string
var wd string

scanner := bufio.NewScanner(bytes.NewReader([]byte(lines)))
for scanner.Scan() {
fmt.Println(scanner.Text())
n := rsubject.FindStringSubmatch(scanner.Text())
if len(n) > 1 {
subject = n[1]
Expand Down
8 changes: 4 additions & 4 deletions internal/builders/go/pkg/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ func (b *GoBuild) Run(dry bool) error {
}

// Share the resolved name of the binary.
fmt.Printf("::set-output name=go-binary-name::%s\n", filename)
fmt.Printf("go-binary-name=%s >> $GITHUB_OUTPUT\n", filename)

// Share the command used.
fmt.Printf("::set-output name=go-command::%s\n", command)
fmt.Printf("go-command=%s >> $GITHUB_OUTPUT\n", command)

// Share the env variables used.
fmt.Printf("::set-output name=go-env::%s\n", menv)
fmt.Printf("go-env=%s >> $GITHUB_OUTPUT\n", menv)

// Share working directory necessary for issuing the vendoring command.
fmt.Printf("::set-output name=go-working-dir::%s\n", dir)
fmt.Printf("go-working-dir=%s >> $GITHUB_OUTPUT\n", dir)
return nil
}

Expand Down