From a00fbb0f687df44d2fb243e97ee4036d7bcba3bc Mon Sep 17 00:00:00 2001 From: Tom Chauveau Date: Tue, 31 Aug 2021 13:04:57 +0200 Subject: [PATCH] Update op.#PushContainer test to use secrets Signed-off-by: Tom Chauveau --- tests/ops.bats | 10 ++----- .../.dagger/env/push-container/.gitignore | 2 ++ .../.dagger/env/push-container/values.yaml | 28 +++++++++++++++++++ tests/ops/push-container/inputs.yaml | 23 --------------- tests/ops/push-container/main.cue | 5 ++-- 5 files changed, 35 insertions(+), 33 deletions(-) create mode 100644 tests/ops/push-container/.dagger/env/push-container/.gitignore create mode 100644 tests/ops/push-container/.dagger/env/push-container/values.yaml delete mode 100644 tests/ops/push-container/inputs.yaml diff --git a/tests/ops.bats b/tests/ops.bats index b139dc81..ab839a57 100644 --- a/tests/ops.bats +++ b/tests/ops.bats @@ -81,14 +81,8 @@ setup() { } @test "op.#PushContainer" { - skip_unless_secrets_available "$TESTDIR"/ops/push-container/inputs.yaml - - # ensure the tests fail without credentials - run "$DAGGER" compute "$TESTDIR"/ops/push-container/valid - assert_failure - - # check that they succeed with the credentials - run "$DAGGER" compute --input-yaml "$TESTDIR"/ops/push-container/inputs.yaml "$TESTDIR"/ops/push-container + dagger_new_with_env "$TESTDIR"/ops/push-container/ + run "$DAGGER" up -e push-container assert_success } diff --git a/tests/ops/push-container/.dagger/env/push-container/.gitignore b/tests/ops/push-container/.dagger/env/push-container/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/tests/ops/push-container/.dagger/env/push-container/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/tests/ops/push-container/.dagger/env/push-container/values.yaml b/tests/ops/push-container/.dagger/env/push-container/values.yaml new file mode 100644 index 00000000..b32eee1c --- /dev/null +++ b/tests/ops/push-container/.dagger/env/push-container/values.yaml @@ -0,0 +1,28 @@ +plan: + package: . +name: push-container +inputs: + registry.secret: + secret: ENC[AES256_GCM,data:kZivIXveEoh3+GayI1Tnn6zVf3e38Hlsd2V/GoeJ5bbMOiGS,iv:am3fLZE39MkfFlTXF90olpx/gkp/g1Olkf3PHDsAcKk=,tag:holrnoNR4SqJuw1lYgnUGw==,type:str] + registry.username: + text: daggertest +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyRzBHQkNGdGpuVWUzeGdl + WXhYeGVVeUdFbTZLYWt2enFuUmlHTC83NDBZClh1NSthd3dDdGlaQVVUY09WRmNN + cUVPZUY0U3kvZm8zUVZMMjNMMEZrNFEKLS0tIHZYUE8zTTUwUGJWcWtweEo2R09q + UVBXdTZSSHhKRGlpOGErd1ZYL0JKY3MKEcay8Bhy1Ap9Jt8gq/6bV/VnzlPSxqZk + bd2SuoUs7rMiabhdbApym0MmghqNrwA8xQQo4dCWnxPGDa3avKtTCg== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-08-30T15:05:57Z" + mac: ENC[AES256_GCM,data:bfTPWrvxKB9a6bc2CPC9vE4BSd/H0JNMx1Cj8JT7KIb82Eymby/B+MEBQTDsVSaILEK6JUgH7Awl/JZAw1MwKG8K8nSAoX74311lRXXnYUNaggXgJu+V4cfdCZuofivQyymsZITMVfABmmjRoZ4zqWiJvYvqdtb42abRMU3vIpA=,iv:WvBCkZXyxYEM4HRdSiCfHdcK/olJOdq2uJpFE2R9wDU=,tag:BemiMETEs1ZmfUUrUUZTjA==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/tests/ops/push-container/inputs.yaml b/tests/ops/push-container/inputs.yaml deleted file mode 100644 index 2c68689b..00000000 --- a/tests/ops/push-container/inputs.yaml +++ /dev/null @@ -1,23 +0,0 @@ -registry: - username: ENC[AES256_GCM,data:Yuv+E9dhGZnCxw==,iv:ezThCQJv+bVBf8SdfSa2HFoP+eu6IZMPl5xvMOGDcps=,tag:8+EeJfySzwMczqrzIEDy+w==,type:str] - secret: ENC[AES256_GCM,data:OcxwHjWcTdtyKRb7whgG/fzmIG/bpQoSlUVIIhyeEX31lGWh,iv:YAXcRzBoemmef5PBdAOBa5acNPo4BoKH7Ngud/CWYfA=,tag:M1M1hsqKP0TyQbkU5c6oGg==,type:str] -sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] - age: - - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk - enc: | - -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBOaE5NYkdtR0FiOWZTcW54 - UzRTL3lwQ3owV0QyWmYzVmQ1K0swa2xZK0RnClZSblRIQUxpUWNUdGJBMngwRlFT - RXI1aHJMUVVySVF2dzBLN1djZitSWlEKLS0tIGd6RWttckdQTVV1Qi9uWUEvQitR - ODEwdXlXSy8veWZkNUpNbWszMVE3M0EKSiQ0AVvySOUHg6RZkcbmpLTHSlnT2zw7 - Em+pRLYs7GXyilGvSwlRw5O+SrNNQU8Tr8/Yumif2Mks5r3TatDqdA== - -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-05-28T20:47:36Z" - mac: ENC[AES256_GCM,data:tSOZ6GWrpwPkwCYdtN9/Ym9OXGDzLfXaTATBodaLVjxsVtjaFSxjN15gcjtcxU9KNiOo77fJuEgHgQTQmzHrjSBkvX0zgGoNGU1KCQ3XqRMzfjm1yBU7sWb7lCwjAUqzhERRwe9Vja9GkDSgT+B+CUIRDyqQa1jXg0HlQldhEr0=,iv:ZioCDF8NueNw9miTWxhYWvn1cDw9wUxzMIlp9b2UEgE=,tag:CM4mbhrYW83/ijHNRtIWBw==,type:str] - pgp: [] - unencrypted_suffix: _unencrypted - version: 3.7.1 diff --git a/tests/ops/push-container/main.cue b/tests/ops/push-container/main.cue index 2b84729b..ceb5362e 100644 --- a/tests/ops/push-container/main.cue +++ b/tests/ops/push-container/main.cue @@ -1,14 +1,15 @@ package main import ( + "alpha.dagger.io/dagger" "alpha.dagger.io/dagger/op" "alpha.dagger.io/alpine" "alpha.dagger.io/random" ) registry: { - username: string - secret: string + username: dagger.#Input & {string} + secret: dagger.#Input & {dagger.#Secret} } TestPushContainer: {