Merge pull request #148 from nextcloud/enh/noid/update-channel-and-publish-logic

update channel and publish logic for building containers for multiple architectures
This commit is contained in:
Simon L 2022-01-19 13:55:25 +01:00 committed by GitHub
commit 46a566d237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 18 deletions

View file

@ -16,6 +16,7 @@ It will now also select the developer channel for all other containers automatic
## How to promote builds from develop to latest ## How to promote builds from develop to latest
<!---
You can use the Docker CLI to promote builds from develop to latest. Make sure to adjust: You can use the Docker CLI to promote builds from develop to latest. Make sure to adjust:
- $name - $name
@ -28,13 +29,25 @@ docker pull nextcloud/$AIO_NAME@sha256:$AIO_DIGEST
docker tag nextcloud/$AIO_NAME@sha256:$AIO_DIGEST nextcloud/$AIO_NAME\:latest docker tag nextcloud/$AIO_NAME@sha256:$AIO_DIGEST nextcloud/$AIO_NAME\:latest
docker push nextcloud/$AIO_NAME\:latest docker push nextcloud/$AIO_NAME\:latest
``` ```
--->
To automatically promoted the latest develop version you can use the following script: To automatically promoted the latest develop version you can use the following script:
**WARNING:** Make sure to verify that the latest develop tag is what you really want to deploy since someone could have pushed to main and created a new container in between. **WARNING:** Make sure to verify that the latest develop tag is what you really want to deploy since someone could have pushed to main and created a new container in between.
```shell ```shell
# x64
export AIO_NAME=$name export AIO_NAME=$name
docker pull nextcloud/$AIO_NAME\:develop docker pull nextcloud/$AIO_NAME\:develop
docker tag nextcloud/$AIO_NAME\:develop nextcloud/$AIO_NAME\:latest docker tag nextcloud/$AIO_NAME\:develop nextcloud/$AIO_NAME\:latest
docker push nextcloud/$AIO_NAME\:latest docker push nextcloud/$AIO_NAME\:latest
``` ```
**ATTENTION**: don't run the script below since the arm64 containers currently don't work!
```shell
# arm64
export AIO_NAME=$name
docker pull nextcloud/$AIO_NAME\:develop-arm64
docker tag nextcloud/$AIO_NAME\:develop-arm64 nextcloud/$AIO_NAME\:latest-arm64
docker push nextcloud/$AIO_NAME\:latest-arm64
```
Later when the arm64 containers work, we can simply publish to latest and latest-arm64 in a rush by providing the name one time at the top of the script.

View file

@ -47,12 +47,7 @@ class DockerActionManager
} }
private function BuildImageName(Container $container) : string { private function BuildImageName(Container $container) : string {
$channel = $this->GetCurrentChannel(); return $container->GetContainerName() . ':' . $this->GetCurrentChannel();
if ($channel === 'develop') {
return $container->GetContainerName() . ':develop';
} else {
return $container->GetContainerName() . ':latest';
}
} }
public function GetContainerRunningState(Container $container) : IContainerState public function GetContainerRunningState(Container $container) : IContainerState
@ -79,12 +74,7 @@ class DockerActionManager
public function GetContainerUpdateState(Container $container) : IContainerState public function GetContainerUpdateState(Container $container) : IContainerState
{ {
$channel = $this->GetCurrentChannel(); $tag = $this->GetCurrentChannel();
if ($channel === 'develop') {
$tag = 'develop';
} else {
$tag = 'latest';
}
$runningDigest = $this->GetRepoDigestOfContainer($container->GetIdentifier()); $runningDigest = $this->GetRepoDigestOfContainer($container->GetIdentifier());
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($container->GetContainerName(), $tag); $remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($container->GetContainerName(), $tag);
@ -350,12 +340,7 @@ class DockerActionManager
$imageName = 'nextcloud/all-in-one'; $imageName = 'nextcloud/all-in-one';
$containerName = 'nextcloud-aio-mastercontainer'; $containerName = 'nextcloud-aio-mastercontainer';
$channel = $this->GetCurrentChannel(); $tag = $this->GetCurrentChannel();
if ($channel === 'develop') {
$tag = 'develop';
} else {
$tag = 'latest';
}
$runningDigest = $this->GetRepoDigestOfContainer($containerName); $runningDigest = $this->GetRepoDigestOfContainer($containerName);
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($imageName, $tag); $remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($imageName, $tag);