-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: additional templating and logic fixes (#346)
* fix: no imagecache for pull through images if dockerhub credentials are provided * fix: add missing LAGOON_SSH_PRIVATE_KEY build arg * fix: fsgroup 0 on services that had it previously * fix: trim whitespace from cron * test: add test for rootless workload with cronjobs * test: add not enough and too many field checks for cronjobs with better error * fix: k8up newer version backup annotation on deployments
- Loading branch information
1 parent
8c4437d
commit 2fa66e0
Showing
44 changed files
with
1,282 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_GIT_SHA": "abcdefg123456", | ||
"LAGOON_GIT_BRANCH": "main", | ||
"NODE_IMAGE": "example-project-main-node", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -85,6 +86,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"CLI_IMAGE": "example-project-main-cli", | ||
"NGINX_IMAGE": "example-project-main-nginx", | ||
"PHP_IMAGE": "example-project-main-php", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -172,6 +174,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"NGINX_IMAGE": "example-project-main-nginx", | ||
"PHP_IMAGE": "example-project-main-php", | ||
"LAGOON_FEATURE_FLAG_IMAGECACHE_REGISTRY": "imagecache.example.com", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -247,6 +250,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LND_IMAGE": "example-project-main-lnd", | ||
"THUNDERHUB_IMAGE": "example-project-main-thunderhub", | ||
"TOR_IMAGE": "example-project-main-tor", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -315,6 +319,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_GIT_BRANCH": "main", | ||
"LND_IMAGE": "example-project-main-lnd", | ||
"TOR_IMAGE": "example-project-main-tor", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -358,6 +363,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_BUILD_TYPE": "promote", | ||
"LAGOON_GIT_SOURCE_REPOSITORY": "ssh://[email protected]/lagoon-demo.git", | ||
"LAGOON_KUBERNETES": "remote-cluster1", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -406,6 +412,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_GIT_SOURCE_REPOSITORY": "ssh://[email protected]/lagoon-demo.git", | ||
"LAGOON_KUBERNETES": "remote-cluster1", | ||
"NODE_IMAGE": "example-project-pr-123-node", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -441,6 +448,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_BUILD_TYPE": "promote", | ||
"LAGOON_GIT_SOURCE_REPOSITORY": "ssh://[email protected]/lagoon-demo.git", | ||
"LAGOON_KUBERNETES": "remote-cluster1", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -510,6 +518,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"NGINX_IMAGE": "example-project-main-nginx", | ||
"PHP_IMAGE": "example-project-main-php", | ||
"LAGOON_FEATURE_FLAG_IMAGECACHE_REGISTRY": "imagecache.example.com", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
ContainerRegistries: []generator.ContainerRegistry{ | ||
{ | ||
|
@@ -588,6 +597,7 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
"LAGOON_GIT_BRANCH": "main", | ||
"NODE_IMAGE": "example-project-main-node", | ||
"LAGOON_CACHE_node": "harbor.example/example-project/main/node@sha256:e90daba405cbf33bab23fe8a021146811b2c258df5f2afe7dadc92c0778eef45", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
|
@@ -602,6 +612,102 @@ func TestImageBuildConfigurationIdentification(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
name: "test10 nginx-php external pull images from dockerhub", | ||
args: testdata.GetSeedData( | ||
testdata.TestData{ | ||
Namespace: "example-project-main", | ||
ProjectName: "example-project", | ||
EnvironmentName: "main", | ||
Branch: "main", | ||
LagoonYAML: "internal/testdata/complex/lagoon.varnish3.yml", | ||
ProjectVariables: []lagoon.EnvironmentVariable{ | ||
{ | ||
Name: "LAGOON_FEATURE_FLAG_IMAGECACHE_REGISTRY", | ||
Value: "imagecache.example.com", | ||
Scope: "build", | ||
}, | ||
}, | ||
}, true), | ||
want: imageBuild{ | ||
BuildKit: false, | ||
BuildArguments: map[string]string{ | ||
"LAGOON_BUILD_NAME": "lagoon-build-abcdefg", | ||
"LAGOON_PROJECT": "example-project", | ||
"LAGOON_ENVIRONMENT": "main", | ||
"LAGOON_ENVIRONMENT_TYPE": "production", | ||
"LAGOON_BUILD_TYPE": "branch", | ||
"LAGOON_GIT_SOURCE_REPOSITORY": "ssh://[email protected]/lagoon-demo.git", | ||
"LAGOON_KUBERNETES": "remote-cluster1", | ||
"LAGOON_GIT_SHA": "0000000000000000000000000000000000000000", | ||
"LAGOON_GIT_BRANCH": "main", | ||
"CLI_IMAGE": "example-project-main-cli", | ||
"NGINX_IMAGE": "example-project-main-nginx", | ||
"PHP_IMAGE": "example-project-main-php", | ||
"LAGOON_FEATURE_FLAG_IMAGECACHE_REGISTRY": "imagecache.example.com", | ||
"LAGOON_SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\nthisisafakekey\n-----END OPENSSH PRIVATE KEY-----", | ||
}, | ||
ContainerRegistries: []generator.ContainerRegistry{ | ||
{ | ||
Name: "my-custom-registry", | ||
Username: "registry_user", | ||
Password: "REGISTRY_PASSWORD", | ||
SecretName: "lagoon-private-registry-my-custom-registry", | ||
URL: "index.docker.io", | ||
UsernameSource: ".lagoon.yml", | ||
PasswordSource: ".lagoon.yml (we recommend using an environment variable, see the docs on container-registries for more information)", | ||
}, | ||
{ | ||
Name: "my-other-custom-registry", | ||
Username: "registry_user2", | ||
Password: "REGISTRY_PASSWORD2", | ||
SecretName: "lagoon-private-registry-my-other-custom-registry", | ||
URL: "registry1.example.com", | ||
UsernameSource: ".lagoon.yml", | ||
PasswordSource: ".lagoon.yml (we recommend using an environment variable, see the docs on container-registries for more information)", | ||
}, | ||
}, | ||
Images: []imageBuilds{ | ||
{ | ||
Name: "cli", | ||
ImageBuild: generator.ImageBuild{ | ||
BuildImage: "harbor.example/example-project/main/cli:latest", | ||
Context: "internal/testdata/complex/docker", | ||
DockerFile: ".docker/Dockerfile.cli", | ||
TemporaryImage: "example-project-main-cli", | ||
}, | ||
}, { | ||
Name: "nginx", | ||
ImageBuild: generator.ImageBuild{ | ||
BuildImage: "harbor.example/example-project/main/nginx:latest", | ||
Context: "internal/testdata/complex/docker", | ||
DockerFile: ".docker/Dockerfile.nginx-drupal", | ||
TemporaryImage: "example-project-main-nginx", | ||
}, | ||
}, { | ||
Name: "php", | ||
ImageBuild: generator.ImageBuild{ | ||
BuildImage: "harbor.example/example-project/main/php:latest", | ||
Context: "internal/testdata/complex/docker", | ||
DockerFile: ".docker/Dockerfile.php", | ||
TemporaryImage: "example-project-main-php", | ||
}, | ||
}, { | ||
Name: "redis", | ||
ImageBuild: generator.ImageBuild{ | ||
BuildImage: "harbor.example/example-project/main/redis:latest", | ||
PullImage: "registry1.example.com/amazeeio/redis:latest", | ||
}, | ||
}, { | ||
Name: "varnish", | ||
ImageBuild: generator.ImageBuild{ | ||
BuildImage: "harbor.example/example-project/main/varnish:latest", | ||
PullImage: "uselagoon/varnish-5-drupal:latest", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.