[bitnami/harbor-registryctl] Add VIB tests (#30853)

* [bitnami/harbor-registryctl] Add initial tests

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Fix registry binary check and add tests to check harbor_registryctl and registry binaries

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Add change in docker-compose file to trigger tests

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Fix check for /var/lib/registry and /storage directories

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Check if swagger binary exists

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Delete blank space

Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com>

* [bitnami/harbor-registryctl] Fix check-app-version test

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Fix check for swagger binary

Signed-off-by: Cori Avila <amisericordi@vmware.com>

* [bitnami/harbor-registryctl] Delete trigger in docker-compose file

Signed-off-by: Cori Avila <amisericordi@vmware.com>

---------

Signed-off-by: Cori Avila <amisericordi@vmware.com>
Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com>
This commit is contained in:
Cori Avila 2023-05-12 10:06:44 +02:00 committed by GitHub
parent 1930bcea15
commit f5f17ee489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 89 additions and 2 deletions

View File

@ -0,0 +1,12 @@
gossfile:
# Goss tests exclusive to the current container
../../harbor-registryctl/goss/harbor-registryctl.yaml: {}
# Load scripts from .vib/common/goss/templates
../../common/goss/templates/check-app-version.yaml: {}
../../common/goss/templates/check-binaries.yaml: {}
../../common/goss/templates/check-broken-symlinks.yaml: {}
../../common/goss/templates/check-ca-certs.yaml: {}
../../common/goss/templates/check-directories.yaml: {}
../../common/goss/templates/check-linked-libraries.yaml: {}
../../common/goss/templates/check-sed-in-place.yaml: {}
../../common/goss/templates/check-spdx.yaml: {}

View File

@ -0,0 +1,31 @@
group:
harbor:
exists: true
user:
harbor:
exists: true
file:
/var/lib/registry:
exists: true
mode: "0775"
owner: harbor
filetype: directory
/storage:
exists: true
mode: "0775"
owner: harbor
filetype: directory
/opt/bitnami/harbor-registryctl/bin/swagger:
exists: false
command:
# Ensure a set of directories exist and the non-root user has write privileges to them
check-directories-exist-with-user:
exec: ls -dl /etc/ssl/certs /etc/pki/tls/certs/ 2>/dev/null | grep "drwxrwxr-x.*harbor"
exit-status: 0
# Ensure permissions for Internal TLS
check-permissions-system-certs:
exec: ls -l /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.trust.crt /etc/ssl/certs/ca-certificates.crt 2>/dev/null | grep ".*-rw-rw-r--.*harbor"
exit-status: 0
check-harbor-registryctl-binary:
exec: harbor_registryctl --help
exit-status: 0

View File

@ -0,0 +1,12 @@
binaries:
- yq
- registry
- harbor_registryctl
directories:
- paths:
- /etc/registry
- /etc/registryctl
version:
bin_name: registry
flag: --version
root_dir: /opt/bitnami

View File

@ -3,7 +3,8 @@
"resources": {
"url": "{VIB_ENV_CONTAINER_URL}",
"path": "{VIB_ENV_PATH}"
}
},
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
},
"phases": {
"package": {
@ -33,6 +34,21 @@
},
"verify": {
"actions": [
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib"
},
"tests_file": "harbor-registryctl/goss/goss.yaml",
"vars_file": "harbor-registryctl/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-harbor-registryctl"
}
}
}
},
{
"action_id": "trivy",
"params": {

View File

@ -3,7 +3,8 @@
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "{VIB_ENV_PATH}"
}
},
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
},
"phases": {
"package": {
@ -29,6 +30,21 @@
},
"verify": {
"actions": [
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib"
},
"tests_file": "harbor-registryctl/goss/goss.yaml",
"vars_file": "harbor-registryctl/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-harbor-registryctl"
}
}
}
},
{
"action_id": "trivy",
"params": {