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

release radix-api #664

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions api/applications/models/pipeline_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,26 @@ type PipelineParametersBuild struct {
//
// example: master-latest
ImageTag string `json:"imageTag,omitempty"`

// OverrideUseBuildCache override default or configured build cache option
//
// required: false
// Extensions:
// x-nullable: true
OverrideUseBuildCache *bool `json:"overrideUseBuildCache,omitempty"`
}

// MapPipelineParametersBuildToJobParameter maps to JobParameter
func (buildParam PipelineParametersBuild) MapPipelineParametersBuildToJobParameter() *jobModels.JobParameters {
return &jobModels.JobParameters{
Branch: buildParam.Branch,
CommitID: buildParam.CommitID,
PushImage: buildParam.PushImageToContainerRegistry(),
TriggeredBy: buildParam.TriggeredBy,
ImageRepository: buildParam.ImageRepository,
ImageName: buildParam.ImageName,
ImageTag: buildParam.ImageTag,
Branch: buildParam.Branch,
CommitID: buildParam.CommitID,
PushImage: buildParam.PushImageToContainerRegistry(),
TriggeredBy: buildParam.TriggeredBy,
ImageRepository: buildParam.ImageRepository,
ImageName: buildParam.ImageName,
ImageTag: buildParam.ImageTag,
OverrideUseBuildCache: buildParam.OverrideUseBuildCache,
}
}

Expand Down
13 changes: 8 additions & 5 deletions api/jobs/job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"testing"

"github.com/equinor/radix-common/utils/pointers"
kedav2 "github.com/kedacore/keda/v2/pkg/generated/clientset/versioned"
kedafake "github.com/kedacore/keda/v2/pkg/generated/clientset/versioned/fake"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -70,10 +71,11 @@ func TestGetApplicationJob(t *testing.T) {
require.NoError(t, err)

jobParameters := &jobmodels.JobParameters{
Branch: anyBranch,
CommitID: anyPushCommitID,
PushImage: true,
TriggeredBy: anyUser,
Branch: anyBranch,
CommitID: anyPushCommitID,
PushImage: true,
TriggeredBy: anyUser,
OverrideUseBuildCache: pointers.Ptr(true),
}

accounts := models.NewAccounts(client, radixclient, kedaClient, secretproviderclient, nil, certClient, client, radixclient, kedaClient, secretproviderclient, nil, certClient, "", radixmodels.Impersonation{})
Expand Down Expand Up @@ -119,7 +121,8 @@ func TestGetApplicationJob(t *testing.T) {
assert.Equal(t, anyPushCommitID, job.CommitID)
assert.Equal(t, anyUser, job.TriggeredBy)
assert.Equal(t, string(anyPipeline.Type), job.Pipeline)

assert.NotNil(t, jobSummary.OverrideUseBuildCache)
assert.True(t, *jobSummary.OverrideUseBuildCache)
}

func TestGetApplicationJob_RadixJobSpecExists(t *testing.T) {
Expand Down
7 changes: 7 additions & 0 deletions api/jobs/models/job_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ type JobParameters struct {
//
// required: false
ComponentsToDeploy []string `json:"componentsToDeploy"`

// OverrideUseBuildCache override default or configured build cache option
//
// required: false
// Extensions:
// x-nullable: true
OverrideUseBuildCache *bool `json:"overrideUseBuildCache,omitempty"`
}

// GetPushImageTag Represents boolean as 1 or 0
Expand Down
8 changes: 8 additions & 0 deletions api/jobs/models/job_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ type JobSummary struct {
//
// required: false
PromotedToEnvironment string `json:"promotedToEnvironment,omitempty"`

// OverrideUseBuildCache override default or configured build cache option
//
// required: false
// Extensions:
// x-nullable: true
OverrideUseBuildCache *bool `json:"overrideUseBuildCache,omitempty"`
}

// GetSummaryFromRadixJob Used to get job summary from a radix job
Expand Down Expand Up @@ -124,6 +131,7 @@ func GetSummaryFromRadixJob(job *radixv1.RadixJob) *JobSummary {
case radixv1.Build, radixv1.BuildDeploy:
pipelineJob.Branch = job.Spec.Build.Branch
pipelineJob.CommitID = job.Spec.Build.CommitID
pipelineJob.OverrideUseBuildCache = job.Spec.Build.OverrideUseBuildCache
case radixv1.Deploy:
pipelineJob.ImageTagNames = job.Spec.Deploy.ImageTagNames
pipelineJob.CommitID = job.Spec.Deploy.CommitID
Expand Down
9 changes: 5 additions & 4 deletions api/jobs/start_job_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ func (jh JobHandler) buildPipelineJob(ctx context.Context, appName, cloneURL, ra
switch pipeline.Type {
case v1.BuildDeploy, v1.Build:
buildSpec = v1.RadixBuildSpec{
ImageTag: imageTag,
Branch: jobSpec.Branch,
CommitID: jobSpec.CommitID,
PushImage: jobSpec.PushImage,
ImageTag: imageTag,
Branch: jobSpec.Branch,
CommitID: jobSpec.CommitID,
PushImage: jobSpec.PushImage,
OverrideUseBuildCache: jobSpec.OverrideUseBuildCache,
}
case v1.Promote:
promoteSpec = v1.RadixPromoteSpec{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/cert-manager/cert-manager v1.15.0
github.com/equinor/radix-common v1.9.3
github.com/equinor/radix-job-scheduler v1.10.2
github.com/equinor/radix-operator v1.57.16
github.com/equinor/radix-operator v1.57.18
github.com/evanphx/json-patch/v5 v5.9.0
github.com/felixge/httpsnoop v1.0.4
github.com/golang-jwt/jwt/v5 v5.2.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ github.com/equinor/radix-common v1.9.3 h1:dLKFzYy8/XyEG9Zygi0rMWIYGCddai/ILwUqjB
github.com/equinor/radix-common v1.9.3/go.mod h1:+g0Wj0D40zz29DjNkYKVmCVeYy4OsFWKI7Qi9rA6kpY=
github.com/equinor/radix-job-scheduler v1.10.2 h1:Ea/gmSQjVdomC3XzkqJdR1TGQ9Bvq8ZJOKUfwYY3Ask=
github.com/equinor/radix-job-scheduler v1.10.2/go.mod h1:cnVXZ09D0rAPTZrcgWynL/txMQnpYmPSPyzfKfTYlec=
github.com/equinor/radix-operator v1.57.8 h1:fvXky2aZmKcre2X54R9hL5sl9gK19RGfFY9Q2Gn3IQg=
github.com/equinor/radix-operator v1.57.8/go.mod h1:zCdAiP/wxyvlUO4qGoJuLW3O+ZSt9kTyHMnjmsR3fCU=
github.com/equinor/radix-operator v1.57.16 h1:kDuPbKrb/r3Iu6BtCoq50IETspvynl55X+RGug9CSqw=
github.com/equinor/radix-operator v1.57.16/go.mod h1:zCdAiP/wxyvlUO4qGoJuLW3O+ZSt9kTyHMnjmsR3fCU=
github.com/equinor/radix-operator v1.57.18 h1:+zPaeZKfErjXE9O2+EjtUenrKw2nabq3e0y5VBjlwHA=
github.com/equinor/radix-operator v1.57.18/go.mod h1:zCdAiP/wxyvlUO4qGoJuLW3O+ZSt9kTyHMnjmsR3fCU=
github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
Expand Down
12 changes: 12 additions & 0 deletions swaggerui/html/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6668,6 +6668,12 @@
"x-go-name": "Name",
"example": "radix-pipeline-20181029135644-algpv-6hznh"
},
"overrideUseBuildCache": {
"description": "OverrideUseBuildCache override default or configured build cache option",
"type": "boolean",
"x-go-name": "OverrideUseBuildCache",
"x-nullable": true
},
"pipeline": {
"description": "Name of the pipeline",
"type": "string",
Expand Down Expand Up @@ -6824,6 +6830,12 @@
"x-go-name": "ImageTag",
"example": "master-latest"
},
"overrideUseBuildCache": {
"description": "OverrideUseBuildCache override default or configured build cache option",
"type": "boolean",
"x-go-name": "OverrideUseBuildCache",
"x-nullable": true
},
"pushImage": {
"description": "PushImage should image be pushed to container registry. Defaults pushing",
"type": "string",
Expand Down
Loading