Skip to content

Commit

Permalink
Merge pull request #259 from uselagoon/main-v1beta2
Browse files Browse the repository at this point in the history
feat: implement v1beta2 api
  • Loading branch information
shreddedbacon authored Nov 1, 2024
2 parents 62f368a + 91a9226 commit 1e6dde2
Show file tree
Hide file tree
Showing 80 changed files with 8,961 additions and 2,454 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/remote-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
branches:
- main
- main-v1beta2

jobs:
test-suite:
Expand Down Expand Up @@ -51,7 +52,7 @@ jobs:
- name: Setup correct Go version
uses: actions/setup-go@v2
with:
go-version: '1.20'
go-version: '1.22'
- name: Install kubebuilder
run: |
#kubebuilder
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20-alpine AS builder
FROM golang:1.22-alpine AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=false"
CRD_OPTIONS ?= "crd"

CONTROLLER_NAMESPACE ?= lagoon-builddeploy

Expand Down Expand Up @@ -102,7 +102,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2 ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.2 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
6 changes: 6 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ domain: lagoon.sh
multigroup: true
repo: github.com/uselagoon/remote-controller
resources:
- group: crd
kind: LagoonBuild
version: v1beta2
- group: crd
kind: LagoonTask
version: v1beta2
- group: crd
kind: LagoonBuild
version: v1beta1
Expand Down
105 changes: 105 additions & 0 deletions apis/lagoon/v1beta1/helpers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package v1beta1

import (
"testing"
)

func TestCheckLagoonVersion(t *testing.T) {
type args struct {
build *LagoonBuild
checkVersion string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "test1",
args: args{
build: &LagoonBuild{
Spec: LagoonBuildSpec{
Project: Project{
Variables: LagoonVariables{
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.12.0","scope":"internal_system"}]`),
},
},
},
},
checkVersion: "2.12.0",
},
want: true,
},
{
name: "test2",
args: args{
build: &LagoonBuild{
Spec: LagoonBuildSpec{
Project: Project{
Variables: LagoonVariables{
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.11.0","scope":"internal_system"}]`),
},
},
},
},
checkVersion: "2.12.0",
},
want: false,
},
{
name: "test3",
args: args{
build: &LagoonBuild{
Spec: LagoonBuildSpec{
Project: Project{
Variables: LagoonVariables{
Project: []byte(`[]`),
},
},
},
},
checkVersion: "2.12.0",
},
want: false,
},
{
name: "test4",
args: args{
build: &LagoonBuild{
Spec: LagoonBuildSpec{
Project: Project{
Variables: LagoonVariables{
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.12.0","scope":"internal_system"}]`),
},
},
},
},
checkVersion: "v2.12.0",
},
want: true,
},
{
name: "test5",
args: args{
build: &LagoonBuild{
Spec: LagoonBuildSpec{
Project: Project{
Variables: LagoonVariables{
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.11.0","scope":"internal_system"}]`),
},
},
},
},
checkVersion: "v2.12.0",
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CheckLagoonVersion(tt.args.build, tt.args.checkVersion); got != tt.want {
t.Errorf("CheckLagoonVersion() = %v, want %v", got, tt.want)
}
})
}
}
Loading

0 comments on commit 1e6dde2

Please sign in to comment.