mirror of
https://gitee.com/rancher/rancher.git
synced 2025-12-06 07:49:17 +08:00
Add a single source of CI and release configuration
This commit is contained in:
@@ -32,8 +32,13 @@ RUN if [ "${ARCH}" == "amd64" ]; then \
|
||||
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/spectrometer/master/install.sh | sh; \
|
||||
fi
|
||||
|
||||
# install controller-tools for crd generation
|
||||
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.12.0
|
||||
# Tool for CRD generation.
|
||||
ENV CONTROLLER_GEN_VERSION v0.12.0
|
||||
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
|
||||
|
||||
# YAML processor for release configuration.
|
||||
ENV YQ_VERSION v4.40.2
|
||||
RUN wget -q https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${ARCH}.tar.gz -O - | tar xz && mv yq_linux_${ARCH} /usr/bin/yq
|
||||
|
||||
ENV HELM_URL_V2_amd64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-helm \
|
||||
HELM_URL_V2_arm64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-helm-arm64 \
|
||||
|
||||
@@ -39,6 +39,10 @@ This repo is a meta-repo used for packaging and contains the majority of Rancher
|
||||
|
||||
Rancher also includes other open source libraries and projects, [see go.mod](https://github.com/rancher/rancher/blob/release/v2.8/go.mod) for the full list.
|
||||
|
||||
## Build configuration
|
||||
|
||||
Refer to the [build docs](docs/build.md) on how to customize the building and packaging of Rancher.
|
||||
|
||||
## Support, Discussion, and Community
|
||||
If you need any help with Rancher, please join us at either our [Rancher forums](http://forums.rancher.com/) or [Slack](https://slack.rancher.io/) where most of our team hangs out at.
|
||||
|
||||
|
||||
4
build.yaml
Normal file
4
build.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
webhookVersion: 103.0.1+up0.4.2
|
||||
cspAdapterMinVersion: 103.0.0+up3.0.0
|
||||
defaultShellVersion: rancher/shell:v0.1.22
|
||||
fleetVersion: 103.1.0+up0.9.0
|
||||
@@ -7,6 +7,7 @@ set -eo pipefail
|
||||
set -x
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||
source "$SCRIPT_DIR/../scripts/export-config"
|
||||
|
||||
TARGET_OS="${TARGET_OS:-linux}"
|
||||
GO_BINARY="${GO_BINARY:-$(which go)}"
|
||||
@@ -56,4 +57,9 @@ cp "${K3S_AIRGAP_IMAGES_TARBALL}" "${PACKAGE_FOLDER}"
|
||||
|
||||
DOCKERFILE="${SCRIPT_DIR}/../package/Dockerfile"
|
||||
# Always use buildx to make sure the image & the binary architectures match
|
||||
docker buildx build -t "${TARGET_REPO}" -f "${DOCKERFILE}" "${PACKAGE_FOLDER}" --platform="${TARGET_OS}/${TARGET_ARCH}"
|
||||
docker buildx build -t "${TARGET_REPO}" -f "${DOCKERFILE}" \
|
||||
--build-arg CATTLE_RANCHER_WEBHOOK_VERSION="${CATTLE_RANCHER_WEBHOOK_VERSION}" \
|
||||
--build-arg CATTLE_CSP_ADAPTER_MIN_VERSION="${CATTLE_CSP_ADAPTER_MIN_VERSION}" \
|
||||
--build-arg CATTLE_FLEET_VERSION="${CATTLE_FLEET_VERSION}" \
|
||||
--build-arg ARCH="${TARGET_ARCH}" \
|
||||
"${PACKAGE_FOLDER}" --platform="${TARGET_OS}/${TARGET_ARCH}"
|
||||
|
||||
69
docs/build.md
Normal file
69
docs/build.md
Normal file
@@ -0,0 +1,69 @@
|
||||
## Build and package configuration
|
||||
|
||||
Build variables should be defined in a single file,
|
||||
so that anyone who wants to build Rancher needs to only edit this file to change configuration and dependency versions.
|
||||
|
||||
Rancher relies on various subcomponents, such as the webhook.
|
||||
These typically need to have set versions for Rancher to build and run properly.
|
||||
Build variables can be used in different places and supplied to the applications in a variety of ways,
|
||||
including as environment variables in Dockerfiles, constants in Go code, and so on.
|
||||
|
||||
The [build.yaml](../build.yaml) file is the single source of truth. It lists all values by name and value.
|
||||
Changes to it should be committed to source control.
|
||||
|
||||
### Update an existing value
|
||||
|
||||
Edit the [build.yaml](../build.yaml) file and update the desired value. Run `go generate`. Commit any changes to source
|
||||
control. To test locally, re-build Rancher with `make build` or re-package it with `make package`.
|
||||
|
||||
### Add a new value
|
||||
|
||||
To add a new value, do the following once.
|
||||
|
||||
Add it to [build.yaml](../build.yaml). For example:
|
||||
|
||||
```
|
||||
webhookVersion: 2.0.6+up0.3.6-rc1
|
||||
```
|
||||
|
||||
Then update the [export-config](../scripts/export-config) script.
|
||||
|
||||
```
|
||||
CATTLE_RANCHER_WEBHOOK_VERSION=$(yq -e '.webhookVersion' "$file")
|
||||
export CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
```
|
||||
|
||||
Run `go generate` from the root of the repo.
|
||||
|
||||
Now you can refer to the value wherever you need it.
|
||||
|
||||
#### Refer to the new value
|
||||
|
||||
If a new configuration value is an environment variable for a Dockerfile, capture it as an `ARG` and `ENV`. For example:
|
||||
|
||||
```
|
||||
ARG CATTLE_FLEET_VERSION
|
||||
ENV CATTLE_FLEET_VERSION=$CATTLE_FLEET_VERSION
|
||||
```
|
||||
|
||||
Then pass it as via `docker build --build-arg MYVAR="$MYVAR" ...`
|
||||
|
||||
If a new configuration value is a regular string outside Dockerfiles, refer to the corresponding constant found in the
|
||||
generated Go [file](../pkg/buildconfig/constants.go). For example:
|
||||
|
||||
```NewSetting("shell-image", buildconfig.DefaultShellVersion)```
|
||||
|
||||
The following are examples of files that often refer to newly added configuration values:
|
||||
|
||||
- [build-server](../scripts/build-server)
|
||||
- [build-agent](../scripts/build-agent)
|
||||
- [build-local.sh](../dev-scripts/build-local.sh)
|
||||
- [Dockerfile](../package/Dockerfile)
|
||||
- [Dockerfile.agent](../package/Dockerfile.agent)
|
||||
- [pkg/settings/setting.go](../pkg/settings/setting.go)
|
||||
|
||||
### The build.yaml file
|
||||
|
||||
It's better to follow the standard Kubernetes convention of preferring camelCase keys in the YAML file.
|
||||
|
||||
The exported resulting environment variables should be like standard ENV_VARS.
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:generate go run pkg/codegen/buildconfig/writer.go pkg/codegen/buildconfig/main.go
|
||||
//go:generate go run pkg/codegen/generator/cleanup/main.go
|
||||
//go:generate go run pkg/codegen/main.go
|
||||
//go:generate scripts/build-crds
|
||||
|
||||
4
go.mod
4
go.mod
@@ -137,7 +137,7 @@ require (
|
||||
golang.org/x/net v0.14.0
|
||||
golang.org/x/oauth2 v0.11.0
|
||||
golang.org/x/sync v0.3.0
|
||||
golang.org/x/text v0.12.0 // indirect
|
||||
golang.org/x/text v0.12.0
|
||||
golang.org/x/tools v0.12.0 // indirect
|
||||
google.golang.org/api v0.138.0
|
||||
google.golang.org/grpc v1.57.0
|
||||
@@ -402,7 +402,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
k8s.io/cluster-bootstrap v0.27.2 // indirect
|
||||
k8s.io/code-generator v0.27.5 // indirect
|
||||
k8s.io/component-base v0.27.6 // indirect
|
||||
|
||||
@@ -57,9 +57,12 @@ ENV CATTLE_SYSTEM_UPGRADE_CONTROLLER_CHART_VERSION 103.0.0+up0.6.0
|
||||
# System charts minimal version
|
||||
# Deprecated in favor of CATTLE_FLEET_VERSION.
|
||||
ENV CATTLE_FLEET_MIN_VERSION=""
|
||||
ENV CATTLE_FLEET_VERSION=103.1.0+up0.9.0
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=103.0.1+up0.4.2
|
||||
ENV CATTLE_CSP_ADAPTER_MIN_VERSION=103.0.0+up3.0.0
|
||||
ARG CATTLE_FLEET_VERSION
|
||||
ENV CATTLE_FLEET_VERSION=$CATTLE_FLEET_VERSION
|
||||
ARG CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ARG CATTLE_CSP_ADAPTER_MIN_VERSION
|
||||
ENV CATTLE_CSP_ADAPTER_MIN_VERSION=$CATTLE_CSP_ADAPTER_MIN_VERSION
|
||||
|
||||
RUN mkdir -p /var/lib/rancher-data/local-catalogs/system-library && \
|
||||
mkdir -p /var/lib/rancher-data/local-catalogs/library && \
|
||||
|
||||
@@ -20,7 +20,8 @@ ARG VERSION=dev
|
||||
LABEL io.cattle.agent true
|
||||
ENV AGENT_IMAGE rancher/rancher-agent:${VERSION}
|
||||
# For now, this value needs to be manually synced with the one in the main Dockerfile. This pins downstream webhook's version.
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=103.0.1+up0.4.2
|
||||
ARG CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ENV SSL_CERT_DIR /etc/kubernetes/ssl/certs
|
||||
COPY --from=rancher /var/lib/rancher-data /var/lib/rancher-data
|
||||
COPY --from=rancher /usr/bin/tini /usr/bin/
|
||||
|
||||
10
pkg/buildconfig/constants.go
Normal file
10
pkg/buildconfig/constants.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Code generated by pkg/codegen/config/main.go. DO NOT EDIT.
|
||||
// Package buildconfig contains a set of exported constants that represent configuration variables of Rancher at build-time.
|
||||
package buildconfig
|
||||
|
||||
const (
|
||||
CspAdapterMinVersion = "103.0.0+up3.0.0"
|
||||
DefaultShellVersion = "rancher/shell:v0.1.22"
|
||||
FleetVersion = "103.1.0+up0.9.0"
|
||||
WebhookVersion = "103.0.1+up0.4.2"
|
||||
)
|
||||
44
pkg/codegen/buildconfig/main.go
Normal file
44
pkg/codegen/buildconfig/main.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// This program generates a Go file containing a set of exported constants that represent
|
||||
// configuration variables of Rancher at build-time.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := generateGoConstantsFile(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func generateGoConstantsFile() error {
|
||||
in, err := os.OpenFile("build.yaml", os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := os.OpenFile("pkg/buildconfig/constants.go", os.O_TRUNC|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
const raw = `// Code generated by pkg/codegen/config/main.go. DO NOT EDIT.
|
||||
// Package buildconfig contains a set of exported constants that represent configuration variables of Rancher at build-time.
|
||||
package buildconfig
|
||||
|
||||
const (
|
||||
{{ . }})
|
||||
`
|
||||
tmpl, err := template.New("").Parse(raw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
writer := GoConstantsWriter{
|
||||
Tmpl: tmpl,
|
||||
Input: in,
|
||||
Output: out,
|
||||
}
|
||||
return writer.Run()
|
||||
}
|
||||
97
pkg/codegen/buildconfig/writer.go
Normal file
97
pkg/codegen/buildconfig/writer.go
Normal file
@@ -0,0 +1,97 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type GoConstantsWriter struct {
|
||||
Input io.Reader
|
||||
Output io.Writer
|
||||
Tmpl *template.Template
|
||||
buf []byte
|
||||
cfg map[string]string
|
||||
}
|
||||
|
||||
// Run loads YAML data from the pre-configured Input source, processes it, and outputs a template with formatted
|
||||
// Go constants in the pre-configured Output source. This method can only be run once, since the Input source gets fully read.
|
||||
func (f *GoConstantsWriter) Run() error {
|
||||
if err := f.load(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.process(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.write(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *GoConstantsWriter) load() error {
|
||||
if f.Input == nil {
|
||||
return errors.New("nil input")
|
||||
}
|
||||
b, err := io.ReadAll(f.Input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read input: %w", err)
|
||||
}
|
||||
if len(b) == 0 {
|
||||
return errors.New("nothing was read")
|
||||
}
|
||||
if err := yaml.Unmarshal(b, &f.cfg); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal raw YAML from input: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *GoConstantsWriter) process() error {
|
||||
if f.Tmpl == nil {
|
||||
return errors.New("nil template")
|
||||
}
|
||||
// This sorts the keys alphabetically to process the map in a fixed order.
|
||||
keys := make([]string, 0, len(f.cfg))
|
||||
for k := range f.cfg {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
capitalize := cases.Title(language.English, cases.NoLower)
|
||||
var builder strings.Builder
|
||||
for _, k := range keys {
|
||||
v := f.cfg[k]
|
||||
// Capitalize the key to make the constant exported in the generated Go file.
|
||||
k = capitalize.String(k)
|
||||
s := fmt.Sprintf("\t%s = %q\n", k, v)
|
||||
builder.WriteString(s)
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
if err := f.Tmpl.Execute(buf, builder.String()); err != nil {
|
||||
return err
|
||||
}
|
||||
f.buf = buf.Bytes()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *GoConstantsWriter) write() error {
|
||||
if f.Output == nil {
|
||||
return errors.New("nil output")
|
||||
}
|
||||
formatted, err := format.Source(f.buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = f.Output.Write(formatted)
|
||||
return err
|
||||
}
|
||||
117
pkg/codegen/buildconfig/writer_test.go
Normal file
117
pkg/codegen/buildconfig/writer_test.go
Normal file
@@ -0,0 +1,117 @@
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"testing"
|
||||
"text/template"
|
||||
|
||||
"github.com/rancher/rancher/pkg/codegen/buildconfig"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGoConstantsWriterRun(t *testing.T) {
|
||||
t.Parallel()
|
||||
const contents = `b: 3
|
||||
a: foo
|
||||
c: 3.14`
|
||||
in := bytes.NewBufferString(contents)
|
||||
out := new(bytes.Buffer)
|
||||
|
||||
const rawTemplate = `
|
||||
package buildconfig
|
||||
|
||||
const (
|
||||
{{ . }})
|
||||
`
|
||||
tmpl, err := template.New("").Parse(rawTemplate)
|
||||
require.NoError(t, err)
|
||||
w := &main.GoConstantsWriter{
|
||||
Tmpl: tmpl,
|
||||
Input: in,
|
||||
Output: out,
|
||||
}
|
||||
require.NoError(t, w.Run())
|
||||
|
||||
want :=
|
||||
`package buildconfig
|
||||
|
||||
const (
|
||||
A = "foo"
|
||||
B = "3"
|
||||
C = "3.14"
|
||||
)
|
||||
`
|
||||
got := out.String()
|
||||
require.Equal(t, want, got)
|
||||
|
||||
// Running a second time with the same Input source must fail.
|
||||
require.Error(t, w.Run())
|
||||
}
|
||||
|
||||
func TestGoConstantsWriterFailsWithBadConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
const rawTemplate = `
|
||||
package buildconfig
|
||||
|
||||
const (
|
||||
{{ . }})
|
||||
`
|
||||
tmpl, err := template.New("").Parse(rawTemplate)
|
||||
require.NoError(t, err)
|
||||
const contents = `a: foo
|
||||
b: 3
|
||||
c: 3.14`
|
||||
output := new(bytes.Buffer)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
tmpl *template.Template
|
||||
input io.Reader
|
||||
output io.Writer
|
||||
}{
|
||||
{
|
||||
name: "nil template",
|
||||
tmpl: nil,
|
||||
input: bytes.NewBufferString(contents),
|
||||
output: output,
|
||||
},
|
||||
{
|
||||
name: "empty template",
|
||||
tmpl: template.New(""),
|
||||
input: bytes.NewBufferString(contents),
|
||||
output: output,
|
||||
},
|
||||
{
|
||||
name: "nil input",
|
||||
tmpl: tmpl,
|
||||
input: nil,
|
||||
output: output,
|
||||
},
|
||||
{
|
||||
name: "empty input",
|
||||
tmpl: tmpl,
|
||||
input: bytes.NewBufferString(""),
|
||||
output: output,
|
||||
},
|
||||
{
|
||||
name: "nil output",
|
||||
tmpl: tmpl,
|
||||
input: bytes.NewBufferString(contents),
|
||||
output: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := main.GoConstantsWriter{
|
||||
Input: test.input,
|
||||
Output: test.output,
|
||||
Tmpl: test.tmpl,
|
||||
}
|
||||
require.Error(t, w.Run())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
v32 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
|
||||
authsettings "github.com/rancher/rancher/pkg/auth/settings"
|
||||
"github.com/rancher/rancher/pkg/buildconfig"
|
||||
fleetconst "github.com/rancher/rancher/pkg/fleet"
|
||||
"github.com/sirupsen/logrus"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@@ -118,7 +119,7 @@ var (
|
||||
PartnerChartDefaultBranch = NewSetting("partner-chart-default-branch", "main")
|
||||
RKE2ChartDefaultBranch = NewSetting("rke2-chart-default-branch", "main")
|
||||
FleetDefaultWorkspaceName = NewSetting("fleet-default-workspace-name", fleetconst.ClustersDefaultNamespace) // fleetWorkspaceName to assign to clusters with none
|
||||
ShellImage = NewSetting("shell-image", "rancher/shell:v0.1.22")
|
||||
ShellImage = NewSetting("shell-image", buildconfig.DefaultShellVersion)
|
||||
IgnoreNodeName = NewSetting("ignore-node-name", "") // nodes to ignore when syncing v1.node to v3.node
|
||||
NoDefaultAdmin = NewSetting("no-default-admin", "")
|
||||
RestrictedDefaultAdmin = NewSetting("restricted-default-admin", "false") // When bootstrapping the admin for the first time, give them the global role restricted-admin
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
set -ex
|
||||
|
||||
source $(dirname $0)/version
|
||||
source $(dirname $0)/export-config
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ echo "-- chart/build --"
|
||||
|
||||
cd $(dirname $0)/..
|
||||
. ./version
|
||||
. ./export-config
|
||||
|
||||
cd ..
|
||||
mkdir -p build/chart
|
||||
@@ -15,8 +16,7 @@ cp -rf ${1} build/chart/rancher
|
||||
sed -i -e "s/%VERSION%/${CHART_VERSION}/g" build/chart/rancher/Chart.yaml
|
||||
sed -i -e "s/%APP_VERSION%/${APP_VERSION}/g" build/chart/rancher/Chart.yaml
|
||||
|
||||
# get the value of shell-image, such as rancher/shell:v0.1.6, from the file pkg/settings/setting.go
|
||||
post_delete_base=$(grep -i shell-image pkg/settings/setting.go | cut -d "," -f 2 | sed -e 's/"//g' | sed -e 's/)//g' | sed -e 's/ //g') || ""
|
||||
post_delete_base=$CATTLE_DEFAULT_SHELL_VERSION
|
||||
post_delete_image_name=$(echo "${post_delete_base}" | cut -d ":" -f 1) || ""
|
||||
post_delete_image_tag=$(echo "${post_delete_base}" | cut -d ":" -f 2) || ""
|
||||
if [[ ! ${post_delete_image_name} =~ ^rancher\/.+ ]]; then
|
||||
|
||||
19
scripts/export-config
Executable file
19
scripts/export-config
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
file="$(git rev-parse --show-toplevel)/build.yaml"
|
||||
|
||||
CATTLE_RANCHER_WEBHOOK_VERSION=$(yq -e '.webhookVersion' "$file")
|
||||
CATTLE_CSP_ADAPTER_MIN_VERSION=$(yq -e '.cspAdapterMinVersion' "$file")
|
||||
CATTLE_DEFAULT_SHELL_VERSION=$(yq -e '.defaultShellVersion' "$file")
|
||||
CATTLE_FLEET_VERSION=$(yq -e '.fleetVersion' "$file")
|
||||
|
||||
export CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
export CATTLE_CSP_ADAPTER_MIN_VERSION
|
||||
export CATTLE_DEFAULT_SHELL_VERSION
|
||||
export CATTLE_FLEET_VERSION
|
||||
@@ -2,8 +2,8 @@
|
||||
set -e
|
||||
|
||||
source $(dirname $0)/version
|
||||
|
||||
source package-env
|
||||
source $(dirname $0)/export-config
|
||||
source $(dirname $0)/package-env
|
||||
|
||||
cd $(dirname $0)/../package
|
||||
|
||||
@@ -21,9 +21,25 @@ if [ ${ARCH} == s390x ]; then
|
||||
ETCD_UNSUPPORTED_ARCH=s390x
|
||||
fi
|
||||
|
||||
docker build --build-arg VERSION=${TAG} --build-arg ETCD_UNSUPPORTED_ARCH=${ETCD_UNSUPPORTED_ARCH} --build-arg ARCH=${ARCH} --build-arg IMAGE_REPO=${REPO} --build-arg SYSTEM_CHART_DEFAULT_BRANCH=${SYSTEM_CHART_DEFAULT_BRANCH} --build-arg CHART_DEFAULT_BRANCH=${CHART_DEFAULT_BRANCH} -t ${IMAGE} .
|
||||
docker build \
|
||||
--build-arg VERSION=${TAG} \
|
||||
--build-arg ETCD_UNSUPPORTED_ARCH=${ETCD_UNSUPPORTED_ARCH} \
|
||||
--build-arg ARCH=${ARCH} \
|
||||
--build-arg IMAGE_REPO=${REPO} \
|
||||
--build-arg SYSTEM_CHART_DEFAULT_BRANCH=${SYSTEM_CHART_DEFAULT_BRANCH} \
|
||||
--build-arg CHART_DEFAULT_BRANCH=${CHART_DEFAULT_BRANCH} \
|
||||
--build-arg CATTLE_RANCHER_WEBHOOK_VERSION="${CATTLE_RANCHER_WEBHOOK_VERSION}" \
|
||||
--build-arg CATTLE_CSP_ADAPTER_MIN_VERSION="${CATTLE_CSP_ADAPTER_MIN_VERSION}" \
|
||||
--build-arg CATTLE_FLEET_VERSION="${CATTLE_FLEET_VERSION}" \
|
||||
-t ${IMAGE} .
|
||||
|
||||
docker build --build-arg VERSION=${TAG} --build-arg ARCH=${ARCH} --build-arg RANCHER_TAG=${TAG} --build-arg RANCHER_REPO=${REPO} -t ${AGENT_IMAGE} -f Dockerfile.agent .
|
||||
docker build \
|
||||
--build-arg VERSION=${TAG} \
|
||||
--build-arg ARCH=${ARCH} \
|
||||
--build-arg RANCHER_TAG=${TAG} \
|
||||
--build-arg CATTLE_RANCHER_WEBHOOK_VERSION="${CATTLE_RANCHER_WEBHOOK_VERSION}" \
|
||||
--build-arg RANCHER_REPO=${REPO} \
|
||||
-t ${AGENT_IMAGE} -f Dockerfile.agent .
|
||||
|
||||
mkdir -p ../dist
|
||||
echo ${IMAGE} > ../dist/images
|
||||
|
||||
@@ -57,9 +57,12 @@ ENV CATTLE_SYSTEM_UPGRADE_CONTROLLER_CHART_VERSION 103.0.0+up0.6.0
|
||||
# System charts minimal version
|
||||
# Deprecated in favor of CATTLE_FLEET_VERSION
|
||||
ENV CATTLE_FLEET_MIN_VERSION=""
|
||||
ENV CATTLE_FLEET_VERSION=103.1.0+up0.9.0-rc.4
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=103.0.1+up0.4.2
|
||||
ENV CATTLE_CSP_ADAPTER_MIN_VERSION=103.0.0+up3.0.0
|
||||
ARG CATTLE_FLEET_VERSION
|
||||
ENV CATTLE_FLEET_VERSION=$CATTLE_FLEET_VERSION
|
||||
ARG CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ARG CATTLE_CSP_ADAPTER_MIN_VERSION
|
||||
ENV CATTLE_CSP_ADAPTER_MIN_VERSION=$CATTLE_CSP_ADAPTER_MIN_VERSION
|
||||
|
||||
RUN mkdir -p /var/lib/rancher-data/local-catalogs/system-library && \
|
||||
mkdir -p /var/lib/rancher-data/local-catalogs/library && \
|
||||
|
||||
@@ -22,6 +22,8 @@ ENV AGENT_IMAGE ${RANCHER_REPO}/rancher-agent:${VERSION}
|
||||
# For now, this value needs to be manually synced with the one in the main Dockerfile. This pins downstream webhook's version.
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=103.0.1+up0.4.2
|
||||
ENV SSL_CERT_DIR /etc/kubernetes/ssl/certs
|
||||
ARG CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
ENV CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
|
||||
COPY --from=rancher /var/lib/rancher-data /var/lib/rancher-data
|
||||
COPY --from=rancher /usr/bin/tini /usr/bin/
|
||||
COPY agent run_agent.sh kubectl-shell.sh shell-setup.sh /usr/bin/
|
||||
|
||||
@@ -4,6 +4,7 @@ set -e
|
||||
cd $(dirname $0)/../../../../
|
||||
|
||||
source $(dirname $0)/scripts/version
|
||||
source $(dirname $0)/scripts/export-config
|
||||
|
||||
mkdir -p bin
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ set -ex
|
||||
cd $(dirname $0)/../../../../
|
||||
|
||||
source $(dirname $0)/scripts/version
|
||||
source $(dirname $0)/scripts/export-config
|
||||
|
||||
CATTLE_KDM_BRANCH=dev-v2.8
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source $(dirname $0)/../../../../scripts/export-config
|
||||
|
||||
ARCH=${ARCH:-"amd64"}
|
||||
REPO=ranchertest
|
||||
TAG=v2.7-head
|
||||
@@ -22,10 +24,23 @@ IMAGE=${REPO}/rancher:${TAG}
|
||||
AGENT_IMAGE=${REPO}/rancher-agent:${TAG}
|
||||
|
||||
echo "building rancher test docker image"
|
||||
docker build --build-arg VERSION=${TAG} --build-arg ARCH=${ARCH} --build-arg IMAGE_REPO=${REPO} -t ${IMAGE} -f Dockerfile . --no-cache
|
||||
docker build \
|
||||
--build-arg VERSION=${TAG} \
|
||||
--build-arg ARCH=${ARCH} \
|
||||
--build-arg IMAGE_REPO=${REPO} \
|
||||
--build-arg CATTLE_RANCHER_WEBHOOK_VERSION="${CATTLE_RANCHER_WEBHOOK_VERSION}" \
|
||||
--build-arg CATTLE_CSP_ADAPTER_MIN_VERSION="${CATTLE_CSP_ADAPTER_MIN_VERSION}" \
|
||||
--build-arg CATTLE_FLEET_VERSION="${CATTLE_FLEET_VERSION}" \
|
||||
-t ${IMAGE} -f Dockerfile . --no-cache
|
||||
|
||||
echo "building agent test docker image"
|
||||
docker build --build-arg VERSION=${TAG} --build-arg ARCH=${ARCH} --build-arg RANCHER_TAG=${TAG} --build-arg RANCHER_REPO=${REPO} -t ${AGENT_IMAGE} -f Dockerfile.agent . --no-cache
|
||||
docker build \
|
||||
--build-arg VERSION=${TAG} \
|
||||
--build-arg ARCH=${ARCH} \
|
||||
--build-arg RANCHER_TAG=${TAG} \
|
||||
--build-arg RANCHER_REPO=${REPO} \
|
||||
--build-arg CATTLE_RANCHER_WEBHOOK_VERSION="${CATTLE_RANCHER_WEBHOOK_VERSION}" \
|
||||
-t ${AGENT_IMAGE} -f Dockerfile.agent . --no-cache
|
||||
|
||||
echo ${DOCKERHUB_PASSWORD} | docker login --username ${DOCKERHUB_USERNAME} --password-stdin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user