Compare commits

...

3 Commits

Author SHA1 Message Date
Oscar Zhou
f8b9d2501c chore: convert the specific error message to constant string type 2022-12-22 08:28:40 +13:00
Oscar Zhou
26c676456f fix(swarm/update): pass the potential errors to compose deployer 2022-12-22 03:05:25 +13:00
Oscar Zhou
0cfe0b87e2 fix(swarm/update): set env SKIP_PULL to 0 by default 2022-12-22 00:11:58 +13:00
4 changed files with 11 additions and 9 deletions

View File

@@ -35,7 +35,7 @@ require (
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/portainer/docker-compose-wrapper v0.0.0-20221215210951-2c30d1b17a27
github.com/portainer/docker-compose-wrapper v0.0.0-20221221135649-4b6a34dcca80
github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a
github.com/portainer/libhttp v0.0.0-20221121135534-76f46e09c9a9
github.com/portainer/portainer/pkg/libhelm v0.0.0-20221201012749-4fee35924724

View File

@@ -336,10 +336,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/portainer/docker-compose-wrapper v0.0.0-20221122145319-915b021aea84 h1:d1P8i0pCPvAfxH6nSLUFm6NYoi8tMrIpafaZXSV8Lac=
github.com/portainer/docker-compose-wrapper v0.0.0-20221122145319-915b021aea84/go.mod h1:03UmPLyjiPUexGJuW20mQXvmsoSpeErvMlItJGtq/Ww=
github.com/portainer/docker-compose-wrapper v0.0.0-20221215210951-2c30d1b17a27 h1:PceCpp86SDYb3lZHT4KpuBCkmcJMW5x1qrdFNEfAdUo=
github.com/portainer/docker-compose-wrapper v0.0.0-20221215210951-2c30d1b17a27/go.mod h1:03UmPLyjiPUexGJuW20mQXvmsoSpeErvMlItJGtq/Ww=
github.com/portainer/docker-compose-wrapper v0.0.0-20221221135649-4b6a34dcca80 h1:EybuiLzP2/bW9ciPBlmIP0dKj+WrHqNfDzzi0KqvsLU=
github.com/portainer/docker-compose-wrapper v0.0.0-20221221135649-4b6a34dcca80/go.mod h1:03UmPLyjiPUexGJuW20mQXvmsoSpeErvMlItJGtq/Ww=
github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a h1:B0z3skIMT+OwVNJPQhKp52X+9OWW6A9n5UWig3lHBJk=
github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a/go.mod h1:n54EEIq+MM0NNtqLeCby8ljL+l275VpolXO0ibHegLE=
github.com/portainer/libhttp v0.0.0-20221121135534-76f46e09c9a9 h1:L7o0L+1qq+LzKjzgRB6bDIh5ZrZ5A1oSS+WgWzDgJIo=

View File

@@ -29,7 +29,9 @@ const (
skipPullImageEnvVar = "UPGRADE_SKIP_PULL_PORTAINER_IMAGE"
// updaterImageEnvVar represents the name of the environment variable used to define the updater image
// useful if there's a need to test a different updater
updaterImageEnvVar = "UPGRADE_UPDATER_IMAGE"
updaterImageEnvVar = "UPGRADE_UPDATER_IMAGE"
errMessageUpdateFailure = "update failure"
errMessagePullImageFailure = "pull image failure"
)
type Service interface {
@@ -125,6 +127,10 @@ func (service *service) upgradeDocker(licenseKey, version, envType string) error
AbortOnContainerExit: true,
Options: libstack.Options{
ProjectName: projectName,
PotentialErrors: []string{
errMessageUpdateFailure,
errMessagePullImageFailure,
},
},
},
)

View File

@@ -8,10 +8,8 @@ services:
"--env-type", "{{envType}}{{^envType}}standalone{{/envType}}",
"--license", "{{license}}"
]
{{#skip_pull_image}}
environment:
- SKIP_PULL=1
{{/skip_pull_image}}
- SKIP_PULL={{skip_pull_image}}{{^skip_pull_image}}0{{/skip_pull_image}}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
{{! - \\.\pipe\docker_engine:\\.\pipe\docker_engine }}