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

Implement secrets: section #1076

Merged
merged 6 commits into from
Nov 17, 2024
Merged

Implement secrets: section #1076

merged 6 commits into from
Nov 17, 2024

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented Nov 17, 2024

ref: #986

By listing the names of variables stored in the secrets section, you can mask all the values of those variables in the output.

$ cat testdata/book/with_secrets.yml
desc: With secrets
debug: true
vars:
  message: hello
secrets:
  - vars.message
steps:
  -
    desc: 'Print "hello world!!"'
    exec:
      command: echo hello world!!
  -
    desc: 'Print "hello world!!" again'
    exec:
      command: cat
      stdin: '{{ steps[0].stdout }}'
  -
    desc: 'Check result of previous command contains "hello"'
    test: 'steps[1].stdout contains "hello"'
$ go run cmd/runn/main.go run testdata/book/with_secrets.yml --scopes run:exec
Run "Print \"***** world!!\"" on "With secrets".steps[0]
-----START COMMAND-----
echo ***** world!!
-----END COMMAND-----
-----START STDOUT-----
***** world!!

-----END STDOUT-----
-----START STDERR-----

-----END STDERR-----

Run "Print \"***** world!!\" again" on "With secrets".steps[1]
-----START COMMAND-----
cat
-----END COMMAND-----
-----START STDIN-----
***** world!!

-----END STDIN-----
-----START STDOUT-----
***** world!!

-----END STDOUT-----
-----START STDERR-----

-----END STDERR-----

Run "Check result of previous command contains \"*****\"" on "With secrets".steps[2]
Run "test" on "With secrets".steps[2]
.

1 scenario, 0 skipped, 0 failures
$

Decision

  • Should we mask explicit output by the Dump runner?
    • Dump Runner output may be used to link with other tools via pipes.
    • Add option to explicitly disable masking

@k1LoW k1LoW added enhancement New feature or request minor labels Nov 17, 2024
@k1LoW k1LoW self-assigned this Nov 17, 2024
@k1LoW k1LoW requested a review from k2tzumi November 17, 2024 08:59

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@k1LoW k1LoW removed the request for review from k2tzumi November 17, 2024 10:24

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

BenchmarkManyRunbooks-4

main (-) #1076 (5c00278) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 3,648,624,814 ns/op 3,569,268,128 ns/op -79,356,686 ns/op
Bytes allocated per iteration 1,351,009,464 B/op 1,380,016,200 B/op 29,006,736 B/op
Allocs per iteration 18,970,090 allocs/op 19,120,665 allocs/op 150,575 allocs/op
Metadata
main (-) #1076 (5c00278)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkOpenAPI3-4

main (-) #1076 (5c00278) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 4,851,611,596 ns/op 4,817,918,684 ns/op -33,692,912 ns/op
Bytes allocated per iteration 2,265,219,224 B/op 2,265,700,384 B/op 481,160 B/op
Allocs per iteration 31,312,947 allocs/op 31,316,253 allocs/op 3,306 allocs/op
Metadata
main (-) #1076 (5c00278)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkSingleRunbook-4

main (-) #1076 (5c00278) +/-
Number of iterations 25 25 0
Nanoseconds per iteration 48,144,267 ns/op 46,121,644 ns/op -2,022,623 ns/op
Bytes allocated per iteration 22,385,997 B/op 22,437,308 B/op 51,311 B/op
Allocs per iteration 184,249 allocs/op 184,427 allocs/op 178 allocs/op
Metadata
main (-) #1076 (5c00278)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

Reported by octocov

Copy link
Contributor

Code Metrics Report

main (3a20ef3) #1076 (5c00278) +/-
Coverage 64.4% 64.5% +0.0%
Code to Test Ratio 1:0.7 1:0.7 +0.0
Test Execution Time 5m53s 4m14s -1m39s
Details
  |                     | main (3a20ef3) | #1076 (5c00278) |  +/-   |
  |---------------------|----------------|-----------------|--------|
+ | Coverage            |          64.4% |           64.5% |  +0.0% |
  |   Files             |             77 |              77 |      0 |
  |   Lines             |           8704 |            8737 |    +33 |
+ |   Covered           |           5611 |            5640 |    +29 |
+ | Code to Test Ratio  |          1:0.7 |           1:0.7 |   +0.0 |
  |   Code              |          16011 |           16069 |    +58 |
+ |   Test              |          11733 |           12014 |   +281 |
+ | Test Execution Time |          5m53s |           4m14s | -1m39s |

Code coverage of files in pull request scope (73.1% → 73.3%)

Files Coverage +/-
book.go 79.1% +0.0%
dump.go 69.6% +0.2%
exec.go 79.2% 0.0%
operator.go 80.1% +0.0%
option.go 59.2% +0.3%
store.go 77.3% +0.7%

Reported by octocov

@k1LoW k1LoW changed the title Implementing secrets: section Implement secrets: section Nov 17, 2024
@k1LoW k1LoW merged commit 9fe4b81 into main Nov 17, 2024
8 checks passed
@k1LoW k1LoW deleted the secrets branch November 17, 2024 13:47
@github-actions github-actions bot mentioned this pull request Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant