From 6ef0cfe3211ee8f48c3687494b70b6d4e25daeba Mon Sep 17 00:00:00 2001 From: Guillaume de Rouville Date: Fri, 20 Aug 2021 16:09:35 +0200 Subject: [PATCH] 1008: Implement on LocalStack Signed-off-by: Guillaume de Rouville --- .github/workflows/ci.yml | 16 ++++++++++++++++ .../tests/.dagger/env/cloudformation/values.yaml | 10 ++++++---- docs/learn/tests/doc.bats | 3 ++- docs/learn/tests/helpers.bash | 11 +++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fedc5589..84b6677b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,6 +189,22 @@ jobs: name: Documentation runs-on: ubuntu-latest timeout-minutes: 30 + services: + localstack: + image: localstack/localstack:0.12.16 + env: + SERVICES: s3, cloudformation + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + ports: + - 4566:4566 + - 4571:4571 + options: >- + --health-cmd "curl -f http://localhost:4566/health" + --health-start-period 5s + --health-timeout 5s + --health-interval 5s + --health-retries 10 + steps: - name: Check out uses: actions/checkout@v2 diff --git a/docs/learn/tests/.dagger/env/cloudformation/values.yaml b/docs/learn/tests/.dagger/env/cloudformation/values.yaml index 985f9aa9..bd284af1 100644 --- a/docs/learn/tests/.dagger/env/cloudformation/values.yaml +++ b/docs/learn/tests/.dagger/env/cloudformation/values.yaml @@ -3,11 +3,13 @@ plan: name: cloudformation inputs: awsConfig.accessKey: - secret: ENC[AES256_GCM,data:MJSSjaXpMawrpM5trPQzZR2Cg/M=,iv:D8Ff3Uy8hpzFPKg+okFkVM5DRam9Dyk31GjIizklvP0=,tag:J/7/+xjHdy94mYTQmB0sUw==,type:str] + secret: ENC[AES256_GCM,data:HaGzSQ==,iv:FzsuSq7ZKttWs0WDC0q+vT/hxUx+WcQ4iy7vnV+Q8Dg=,tag:Oy9Xxq+4LMVkXkF/3ZjjsA==,type:str] + awsConfig.localMode: + text: "true" awsConfig.region: text: us-east-2 awsConfig.secretKey: - secret: ENC[AES256_GCM,data:BnBc29SIbLj3DDWwpem7mcLQSPoP6a/opqIYxLZyQPdSJojL/Jy9jA==,iv:nK3mj7jOgJdAwcO2i5OYj1FxHsYnoodyXMih9eqLnOQ=,tag:1zaXCkwL8d8ilyxCGzPN6Q==,type:str] + secret: ENC[AES256_GCM,data:aHDXVQ==,iv:ZEA4JLLedUvITocXE5G4Ar6pDNilyvgdvEYsMy/LVIk=,tag:BALivFcV0xBQD//qvo0aUw==,type:str] cfnStack.onFailure: text: DELETE sops: @@ -25,8 +27,8 @@ sops: Lzd0bU1qMXF0dzIzTG05cmlzZURxUncKp2wNXD/HKXgGv16pM/yvaYfWL5lsQyWo CDsT4rHHMZ21XtS9W+7oL9IqMMmDUQf6RZgDgoqLVmTjdBeA8yB2yg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-08-13T02:12:09Z" - mac: ENC[AES256_GCM,data:tZ35vWWlepyQOuKtzO1pau51YQZZ+Lg2LKK9PlSJvJZYzp+QaUVMCsoTAkZXgMH12C9ced6Jo1pfV9kQjxG1/g+5JmjgClFCWCMTIRa8Z9iI3hGu35SjxG4KVRlmeZsjstEW+78JBOekBUWYzkX0vAlKq44qLLug3FDc+sxFetQ=,iv:yB85C7b5X4y/koB3zN3ktUoYrYdB7N07FvJigwjxao0=,tag:3PSTd39bLyPRa4uZzHycjg==,type:str] + lastmodified: "2021-08-20T13:10:08Z" + mac: ENC[AES256_GCM,data:UIhYTG5ofk04dPLOaYiryOt/JC+8/ousZlGpotAAenHOYVo0FChYKywofquOVlpqdC0a/wT6eEz59ofpxDuzV/8/Qh/5MumHqfJUYtQezQYVhreLpWdLsHTn99Ndqjzhj+on9ODumqsAOM+PgVEKRTxSHtTOZB8i4gfO77hg5nk=,iv:E11iRe9z+PxHCy9qtnEYVv+uXVxn1CfAqIgGspd5ObM=,tag:PzORtWy+xVwXof5nbHrDDw==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 diff --git a/docs/learn/tests/doc.bats b/docs/learn/tests/doc.bats index c933872c..fdab968e 100644 --- a/docs/learn/tests/doc.bats +++ b/docs/learn/tests/doc.bats @@ -163,6 +163,7 @@ setup() { } @test "doc-1008-aws-cloudformation" { + skip_unless_local_localstack setup_example_sandbox "doc" ### Create a basic plan @@ -236,7 +237,7 @@ setup() { mkdir workspace cd workspace - # Writing the package + # Writing package dagger init mkdir -p cue.mod/pkg/github.com/tjovicic/gcpcloudrun cp $CODEBLOC_SRC/dev-cue-package/source.cue cue.mod/pkg/github.com/tjovicic/gcpcloudrun/source.cue diff --git a/docs/learn/tests/helpers.bash b/docs/learn/tests/helpers.bash index 6c5b30d8..b471179f 100644 --- a/docs/learn/tests/helpers.bash +++ b/docs/learn/tests/helpers.bash @@ -77,6 +77,17 @@ copy_to_sandbox() { fi } +# Check if there is a localstack instance. +# +# This is needed to do docs test in the CI. +skip_unless_local_localstack() { + if [ "$(curl -s http://localhost:4566)" = '{"status": "running"}' ]; then + echo "Localstack available" + else + skip "Localstack not available" + fi +} + # Check if there is a local kubernetes cluster. # # This is need to do kubernetes test in the CI.