Skip to content

Commit

Permalink
add comments to public methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsgstrabo committed Sep 16, 2024
1 parent 97e16f4 commit 01378fa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 46 deletions.
1 change: 1 addition & 0 deletions pipeline-runner/internal/jobs/build/acr.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
acrHomePath = "/home/radix-image-builder"
)

// NewBuildKit returns a JobBuilder implementation for building components and jobs using radix-image-builder (https://github.com/equinor/radix-image-builder)
func NewACR() JobsBuilder {
return &acr{}
}
Expand Down
7 changes: 4 additions & 3 deletions pipeline-runner/internal/jobs/build/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const (
buildKitHomePath = "/home/build"
buildKitBuildSecretsPath = "/build-secrets"
privateImageHubDockerAuthPath = "/radix-private-image-hubs"
defaultExternalRegistruAuthPath = "/radix-default-external-registry-auth"
defaultExternalRegistryAuthPath = "/radix-default-external-registry-auth"
)

// NewBuildKit returns a JobBuilder implementation for building components and jobs using radix-buildkit-builder (https://github.com/equinor/radix-buildkit-builder)
func NewBuildKit() JobsBuilder {
return &buildKit{}
}
Expand Down Expand Up @@ -239,7 +240,7 @@ func (c *buildKitKubeJobProps) getPodContainerArgs() []string {
// When multiple files contains credentials for the same registry (e.g. docker.io), credentials from the last file is used
var authFiles []string
if len(c.pipelineArgs.ExternalContainerRegistryDefaultAuthSecret) > 0 {
authFiles = append(authFiles, path.Join(defaultExternalRegistruAuthPath, corev1.DockerConfigJsonKey))
authFiles = append(authFiles, path.Join(defaultExternalRegistryAuthPath, corev1.DockerConfigJsonKey))
}
authFiles = append(authFiles, path.Join(privateImageHubDockerAuthPath, corev1.DockerConfigJsonKey))
for _, authFile := range authFiles {
Expand Down Expand Up @@ -347,7 +348,7 @@ func (c *buildKitKubeJobProps) getPodContainerVolumeMounts() []corev1.VolumeMoun
volumeMounts = append(volumeMounts,
corev1.VolumeMount{
Name: c.pipelineArgs.ExternalContainerRegistryDefaultAuthSecret,
MountPath: defaultExternalRegistruAuthPath,
MountPath: defaultExternalRegistryAuthPath,
ReadOnly: true,
},
)
Expand Down
2 changes: 2 additions & 0 deletions pipeline-runner/internal/jobs/build/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
batchv1 "k8s.io/api/batch/v1"
)

// JobsBuilder defines interface for creating pipeline build jobs
type JobsBuilder interface {
// BuildJobs returns a slice of Kubernetes jobs to be used for building container images for Radix components and jobs
BuildJobs(useBuildCache bool, pipelineArgs model.PipelineArguments, cloneURL, gitCommitHash, gitTags string, componentImages []pipeline.BuildComponentImage, buildSecrets []string) []batchv1.Job
}
2 changes: 2 additions & 0 deletions pipeline-runner/internal/jobs/build/internal/kubejob.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// KubeJobProps defines properties to be used with the BuildKubeJob function.
type KubeJobProps interface {
JobName() string
JobLabels() map[string]string
Expand All @@ -21,6 +22,7 @@ type KubeJobProps interface {
PodContainers() []corev1.Container
}

// BuildKubeJob builds a Kubernetes job with properties defined by source argument
func BuildKubeJob(props KubeJobProps) batchv1.Job {
return batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Expand Down
43 changes: 0 additions & 43 deletions pipeline-runner/internal/jobs/build/kubejob.go

This file was deleted.

0 comments on commit 01378fa

Please sign in to comment.