Compare commits
8 Commits
v1.5.3
...
v1.5.4-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eccf9554c8 | ||
|
|
5db4908235 | ||
|
|
2f988130e8 | ||
|
|
7b5653473b | ||
|
|
7bff07ed07 | ||
|
|
7a5420e8bb | ||
|
|
0e22f6f06f | ||
|
|
2221445ffe |
@@ -60,7 +60,7 @@ ARG DISTRIB_ID=RancherOS
|
||||
|
||||
ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.3/policy.29
|
||||
|
||||
ARG KERNEL_VERSION=4.14.128-rancher
|
||||
ARG KERNEL_VERSION=4.14.138-rancher
|
||||
ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION}/linux-${KERNEL_VERSION}-x86.tar.gz
|
||||
ARG KERNEL_URL_arm64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION}/linux-${KERNEL_VERSION}-arm64.tar.gz
|
||||
|
||||
@@ -85,7 +85,7 @@ ARG SYSTEM_DOCKER_VERSION=17.06-ros6
|
||||
ARG SYSTEM_DOCKER_URL_amd64=https://github.com/rancher/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-amd64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
ARG SYSTEM_DOCKER_URL_arm64=https://github.com/rancher/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-arm64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
|
||||
ARG USER_DOCKER_VERSION=18.06.3
|
||||
ARG USER_DOCKER_VERSION=18.09.8
|
||||
ARG USER_DOCKER_ENGINE_VERSION=docker-${USER_DOCKER_VERSION}-ce
|
||||
|
||||
ARG AZURE_SERVICE=false
|
||||
|
||||
18
Makefile
18
Makefile
@@ -41,7 +41,7 @@ release: .dapper release-build
|
||||
|
||||
release-build:
|
||||
mkdir -p dist
|
||||
./.dapper release 2>&1 | tee dist/release.log
|
||||
./.dapper release
|
||||
|
||||
rpi64: .dapper
|
||||
./scripts/release-rpi64
|
||||
@@ -49,34 +49,34 @@ rpi64: .dapper
|
||||
vmware: .dapper
|
||||
mkdir -p dist
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-openvmtools:10.3.10-1" \
|
||||
./.dapper release-vmware 2>&1 | tee dist/release.log
|
||||
./.dapper release-vmware
|
||||
|
||||
hyperv: .dapper
|
||||
mkdir -p dist
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.128-rancher-1" \
|
||||
./.dapper release-hyperv 2>&1 | tee dist/release.log
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.138-rancher-1" \
|
||||
./.dapper release-hyperv
|
||||
|
||||
azurebase: .dapper
|
||||
mkdir -p dist
|
||||
AZURE_SERVICE="true" \
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.128-rancher-1 rancher/os-waagent:v2.2.34-1" \
|
||||
./.dapper release-azurebase 2>&1 | tee dist/release.log
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.138-rancher-1 rancher/os-waagent:v2.2.34-1" \
|
||||
./.dapper release-azurebase
|
||||
|
||||
4glte: .dapper
|
||||
mkdir -p dist
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-modemmanager:v1.6.4-1" \
|
||||
./.dapper release-4glte 2>&1 | tee dist/release.log
|
||||
./.dapper release-4glte
|
||||
|
||||
proxmoxve: .dapper
|
||||
mkdir -p dist
|
||||
PROXMOXVE_SERVICE="true" \
|
||||
APPEND_SYSTEM_IMAGES="rancher/os-qemuguestagent:v2.8.1-2" \
|
||||
./.dapper release-proxmoxve 2>&1 | tee dist/release.log
|
||||
./.dapper release-proxmoxve
|
||||
|
||||
pingan: .dapper
|
||||
mkdir -p dist
|
||||
APPEND_SYSTEM_IMAGES="cnrancher/os-pingan-amc:v0.0.6-1" \
|
||||
./.dapper release-pingan 2>&1 | tee dist/release.log
|
||||
./.dapper release-pingan
|
||||
|
||||
help:
|
||||
@./scripts/help
|
||||
|
||||
96
README.md
96
README.md
@@ -18,68 +18,68 @@ it would really be bad if somebody did `docker rm -f $(docker ps -qa)` and delet
|
||||
|
||||
## Release
|
||||
|
||||
- **v1.5.2 - Docker 18.06.3-ce - Linux 4.14.122**
|
||||
- **v1.5.3 - Docker 18.06.3-ce - Linux 4.14.128**
|
||||
|
||||
### ISO
|
||||
|
||||
- https://releases.rancher.com/os/v1.5.2/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.2/hyperv/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.2/4glte/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.2/vmware/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/hyperv/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/4glte/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/vmware/rancheros.iso
|
||||
|
||||
#### Special docker-machine Links
|
||||
|
||||
- https://releases.rancher.com/os/v1.5.2/vmware/rancheros-autoformat.iso
|
||||
- https://releases.rancher.com/os/v1.5.2/proxmoxve/rancheros-autoformat.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/vmware/rancheros-autoformat.iso
|
||||
- https://releases.rancher.com/os/v1.5.3/proxmoxve/rancheros-autoformat.iso
|
||||
|
||||
### Additional Downloads
|
||||
|
||||
#### AMD64 Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros.ipxe
|
||||
* https://releases.rancher.com/os/v1.5.2/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros.ipxe
|
||||
* https://releases.rancher.com/os/v1.5.3/rootfs.tar.gz
|
||||
|
||||
#### ARM64 Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/arm64/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/arm64/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.5.2/arm64/rootfs_arm64.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.2/arm64/rancheros-raspberry-pi64.zip
|
||||
* https://releases.rancher.com/os/v1.5.3/arm64/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/arm64/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.5.3/arm64/rootfs_arm64.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/arm64/rancheros-raspberry-pi64.zip
|
||||
|
||||
#### Cloud Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros-openstack.img
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros-digitalocean.img
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros-cloudstack.img
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros-aliyun.vhd
|
||||
* https://releases.rancher.com/os/v1.5.2/rancheros-gce.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros-openstack.img
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros-digitalocean.img
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros-cloudstack.img
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros-aliyun.vhd
|
||||
* https://releases.rancher.com/os/v1.5.3/rancheros-gce.tar.gz
|
||||
|
||||
#### VMware Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/vmware/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/vmware/rancheros.vmdk
|
||||
* https://releases.rancher.com/os/v1.5.2/vmware/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/vmware/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/vmware/rancheros.vmdk
|
||||
* https://releases.rancher.com/os/v1.5.3/vmware/rootfs.tar.gz
|
||||
|
||||
#### Hyper-V Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/hyperv/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/hyperv/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/hyperv/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/hyperv/rootfs.tar.gz
|
||||
|
||||
#### Proxmox VE Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/proxmoxve/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/proxmoxve/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/proxmoxve/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/proxmoxve/rootfs.tar.gz
|
||||
|
||||
#### 4G-LTE Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.5.2/4glte/initrd
|
||||
* https://releases.rancher.com/os/v1.5.2/4glte/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.5.3/4glte/initrd
|
||||
* https://releases.rancher.com/os/v1.5.3/4glte/rootfs.tar.gz
|
||||
|
||||
**Note**:
|
||||
1. you can use `http` instead of `https` in the above URLs, e.g. for iPXE.
|
||||
2. you can use `latest` instead of `v1.5.2` in the above URLs if you want to get the latest version.
|
||||
2. you can use `latest` instead of `v1.5.3` in the above URLs if you want to get the latest version.
|
||||
|
||||
### Amazon
|
||||
|
||||
@@ -89,24 +89,24 @@ SSH keys are added to the **`rancher`** user, so you must log in using the **ran
|
||||
|
||||
Region | Type | AMI
|
||||
-------|------|------
|
||||
eu-north-1 | HVM | [ami-0aa8ffa25f6e1efde](https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#launchInstanceWizard:ami=ami-0aa8ffa25f6e1efde)
|
||||
ap-south-1 | HVM | [ami-0242ded9a2babdd16](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-0242ded9a2babdd16)
|
||||
eu-west-3 | HVM | [ami-0d5e80dd7cf83c454](https://eu-west-3.console.aws.amazon.com/ec2/home?region=eu-west-3#launchInstanceWizard:ami=ami-0d5e80dd7cf83c454)
|
||||
eu-west-2 | HVM | [ami-0b515596d0142c803](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-0b515596d0142c803)
|
||||
eu-west-1 | HVM | [ami-0fc57d05033e40c9a](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-0fc57d05033e40c9a)
|
||||
ap-northeast-2 | HVM | [ami-0f774aa413d566bb3](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-0f774aa413d566bb3)
|
||||
ap-northeast-1 | HVM | [ami-0abd1183e2a1b1625](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-0abd1183e2a1b1625)
|
||||
sa-east-1 | HVM | [ami-08a209b9496752f95](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-08a209b9496752f95)
|
||||
ca-central-1 | HVM | [ami-0cdb68ee4c252ae76](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-0cdb68ee4c252ae76)
|
||||
ap-southeast-1 | HVM | [ami-0c73b877aa0d98192](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-0c73b877aa0d98192)
|
||||
ap-southeast-2 | HVM | [ami-0be67ac778f4ad7af](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-0be67ac778f4ad7af)
|
||||
eu-central-1 | HVM | [ami-0bb3da893b09eed0f](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-0bb3da893b09eed0f)
|
||||
us-east-1 | HVM | [ami-076d20da54e4b7273](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-076d20da54e4b7273)
|
||||
us-east-2 | HVM | [ami-0f675b8ec29c77ad1](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-0f675b8ec29c77ad1)
|
||||
us-west-1 | HVM | [ami-03d7f51e044136810](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-03d7f51e044136810)
|
||||
us-west-2 | HVM | [ami-05cd1799ca3e6554e](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-05cd1799ca3e6554e)
|
||||
cn-north-1 | HVM | [ami-07182a16c8c01728a](https://cn-north-1.console.amazonaws.cn/ec2/home?region=cn-north-1#launchInstanceWizard:ami=ami-07182a16c8c01728a)
|
||||
cn-northwest-1 | HVM | [ami-0a62672334ad89e86](https://cn-northwest-1.console.amazonaws.cn/ec2/home?region=cn-northwest-1#launchInstanceWizard:ami=ami-0a62672334ad89e86)
|
||||
eu-north-1 | HVM | [ami-0d0ee5e9b88ab3641](https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#launchInstanceWizard:ami=ami-0d0ee5e9b88ab3641)
|
||||
ap-south-1 | HVM | [ami-0e64d18d3546bc0e3](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-0e64d18d3546bc0e3)
|
||||
eu-west-3 | HVM | [ami-0f1cfb7093ca6f8c6](https://eu-west-3.console.aws.amazon.com/ec2/home?region=eu-west-3#launchInstanceWizard:ami=ami-0f1cfb7093ca6f8c6)
|
||||
eu-west-2 | HVM | [ami-0fb2092ee913a1deb](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-0fb2092ee913a1deb)
|
||||
eu-west-1 | HVM | [ami-01bcb29c6aebb24bb](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-01bcb29c6aebb24bb)
|
||||
ap-northeast-2 | HVM | [ami-0c52edead8ffab5d0](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-0c52edead8ffab5d0)
|
||||
ap-northeast-1 | HVM | [ami-0b6f89180ebf76c13](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-0b6f89180ebf76c13)
|
||||
sa-east-1 | HVM | [ami-04ab75c51a5fc9be6](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-04ab75c51a5fc9be6)
|
||||
ca-central-1 | HVM | [ami-0dd7a2d93147d7eff](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-0dd7a2d93147d7eff)
|
||||
ap-southeast-1 | HVM | [ami-058ff3e97841ed000](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-058ff3e97841ed000)
|
||||
ap-southeast-2 | HVM | [ami-07bc506efd2ade5f1](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-07bc506efd2ade5f1)
|
||||
eu-central-1 | HVM | [ami-0143355d2c9ff8db5](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-0143355d2c9ff8db5)
|
||||
us-east-1 | HVM | [ami-0a48e384fc0262754](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-0a48e384fc0262754)
|
||||
us-east-2 | HVM | [ami-03cc2d26e5ad831ea](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-03cc2d26e5ad831ea)
|
||||
us-west-1 | HVM | [ami-0d1728efec5c95f06](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-0d1728efec5c95f06)
|
||||
us-west-2 | HVM | [ami-0d5f95b9a27dfef6f](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-0d5f95b9a27dfef6f)
|
||||
cn-north-1 | HVM | [ami-08e1d5d0aa44a7606](https://cn-north-1.console.amazonaws.cn/ec2/home?region=cn-north-1#launchInstanceWizard:ami=ami-08e1d5d0aa44a7606)
|
||||
cn-northwest-1 | HVM | [ami-0847a5ca9e1b24751](https://cn-northwest-1.console.amazonaws.cn/ec2/home?region=cn-northwest-1#launchInstanceWizard:ami=ami-0847a5ca9e1b24751)
|
||||
|
||||
Additionally, images are available with support for Amazon EC2 Container Service (ECS) [here](https://rancher.com/docs/os/v1.x/en/installation/amazon-ecs/#amazon-ecs-enabled-amis).
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/pkg/log"
|
||||
"github.com/rancher/os/pkg/util/versions"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -34,6 +35,7 @@ func formatImage(image string, cfg *config.CloudConfig) string {
|
||||
}
|
||||
|
||||
func symLinkEngineBinary(version string) []symlink {
|
||||
versionNum := strings.Replace(strings.Replace(version, "docker-", "", -1), "-ce", "", -1)
|
||||
baseSymlink := []symlink{
|
||||
{"/var/lib/rancher/engine/docker", "/usr/bin/docker"},
|
||||
{"/var/lib/rancher/engine/dockerd", "/usr/bin/dockerd"},
|
||||
@@ -42,7 +44,7 @@ func symLinkEngineBinary(version string) []symlink {
|
||||
{"/usr/share/ros/os-release", "/usr/lib/os-release"},
|
||||
{"/usr/share/ros/os-release", "/etc/os-release"},
|
||||
}
|
||||
if strings.Contains(version, "18.09") {
|
||||
if versions.GreaterThanOrEqualTo(versionNum, "18.09.0") {
|
||||
baseSymlink = append(baseSymlink, []symlink{
|
||||
{"/var/lib/rancher/engine/containerd", "/usr/bin/containerd"},
|
||||
{"/var/lib/rancher/engine/ctr", "/usr/bin/ctr"},
|
||||
|
||||
@@ -3,46 +3,59 @@ set -e -x
|
||||
|
||||
gateway_address="http://ros.rancher.io/gateway"
|
||||
|
||||
_sigProcess() {
|
||||
sigProcess() {
|
||||
echo "SIGINT/SIGTERM signal..."
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
trap _sigProcess SIGINT SIGKILL SIGTERM
|
||||
trap sigProcess SIGINT SIGKILL SIGTERM
|
||||
|
||||
__read_policy() {
|
||||
read_policy() {
|
||||
policy=`ros c get rancher.upgrade.policy`
|
||||
if [ -z $policy ]; then
|
||||
if [[ -z ${policy} ]]; then
|
||||
echo "can not read upgrade.policy"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
return $(($policy))
|
||||
}
|
||||
|
||||
__report_activity() {
|
||||
report_activity() {
|
||||
arch=`uname -m`
|
||||
uuid=`cat /sys/class/dmi/id/product_uuid || true`
|
||||
release=`ros -v | awk '{print $2}'`
|
||||
response=`wget --server-response ${gateway_address}/report --header 'Accept: application/json' --header 'Content-type: application/json' --header "arch: $arch" --header "uuid: $uuid" --header "release: $release" 2>&1 | awk '/^ HTTP/{print $2}'`
|
||||
if [ $response -ge 200 -a $response -le 300 ]; then
|
||||
if [[ -n ${response} && ${response} -ge 200 && ${response} -le 300 ]]; then
|
||||
echo "report activity success"
|
||||
else
|
||||
echo "report activity failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
__upgrade_operate() {
|
||||
upgrade_operate() {
|
||||
recommend_version=`wget ${gateway_address}/version -q -O -`
|
||||
case $policy in
|
||||
case ${policy} in
|
||||
download)
|
||||
echo "upgrade.policy is 'download'"
|
||||
__report_activity
|
||||
system-docker pull $recommend_version
|
||||
report_activity
|
||||
if [[ ${recommend_version} ]];
|
||||
then
|
||||
system-docker pull ${recommend_version}
|
||||
else
|
||||
echo "pull recommend image failed"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
auto)
|
||||
echo "upgrade.policy is 'auto'"
|
||||
__report_activity
|
||||
ros os upgrade -i $recommend_version -f
|
||||
report_activity
|
||||
if [[ ${recommend_version} ]];
|
||||
then
|
||||
ros os upgrade -i ${recommend_version} -f
|
||||
else
|
||||
echo "execute ros os upgrade failed"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
none)
|
||||
echo "upgrade.policy is 'none'"
|
||||
@@ -53,6 +66,12 @@ __upgrade_operate() {
|
||||
esac
|
||||
}
|
||||
|
||||
__read_policy
|
||||
read_policy
|
||||
|
||||
__upgrade_operate
|
||||
n=0
|
||||
until [[ ${n} -ge 5 ]]
|
||||
do
|
||||
upgrade_operate && break
|
||||
n=$[$n+1]
|
||||
sleep 5
|
||||
done
|
||||
@@ -83,7 +83,9 @@ func checkAllDefaultGW() bool {
|
||||
|
||||
func AllDefaultGWOK(timeout int) error {
|
||||
backoff := util.Backoff{
|
||||
MaxMillis: timeout,
|
||||
StartMillis: 100,
|
||||
MaxIntervalMillis: 2000,
|
||||
MaxMillis: timeout,
|
||||
}
|
||||
defer backoff.Close()
|
||||
|
||||
|
||||
62
pkg/util/versions/compare.go
Normal file
62
pkg/util/versions/compare.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package versions
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// compare compares two version strings
|
||||
// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise.
|
||||
func compare(v1, v2 string) int {
|
||||
var (
|
||||
currTab = strings.Split(v1, ".")
|
||||
otherTab = strings.Split(v2, ".")
|
||||
)
|
||||
|
||||
max := len(currTab)
|
||||
if len(otherTab) > max {
|
||||
max = len(otherTab)
|
||||
}
|
||||
for i := 0; i < max; i++ {
|
||||
var currInt, otherInt int
|
||||
|
||||
if len(currTab) > i {
|
||||
currInt, _ = strconv.Atoi(currTab[i])
|
||||
}
|
||||
if len(otherTab) > i {
|
||||
otherInt, _ = strconv.Atoi(otherTab[i])
|
||||
}
|
||||
if currInt > otherInt {
|
||||
return 1
|
||||
}
|
||||
if otherInt > currInt {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// LessThan checks if a version is less than another
|
||||
func LessThan(v, other string) bool {
|
||||
return compare(v, other) == -1
|
||||
}
|
||||
|
||||
// LessThanOrEqualTo checks if a version is less than or equal to another
|
||||
func LessThanOrEqualTo(v, other string) bool {
|
||||
return compare(v, other) <= 0
|
||||
}
|
||||
|
||||
// GreaterThan checks if a version is greater than another
|
||||
func GreaterThan(v, other string) bool {
|
||||
return compare(v, other) == 1
|
||||
}
|
||||
|
||||
// GreaterThanOrEqualTo checks if a version is greater than or equal to another
|
||||
func GreaterThanOrEqualTo(v, other string) bool {
|
||||
return compare(v, other) >= 0
|
||||
}
|
||||
|
||||
// Equal checks if a version is equal to another
|
||||
func Equal(v, other string) bool {
|
||||
return compare(v, other) == 0
|
||||
}
|
||||
26
pkg/util/versions/compare_test.go
Normal file
26
pkg/util/versions/compare_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package versions
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func assertVersion(t *testing.T, a, b string, result int) {
|
||||
if r := compare(a, b); r != result {
|
||||
t.Fatalf("Unexpected version comparison result. Found %d, expected %d", r, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompareVersion(t *testing.T) {
|
||||
assertVersion(t, "1.12", "1.12", 0)
|
||||
assertVersion(t, "1.0.0", "1", 0)
|
||||
assertVersion(t, "1", "1.0.0", 0)
|
||||
assertVersion(t, "1.05.00.0156", "1.0.221.9289", 1)
|
||||
assertVersion(t, "1", "1.0.1", -1)
|
||||
assertVersion(t, "1.0.1", "1", 1)
|
||||
assertVersion(t, "1.0.1", "1.0.2", -1)
|
||||
assertVersion(t, "1.0.2", "1.0.3", -1)
|
||||
assertVersion(t, "1.0.3", "1.1", -1)
|
||||
assertVersion(t, "1.1", "1.1.1", -1)
|
||||
assertVersion(t, "1.1.1", "1.1.2", -1)
|
||||
assertVersion(t, "1.1.2", "1.2", -1)
|
||||
}
|
||||
Reference in New Issue
Block a user