Skip to content

Commit

Permalink
add output result (#10)
Browse files Browse the repository at this point in the history
Signed-off-by: soulseen <[email protected]>
  • Loading branch information
Zhuxiaoyang authored and ks-ci-bot committed Aug 21, 2019
1 parent 5124280 commit 76569e5
Show file tree
Hide file tree
Showing 4,608 changed files with 1,523,821 additions and 1,913 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
228 changes: 222 additions & 6 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import:
subpackages:
- digestset
- reference
# close-write carry
- package: github.com/docker/docker
repo: https://github.com/openshift/moby-moby.git
version: openshift-3.10-docker-b68221c
repo: https://github.com/openshift/moby-moby.git
subpackages:
- api
- api/types
Expand Down Expand Up @@ -102,3 +101,8 @@ import:
subpackages:
- unix
- windows
- package: sigs.k8s.io/controller-runtime
- package: k8s.io/client-go
version: ^12.0.0
subpackages:
- kubernetes
59 changes: 49 additions & 10 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,24 @@ const (

// DefaultTag is the image tag, being applied if none is specified.
DefaultTag = "latest"
// DefaultHub is the default image repository.
DefaultHub = "docker.io"

// AnnotationBuildResultKey is the filed in job annotations.
AnnotationBuildResultKey = "s2iBuildResult"

// AnnotationBuildSourceKey is the filed in job annotations.
AnnotationBuildSourceKey = "s2iBuildSource"

// Command for pull docker image.
CommandPull = "docker pull "

// Default source branch.
DefaultBranch = "master"

//S2iRun Namespace which s2i job run.
S2iRunNamespace = "S2iRunNamespace"

//S2iRunJobName is the job name in k8s.
S2iRunJobName = "S2iRunJobName"
)

// Config contains essential fields for performing build.
Expand Down Expand Up @@ -267,6 +283,9 @@ type Config struct {

// The RevisionId is a branch name or a SHA-1 hash of every important thing about the commit
RevisionId string `json:"revisionId,omitempty"`

// Output build result. If build not in k8s cluster, can not use this field.
OutputBuildResult bool `json:"outputBuildResult,omitempty"`
}

// DeepCopyInto to implement k8s api requirement
Expand Down Expand Up @@ -410,11 +429,36 @@ type Result struct {
// WorkingDir describes temporary directory used for downloading sources, scripts and tar operations.
WorkingDir string

// ImageID describes resulting image ID.
ImageID string

// BuildInfo holds information about the result of a build.
BuildInfo BuildInfo

// ImageInfo describes resulting image info.
ResultInfo OutputResultInfo
// Source info.
SourceInfo SourceInfo
}

type SourceInfo struct {
SourceUrl string `json:"sourceUrl,omitempty"`
RevisionId string `json:"revisionId,omitempty"`
BuilderImage string `json:"builderImage,omitempty"`
Description string `json:"description,omitempty"`

CommitID string `json:"commitID,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`

BinaryName string `json:"binaryName,omitempty"`
BinarySize uint64 `json:"binarySize,omitempty"`
}

type OutputResultInfo struct {
ImageName string `json:"imageName,omitempty"`
ImageID string `json:"imageID,omitempty"`
ImageSize int64 `json:"imageSize,omitempty"`
ImageCreated string `json:"imageCreated,omitempty"`
ImageRepoTags []string `json:"imageRepoTags,omitempty"`
CommandPull string `json:"commandPull,omitempty"`
}

// BuildInfo contains information about the build process.
Expand Down Expand Up @@ -741,11 +785,6 @@ func parseImage(image string) (*ImageInfo, error) {
i.Tag = tagged.Tag()
}

// Add the digest if there was one.
if canonical, ok := named.(reference.Canonical); ok {
i.Digest = canonical.Digest()
}

return i, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/build/strategies/onbuild/onbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (builder *OnBuild) Build(config *api.Config) (*api.Result, error) {
return &api.Result{
Success: true,
WorkingDir: config.WorkingDir,
ImageID: imageID,
ResultInfo: api.OutputResultInfo{ImageID: imageID},
}, nil
}

Expand Down
Loading

0 comments on commit 76569e5

Please sign in to comment.