Skip to content

Commit

Permalink
Set radix-tekton tag (#585)
Browse files Browse the repository at this point in the history
* set radix-tekton tag

* cleanup readme

* Update api/jobs/start_job_handler.go

Co-authored-by: Nils Gustav Stråbø <65334626+nilsgstrabo@users.noreply.github.com>

---------

Co-authored-by: Richard Hagen <richard.hagen@bouvet.no>
Co-authored-by: Nils Gustav Stråbø <65334626+nilsgstrabo@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent 3ff031e commit e623186
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 92 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"env": {
"RADIX_CONTAINER_REGISTRY":"radixdev.azurecr.io",
"PIPELINE_IMG_TAG": "master-latest",
"RADIX_TEKTON_TAG": "main-latest",
"K8S_API_HOST": "https://weekly-14-clusters-16ede4-97pzjkre.hcp.northeurope.azmk8s.io",
"RADIX_CLUSTER_TYPE": "development",
"RADIX_DNS_ZONE": "dev.radix.equinor.com",
Expand All @@ -28,4 +29,4 @@
]
}
]
}
}
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ You need Go installed. Make sure `GOPATH` and `GOROOT` are properly set up.

Also needed:

- [`go-swagger`](https://github.com/go-swagger/go-swagger) (install with `go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5`.)
- [`statik`](https://github.com/rakyll/statik) (install with `go install github.com/rakyll/statik@v0.1.7`)
- [`gomock`](https://github.com/golang/mock) (install with `go install github.com/golang/mock/mockgen@v1.6.0`)
- [`go-swagger`](https://github.com/go-swagger/go-swagger) (install with `make bootstrap`.)
- [`golangci-lint`](https://golangci-lint.run/) (install with `make bootstrap`)
- [`gomock`](https://github.com/golang/mock) (install with `make bootstrap`)

Clone the repo into your `GOPATH` and run `go mod download`.

Expand All @@ -44,6 +44,7 @@ The following env vars are needed. Useful default values in brackets.

- `RADIX_CONTAINER_REGISTRY` - (`radixdev.azurecr.io`)
- `PIPELINE_IMG_TAG` - (`master-latest`)
- `RADIX_TEKTON_TAG` - (`release-latest`)

You also probably want to start with the argument `--useOutClusterClient=false`. When `useOutClusterClient` is `false`, several debugging settings are enabled:
* a service principal with superpowers is used to authorize the requests, and the client's `Authorization` bearer token is ignored.
Expand All @@ -53,16 +54,9 @@ You also probably want to start with the argument `--useOutClusterClient=false`.

If you are using VSCode, there is a convenient launch configuration in `.vscode`.

#### Common errors running locally

- **Problem**: `panic: statik/fs: no zip data registered`

**Solution**: `make swagger`

#### Validate code

- `go install honnef.co/go/tools/cmd/staticcheck@v0.3.3`
- run `make staticcheck`
- run `make lint`

#### Update version
We follow the [semantic version](https://semver.org/) as recommended by [go](https://blog.golang.org/publishing-go-modules).
Expand Down Expand Up @@ -109,4 +103,4 @@ Read our [contributing guidelines](./CONTRIBUTING.md)

------------------

[Security notification](./SECURITY.md)
[Security notification](./SECURITY.md)
15 changes: 14 additions & 1 deletion api/jobs/start_job_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import (
)

const (
pipelineTagEnvironmentVariable = "PIPELINE_IMG_TAG"
pipelineTagEnvironmentVariable = "PIPELINE_IMG_TAG"
radixTektonTagEnvironmentVariable = "RADIX_TEKTON_TAG"
)

// HandleStartPipelineJob Handles the creation of a pipeline job for an application
Expand Down Expand Up @@ -116,6 +117,7 @@ func (jh JobHandler) buildPipelineJob(appName, cloneURL, radixConfigFullName str
CloneURL: cloneURL,
PipeLineType: pipeline.Type,
PipelineImage: getPipelineTag(),
TektonImage: getRadixTektonTag(),
Build: buildSpec,
Promote: promoteSpec,
Deploy: deploySpec,
Expand Down Expand Up @@ -149,6 +151,17 @@ func getPipelineTag() string {
return pipelineTag
}

func getRadixTektonTag() string {
tektonTag := os.Getenv(radixTektonTagEnvironmentVariable)
if tektonTag == "" {
log.Warning("No radix tekton image tag defined. Using release-latest")
tektonTag = "release-latest"
} else {
log.Infof("Using %s radix tekton image tag", tektonTag)
}
return tektonTag
}

func getUniqueJobName(image string) (string, string) {
var jobName []string
randomStr := strings.ToLower(radixutils.RandString(5))
Expand Down
21 changes: 0 additions & 21 deletions charts/radix-api-dev/.helmignore

This file was deleted.

4 changes: 0 additions & 4 deletions charts/radix-api-dev/Chart.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions charts/radix-api-dev/templates/_helpers.tpl

This file was deleted.

25 changes: 0 additions & 25 deletions charts/radix-api-dev/templates/deployment.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions charts/radix-api-dev/values.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions radixconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
cpu: "2000m"
variables:
PIPELINE_IMG_TAG: "master-latest"
RADIX_TEKTON_TAG: "main-latest"
GOMAXPROCS: "1"
- environment: prod
runAsNonRoot: true
Expand All @@ -52,4 +53,5 @@ spec:
cpu: "2000m"
variables:
PIPELINE_IMG_TAG: "release-latest"
RADIX_TEKTON_TAG: "release-latest"
GOMAXPROCS: "2"

0 comments on commit e623186

Please sign in to comment.