Skip to content

Commit

Permalink
(feat) CIE build output (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
TP Honey authored Jul 29, 2022
1 parent 5d9d168 commit 9fcf541
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

require golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
require golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ import (
)

const (
Name = outputter.BuildMaker
Name = outputter.BuildMaker
droneBuildRoot = `kind: pipeline
type: docker
name: default
platform:
os: linux
arch: amd64
steps:`
cieBuildRoot = `pipeline:
stages:
- identifier: default
name: default
steps:`
)

var (
Expand Down Expand Up @@ -82,18 +96,8 @@ func (oc outputterConfig) Output(ctx context.Context, scanResults []types.Scanle
fmt.Printf("- %s, %s\n", result.ScannerFamily, result.Description)
}
fmt.Println("")

droneBuildOutput := `kind: pipeline
type: docker
name: default
platform:
os: linux
arch: amd64
steps:`
cieBuildOutput := "CIECIE\n"

droneBuildOutput := droneBuildRoot
cieBuildOutput := cieBuildRoot
// add the steps to the build file
for _, result := range results {
dbo := result.Spec.(OutputFields)
Expand All @@ -115,7 +119,13 @@ steps:`
}
// build cie step
if oc.outputCIE {
cieBuildOutput += fmt.Sprintf("step %s\n", dbo.Name)
cieBuildOutput += fmt.Sprintf(`
- identifier: %s
name: %s
spec:
connectorRef: account.docker
image: %s
type: Plugin`, dbo.Name, dbo.Name, dbo.Image)
}
}

Expand Down

0 comments on commit 9fcf541

Please sign in to comment.