diff --git a/test-image/Dockerfile b/test-image/Dockerfile new file mode 100644 index 0000000..b4cb175 --- /dev/null +++ b/test-image/Dockerfile @@ -0,0 +1,9 @@ +FROM rundeck/rundeck:3.3.9 + +COPY rundeck-config-storage.properties /etc/remco/templates/rundeck-config-storage.properties + +USER root + +RUN chown rundeck:root /etc/remco/templates/rundeck-config-storage.properties + +USER rundeck diff --git a/test-image/rundeck-config-storage.properties b/test-image/rundeck-config-storage.properties new file mode 100644 index 0000000..a68eb0f --- /dev/null +++ b/test-image/rundeck-config-storage.properties @@ -0,0 +1,58 @@ +{% set providerBase = "/rundeck/storage/provider" %} +{% set converterBase = "/rundeck/storage/converter" %} +{% set configConverterBase = "/rundeck/config/storage/converter" %} + + +{%- macro storage_provider(provider) %} + {%- set index = provider | base %} + {%- set type = getv(printf("%s/type", provider), "db") %} +{% if type == 'db' || type == 'file' %} +rundeck.storage.provider.{{index}}.type={% set type = printf("%s/type", provider) %}{{ getv(type, "db")}} +rundeck.storage.provider.{{index}}.path={% set path = printf("%s/path", provider) %}{{ getv(path, "keys")}} +{% endif %} +{% endmacro %} + +{%- macro storage_converter(converter) %} + {%- set index = converter | base %} +rundeck.storage.converter.{{index}}.type={% set type = printf("%s/type", converter) %}{{ getv(type, "jasypt-encryption") }} +rundeck.storage.converter.{{index}}.path={% set path = printf("%s/path", converter) %}{{ getv(path, "keys") }} +rundeck.storage.converter.{{index}}.config.encryptorType={% set encryptortype = printf("%s/config/encryptortype", converter) %}{{ getv(encryptortype, "custom") }} +rundeck.storage.converter.{{index}}.config.password={% set password = printf("%s/config/password", converter) %}{{ getv(password, "") }} +rundeck.storage.converter.{{index}}.config.algorithm={% set algorithm = printf("%s/config/algorithm", converter) %}{{ getv(algorithm, "PBEWITHSHA256AND128BITAES-CBC-BC") }} +rundeck.storage.converter.{{index}}.config.provider={% set provider = printf("%s/config/provider", converter) %}{{ getv(provider, "BC") }} +rundeck.storage.converter.{{index}}.config.keyArn={% set keyArn = printf("%s/config/keyarn", converter) %}{{ getv(keyArn, "") }} +{% endmacro %} + +{%- macro config_storage_converter(converter) %} + {%- set index = converter | base %} +rundeck.config.storage.converter.{{index}}.type={% set type = printf("%s/type", converter) %}{{ getv(type, "jasypt-encryption") }} +rundeck.config.storage.converter.{{index}}.path={% set path = printf("%s/path", converter) %}{{ getv(path, "projects") }} +rundeck.config.storage.converter.{{index}}.config.encryptorType={% set encryptortype = printf("%s/config/encryptortype", converter) %}{{ getv(encryptortype, "custom") }} +rundeck.config.storage.converter.{{index}}.config.password={% set password = printf("%s/config/password", converter) %}{{ getv(password, "") }} +rundeck.config.storage.converter.{{index}}.config.algorithm={% set algorithm = printf("%s/config/algorithm", converter) %}{{ getv(algorithm, "PBEWITHSHA256AND128BITAES-CBC-BC") }} +rundeck.config.storage.converter.{{index}}.config.provider={% set provider = printf("%s/config/provider", converter) %}{{ getv(provider, "BC") }} +rundeck.config.storage.converter.{{index}}.config.keyArn={% set keyArn = printf("%s/config/keyarn", converter) %}{{ getv(keyArn, "") }} +{% endmacro %} + +{%- if ls(printf("%s/1", providerBase)) | length == 0 %} +rundeck.storage.provider.1.type=db +rundeck.storage.provider.1.path=keys +{% endif %} + + +{%- for p in lsdir(providerBase) -%} + {% set provider = printf("%s/%s", providerBase, p) -%} + {{ storage_provider(provider) }} +{%- endfor %} + +{%- for c in lsdir(converterBase) %} + {% set converter = printf("%s/%s", converterBase, c) -%} + {{ storage_converter(converter) }} +{%- endfor %} + +rundeck.projectsStorageType={{ getv("/rundeck/projectsstoragetype", "db") }} + +{% for c in lsdir(configConverterBase) %} + {% set converter = printf("%s/%s", configConverterBase, c) -%} + {{ config_storage_converter(converter) }} +{%- endfor %} diff --git a/test-in-rundeck.sh b/test-in-rundeck.sh index a845e55..d2ed499 100755 --- a/test-in-rundeck.sh +++ b/test-in-rundeck.sh @@ -1,9 +1,16 @@ #!/bin/bash +set -e + +docker build -t rundeck-kms-test-image test-image + docker run -it \ -e AWS_ACCESS_KEY_ID \ -e AWS_SECRET_ACCESS_KEY \ -e AWS_REGION \ + -e RUNDECK_STORAGE_CONVERTER_1_TYPE=rundeck-kms-plugin \ + -e RUNDECK_STORAGE_CONVERTER_1_PATH=keys \ + -e RUNDECK_STORAGE_CONVERTER_1_CONFIG_KEYARN=$KMS_KEY_ARN \ -p 4440:4440 \ -v $(pwd)/lib/build/libs/rundeck-kms-plugin.jar:/home/rundeck/libext/rundeck-kms-plugin.jar \ - rundeck/rundeck:3.3.9 + rundeck-kms-test-image