Skip to content

Commit

Permalink
Add support for platform api 0.2
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Sreedharan <asreedharan@pivotal.io>
  • Loading branch information
matthewmcnew committed Jan 15, 2020
1 parent 1f20436 commit 7edadaa
Show file tree
Hide file tree
Showing 11 changed files with 1,065 additions and 732 deletions.
38 changes: 9 additions & 29 deletions pkg/apis/build/v1alpha1/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ import (
corev1alpha1 "github.com/pivotal/kpack/pkg/apis/core/v1alpha1"
)

func (bi *BuildBuilderSpec) getBuilderSecretVolume() corev1.Volume {
if len(bi.ImagePullSecrets) > 0 {
return corev1.Volume{
Name: builderPullSecretsDirName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: bi.ImagePullSecrets[0].Name,
},
},
}
} else {
return corev1.Volume{
Name: builderPullSecretsDirName,
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
}
}
}

func (*Build) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("Build")
}
Expand All @@ -36,6 +16,14 @@ func (b *Build) Tag() string {
return b.Spec.Tags[0]
}

func (b *Build) ServiceAccount() string {
return b.Spec.ServiceAccount
}

func (b *Build) BuilderSpec() BuildBuilderSpec {
return b.Spec.Builder
}

func (b *Build) IsRunning() bool {
if b == nil {
return false
Expand Down Expand Up @@ -100,15 +88,7 @@ func (b *Build) Finished() bool {
return !b.Status.GetCondition(corev1alpha1.ConditionSucceeded).IsUnknown()
}

func (b *Build) SourceEnvVars() []corev1.EnvVar {
return b.Spec.Source.Source().BuildEnvVars()
}

func (b *Build) ImagePullSecretsVolume() corev1.Volume {
return b.Spec.Source.Source().ImagePullSecretsVolume()
}

func (b *Build) Rebasable(builderStack string) bool {
func (b *Build) rebasable(builderStack string) bool {
return b.Spec.LastBuild != nil &&
b.Annotations[BuildReasonAnnotation] == BuildReasonStack && b.Spec.LastBuild.StackId == builderStack
}
Loading

0 comments on commit 7edadaa

Please sign in to comment.