Skip to content

Commit

Permalink
Merge branch 'main' into cluster-analysis-templates
Browse files Browse the repository at this point in the history
Signed-off-by: BenHesketh21 <[email protected]>
  • Loading branch information
BenHesketh21 committed Dec 1, 2024
2 parents 1d29cf8 + bfd30f1 commit 86a22a2
Show file tree
Hide file tree
Showing 99 changed files with 4,920 additions and 1,741 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
grep -v .pb.go coverage.txt | grep -v zz_generated | grep -v service.connect.go > coverage.tmp
mv coverage.tmp coverage.txt
- name: Upload coverage reports
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}

lint-ui:
lint-and-typecheck-ui:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -65,6 +65,8 @@ jobs:
node-version: "22.8.0"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: Run typecheck
run: make typecheck-ui
- name: Run linter
run: make lint-ui

Expand Down Expand Up @@ -186,7 +188,7 @@ jobs:
run: git diff --exit-code -- .

build-image:
needs: [test-unit, lint-go, lint-charts, lint-proto, lint-ui, check-codegen]
needs: [test-unit, lint-go, lint-charts, lint-proto, lint-and-typecheck-ui, check-codegen]
runs-on: ubuntu-latest
services:
registry:
Expand Down Expand Up @@ -218,7 +220,7 @@ jobs:
cache-to: type=gha,mode=max

build-cli:
needs: [test-unit, lint-go, lint-charts, lint-proto, lint-ui, check-codegen]
needs: [test-unit, lint-go, lint-charts, lint-proto, lint-and-typecheck-ui, check-codegen]
runs-on: ubuntu-latest
container:
image: golang:1.23.3-bookworm
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.4.15 && \
####################################################################################################
FROM alpine:latest AS back-end-dev

RUN apk update && apk add ca-certificates git gpg gpg-agent openssh-client
RUN apk update && apk add ca-certificates git gpg gpg-agent openssh-client tini

COPY bin/credential-helper /usr/local/bin/credential-helper
COPY bin/controlplane/kargo /usr/local/bin/kargo

RUN adduser -D -H -u 1000 kargo
USER 1000:0

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/kargo"]

####################################################################################################
Expand Down Expand Up @@ -119,4 +120,5 @@ FROM ${BASE_IMAGE}:latest-${TARGETARCH} AS final
COPY --from=back-end-builder /kargo/bin/ /usr/local/bin/
COPY --from=tools /tools/ /usr/local/bin/

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/kargo"]
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ lint-ui:
pnpm --dir=ui install --dev
pnpm --dir=ui run lint

.PHONY: typecheck-ui
typecheck-ui:
pnpm --dir=ui install
pnpm --dir=ui run typecheck

.PHONY: format-ui
format-ui:
pnpm --dir=ui install --dev
Expand Down Expand Up @@ -342,7 +347,7 @@ hack-install-cert-manager: install-helm
--install \
--create-namespace \
--namespace cert-manager \
--set installCRDs=true \
--set crds.enabled=true \
--wait

.PHONY: hack-install-argocd
Expand Down
711 changes: 468 additions & 243 deletions api/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions api/v1alpha1/generated.proto

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

26 changes: 26 additions & 0 deletions api/v1alpha1/promotion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,27 @@ type PromotionVariable struct {
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}

// PromotionStepRetry describes the retry policy for a PromotionStep.
type PromotionStepRetry struct {
// Attempts is the number of times the step can be attempted before the
// PromotionStep is marked as failed.
//
// If this field is set to 1, the step will not be retried. If this
// field is set to -1, the step will be retried indefinitely.
//
// The default of this field depends on the step being executed. Refer to
// the documentation for the specific step for more information.
Attempts int64 `json:"attempts,omitempty" protobuf:"varint,1,opt,name=attempts"`
}

// GetAttempts returns the Attempts field with the given fallback value.
func (r *PromotionStepRetry) GetAttempts(fallback int64) int64 {
if r == nil || r.Attempts == 0 {
return fallback
}
return r.Attempts
}

// PromotionStep describes a directive to be executed as part of a Promotion.
type PromotionStep struct {
// Uses identifies a runner that can execute this step.
Expand All @@ -117,6 +138,8 @@ type PromotionStep struct {
Uses string `json:"uses" protobuf:"bytes,1,opt,name=uses"`
// As is the alias this step can be referred to as.
As string `json:"as,omitempty" protobuf:"bytes,2,opt,name=as"`
// Retry is the retry policy for this step.
Retry *PromotionStepRetry `json:"retry,omitempty" protobuf:"bytes,4,opt,name=retry"`
// Config is opaque configuration for the PromotionStep that is understood
// only by each PromotionStep's implementation. It is legal to utilize
// expressions in defining values at any level of this block.
Expand Down Expand Up @@ -154,6 +177,9 @@ type PromotionStatus struct {
// permits steps that have already run successfully to be skipped on
// subsequent reconciliations attempts.
CurrentStep int64 `json:"currentStep,omitempty" protobuf:"varint,9,opt,name=currentStep"`
// CurrentStepAttempt is the number of times the current step has been
// attempted.
CurrentStepAttempt int64 `json:"currentStepAttempt,omitempty" protobuf:"varint,11,opt,name=currentStepAttempt"`
// State stores the state of the promotion process between reconciliation
// attempts.
State *apiextensionsv1.JSON `json:"state,omitempty" protobuf:"bytes,10,opt,name=state"`
Expand Down
39 changes: 39 additions & 0 deletions api/v1alpha1/promotion_types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package v1alpha1

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestPromotionRetry_GetAttempts(t *testing.T) {
tests := []struct {
name string
retry *PromotionStepRetry
fallback int64
want int64
}{
{
name: "retry is nil",
retry: nil,
fallback: 1,
want: 1,
},
{
name: "attempts is not set",
retry: &PromotionStepRetry{},
fallback: -1,
want: -1,
},
{
name: "attempts is set",
retry: &PromotionStepRetry{
Attempts: 3,
},
want: 3,
},
}
for _, tt := range tests {
require.Equal(t, tt.want, tt.retry.GetAttempts(tt.fallback))
}
}
3 changes: 3 additions & 0 deletions api/v1alpha1/warehouse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type WarehouseSpec struct {
// FreightCreationPolicy describes how Freight is created by this Warehouse.
// This field is optional. When left unspecified, the field is implicitly
// treated as if its value were "Automatic".
// Accepted values: Automatic, Manual
//
// +kubebuilder:default=Automatic
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -111,6 +112,7 @@ type GitSubscription struct {
// commit of interest in the repository specified by the RepoURL field. This
// field is optional. When left unspecified, the field is implicitly treated
// as if its value were "NewestFromBranch".
// Accepted values: Lexical, NewestFromBranch, NewestTag, SemVer
//
// +kubebuilder:default=NewestFromBranch
CommitSelectionStrategy CommitSelectionStrategy `json:"commitSelectionStrategy,omitempty" protobuf:"bytes,2,opt,name=commitSelectionStrategy"`
Expand Down Expand Up @@ -224,6 +226,7 @@ type ImageSubscription struct {
// of the image specified by the RepoURL field. This field is optional. When
// left unspecified, the field is implicitly treated as if its value were
// "SemVer".
// Accepted values: Digest, Lexical, NewestBuild, SemVer
//
// +kubebuilder:default=SemVer
ImageSelectionStrategy ImageSelectionStrategy `json:"imageSelectionStrategy,omitempty" protobuf:"bytes,3,opt,name=imageSelectionStrategy"`
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

22 changes: 22 additions & 0 deletions charts/kargo/resources/crds/kargo.akuity.io_promotions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ spec:
expressions in defining values at any level of this block.
See https://docs.kargo.io/references/expression-language for details.
x-kubernetes-preserve-unknown-fields: true
retry:
description: Retry is the retry policy for this step.
properties:
attempts:
description: |-
Attempts is the number of times the step can be attempted before the
PromotionStep is marked as failed.
If this field is set to 1, the step will not be retried. If this
field is set to -1, the step will be retried indefinitely.
The default of this field depends on the step being executed. Refer to
the documentation for the specific step for more information.
format: int64
type: integer
type: object
uses:
description: Uses identifies a runner that can execute this
step.
Expand Down Expand Up @@ -145,6 +161,12 @@ spec:
subsequent reconciliations attempts.
format: int64
type: integer
currentStepAttempt:
description: |-
CurrentStepAttempt is the number of times the current step has been
attempted.
format: int64
type: integer
finishedAt:
description: FinishedAt is the time when the promotion was completed.
format: date-time
Expand Down
28 changes: 28 additions & 0 deletions charts/kargo/resources/crds/kargo.akuity.io_stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ spec:
expressions in defining values at any level of this block.
See https://docs.kargo.io/references/expression-language for details.
x-kubernetes-preserve-unknown-fields: true
retry:
description: Retry is the retry policy for this step.
properties:
attempts:
description: |-
Attempts is the number of times the step can be attempted before the
PromotionStep is marked as failed.
If this field is set to 1, the step will not be retried. If this
field is set to -1, the step will be retried indefinitely.
The default of this field depends on the step being executed. Refer to
the documentation for the specific step for more information.
format: int64
type: integer
type: object
uses:
description: Uses identifies a runner that can execute
this step.
Expand Down Expand Up @@ -474,6 +490,12 @@ spec:
subsequent reconciliations attempts.
format: int64
type: integer
currentStepAttempt:
description: |-
CurrentStepAttempt is the number of times the current step has been
attempted.
format: int64
type: integer
finishedAt:
description: FinishedAt is the time when the promotion was
completed.
Expand Down Expand Up @@ -1295,6 +1317,12 @@ spec:
subsequent reconciliations attempts.
format: int64
type: integer
currentStepAttempt:
description: |-
CurrentStepAttempt is the number of times the current step has been
attempted.
format: int64
type: integer
finishedAt:
description: FinishedAt is the time when the promotion was
completed.
Expand Down
Loading

0 comments on commit 86a22a2

Please sign in to comment.