Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify deployment #96

Merged
merged 9 commits into from
Feb 23, 2024
Merged

chore: simplify deployment #96

merged 9 commits into from
Feb 23, 2024

Conversation

emileten
Copy link
Contributor

@emileten emileten commented Feb 22, 2024

⚠️ Checklist if your PR is changing anything else than documentation

  • The manual deployment workflow ran successfully

  • have all the cdk code in one app.py file

  • add the vector app

  • add a letter representation of datetime.datetime.utcnow() to the test stack ids in case (who knows 🤷‍♂️) several people try to test their PR at the same time. This will fail though if they trigger their workflow at the exact same second, but that's much less likely to happen ! I could use the branch name instead, but then I need to change the workflow again... edit: eventually decided to use the branch name _edit: second edit, branch name has slashes sometimes, which doesn't work with cloudformation, so I decided to use the short commit sha eventually.

@emileten emileten force-pushed the chore/simplify-deployment branch from ac8b96c to e6becdc Compare February 22, 2024 12:16
@emileten emileten self-assigned this Feb 22, 2024
@emileten
Copy link
Contributor Author

@emileten
Copy link
Contributor Author

emileten commented Feb 22, 2024

Fun times ! The workflow 'succeeded', but the stack wasn't actually destroyed (I checked on the AWS console). This is the bit that's causing me challenges :

      - name: Tear down any infrastructure
        if: always()
        run: |
          cd integration_tests/cdk
          # run this only if we find a 'cdk.out' directory, which means there might be things to tear down
          if [ -d "cdk.out" ]; then
            cd -
            source .deployment_venv/bin/activate
            cd integration_tests/cdk
            # see https://github.com/aws/aws-cdk/issues/24946
            # this didn't work : rm -f cdk.out/synth.lock
            # so we just duplicate the cdk output to cdk-destroy.out
            npx cdk destroy --output cdk-destroy.out --ci --all --force
          fi

This ran 'fine' in the above workflow. It didn't actually destroy the deployed stack, though :/.

Recap : I want the workflow to be resilient to a sudden cancel in the middle of the deployment ; i.e, I want the destruction to happen properly in these cases. The problem is that in these cases, cdk.out/synth.lock is not released by the deployment step, which probably runs in a docker container. This is a known issue..

People have been saying that removing the file manually rm cdk.out/synth.lock solves this, but it did not for me. So, I instead decided to have the synthesized output of cdk destroy be saved in a different directory, like above :

npx cdk destroy --output cdk-destroy.out --ci --all --force

This is probably why the stack doesn't actually get destroyed...

Edit : actually, it's probably not destroyed because I am using time stamps up the second to name stacks, and since cdk destroy runs a new synth from scratch, it uses a different time stamp and therefore a different stack name ... no wonder it doesn't destroy the initial stack 😆 I am going to use the branch name instead of the time stamp !

@emileten emileten force-pushed the chore/simplify-deployment branch 4 times, most recently from bc23552 to 61aa140 Compare February 22, 2024 15:15
Copy link
Member

@vincentsarago vincentsarago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@emileten emileten force-pushed the chore/simplify-deployment branch from 61aa140 to 24573cd Compare February 22, 2024 20:58
@emileten emileten force-pushed the chore/simplify-deployment branch from 24573cd to 25132ee Compare February 22, 2024 21:06
@emileten
Copy link
Contributor Author

@emileten emileten merged commit bb24ded into main Feb 23, 2024
3 checks passed
@emileten emileten deleted the chore/simplify-deployment branch February 23, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants