|
645 | 645 | buildInputs = with pkgs; [ |
646 | 646 | packer |
647 | 647 | awscli2 |
648 | | - docker |
649 | 648 | yq |
650 | 649 | jq |
651 | 650 | openssl |
652 | 651 | pythonEnv |
653 | 652 | git |
654 | 653 | coreutils |
| 654 | + aws-vault |
655 | 655 | ]; |
656 | 656 | } '' |
657 | 657 | mkdir -p $out/bin |
|
662 | 662 | export PATH="${pkgs.lib.makeBinPath (with pkgs; [ |
663 | 663 | packer |
664 | 664 | awscli2 |
665 | | - docker |
666 | 665 | yq |
667 | 666 | jq |
668 | 667 | openssl |
669 | 668 | pythonEnv |
670 | 669 | git |
671 | 670 | coreutils |
| 671 | + aws-vault |
672 | 672 | ])}:$PATH" |
673 | 673 |
|
674 | 674 | # Check for required tools |
675 | | - for cmd in packer aws docker yq jq openssl; do |
| 675 | + for cmd in packer aws-vault yq jq openssl; do |
676 | 676 | if ! command -v $cmd &> /dev/null; then |
677 | 677 | echo "Error: $cmd is required but not found" |
678 | 678 | exit 1 |
679 | 679 | fi |
680 | 680 | done |
681 | 681 |
|
682 | | - # Check AWS credentials |
683 | | - if [ -z "''${AWS_ACCESS_KEY_ID:-}" ] || [ -z "''${AWS_SECRET_ACCESS_KEY:-}" ]; then |
684 | | - echo "Error: AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) must be set" |
| 682 | + # Check AWS Vault profile |
| 683 | + if [ -z "''${AWS_VAULT:-}" ]; then |
| 684 | + echo "Error: AWS_VAULT environment variable must be set with the profile name" |
| 685 | + echo "Usage: aws-vault exec supabase-dev -- nix run .#testinfra-env 15" |
685 | 686 | exit 1 |
686 | 687 | fi |
687 | 688 |
|
|
696 | 697 | PG_VERSION=$(yq -r ".postgres_release[\"postgres$POSTGRES_VERSION\"]" ansible/vars.yml) |
697 | 698 | echo "postgres-version = \"$PG_VERSION\"" > common-nix.vars.pkr.hcl |
698 | 699 |
|
699 | | - # Create docker builder context |
700 | | - docker context create builders || true |
701 | | - docker buildx create --use --name builders builders || true |
702 | | -
|
703 | 700 | # Build AMI Stage 1 |
704 | 701 | packer init amazon-arm64-nix.pkr.hcl |
705 | 702 | packer build \ |
|
710 | 707 | -var "ansible_arguments=" \ |
711 | 708 | -var "postgres-version=$RANDOM_STRING" \ |
712 | 709 | -var "region=$REGION" \ |
713 | | - -var "ami_regions=$REGION" \ |
| 710 | + -var 'ami_regions=["'"$REGION"'"]' \ |
714 | 711 | -var "force-deregister=true" \ |
715 | 712 | -var "ansible_arguments=-e postgresql_major=$POSTGRES_VERSION" \ |
716 | 713 | amazon-arm64-nix.pkr.hcl |
|
725 | 722 | -var-file="common-nix.vars.pkr.hcl" \ |
726 | 723 | -var "postgres-version=$RANDOM_STRING" \ |
727 | 724 | -var "region=$REGION" \ |
728 | | - -var "ami_regions=$REGION" \ |
| 725 | + -var 'ami_regions=["'"$REGION"'"]' \ |
729 | 726 | -var "force-deregister=true" \ |
730 | 727 | -var "git_sha=$GIT_SHA" \ |
731 | 728 | stage2-nix-psql.pkr.hcl |
|
1103 | 1100 | basePackages.testinfra-env |
1104 | 1101 | dbmate |
1105 | 1102 | nushell |
| 1103 | + pythonEnv |
1106 | 1104 | ]; |
1107 | 1105 | shellHook = '' |
1108 | 1106 | export HISTFILE=.history |
|
0 commit comments