|
| 1 | +name: Test E2E Admin UI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled, opened, synchronize, reopened] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + boundary-enterprise-branch: |
| 9 | + description: 'Branch of boundary-enterprise to test against (default to main)' |
| 10 | + required: true |
| 11 | + default: 'main' |
| 12 | + type: string |
| 13 | + boundary-branch: |
| 14 | + description: 'Branch of boundary to test against (default to main)' |
| 15 | + required: true |
| 16 | + default: 'main' |
| 17 | + type: string |
| 18 | + |
| 19 | +jobs: |
| 20 | + test: |
| 21 | + if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'admin') }} |
| 22 | + name: Test |
| 23 | + runs-on: ${{ fromJSON(vars.RUNNER_UBUNTU_22) }} |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - boundary_edition: community |
| 28 | + github_repo: hashicorp/boundary |
| 29 | + folder_name: boundary |
| 30 | + boundary_edition_short: oss |
| 31 | + enos_scenario: e2e_ui_docker |
| 32 | + test_command: admin:ce:docker |
| 33 | + boundary_branch: ${{ github.event.inputs.boundary-branch || 'main' }} |
| 34 | + - boundary_edition: enterprise |
| 35 | + github_repo: hashicorp/boundary-enterprise |
| 36 | + folder_name: boundary-enterprise |
| 37 | + boundary_edition_short: ent |
| 38 | + enos_scenario: e2e_ui_docker_ent |
| 39 | + test_command: admin:ent:docker |
| 40 | + boundary_branch: ${{ github.event.inputs.boundary-enterprise-branch || 'main' }} |
| 41 | + fail-fast: false |
| 42 | + env: |
| 43 | + ENOS_VAR_e2e_debug_no_run: true |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Set up pnpm |
| 50 | + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0 |
| 51 | + with: |
| 52 | + run_install: false |
| 53 | + |
| 54 | + - name: Set up Node |
| 55 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 56 | + with: |
| 57 | + node-version: 20 |
| 58 | + cache: "pnpm" |
| 59 | + cache-dependency-path: | |
| 60 | + pnpm-lock.yaml |
| 61 | + ui/desktop/electron-app/pnpm-lock.yaml |
| 62 | +
|
| 63 | + - name: Set up Terraform |
| 64 | + uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd |
| 65 | + |
| 66 | + - name: Set up Enos |
| 67 | + uses: hashicorp/action-setup-enos@b9fa53484a1e8fdcc7b02a118bcf01d65b9414c9 |
| 68 | + with: |
| 69 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + |
| 71 | + - name: Install Vault CLI |
| 72 | + run: | |
| 73 | + wget https://releases.hashicorp.com/vault/1.12.2/vault_1.12.2_linux_amd64.zip -O /tmp/vault.zip |
| 74 | + unzip /tmp/vault.zip -d /usr/local/bin |
| 75 | +
|
| 76 | + - name: GPG setup |
| 77 | + run: | |
| 78 | + # Create a GPG key |
| 79 | + export KEY_PW=boundary |
| 80 | + gpg --generate-key --batch <<eoGpgConf |
| 81 | + %echo Started! |
| 82 | + Key-Type: RSA |
| 83 | + Key-Length: default |
| 84 | + Subkey-Type: RSA |
| 85 | + Name-Real: boundary |
| 86 | + Name-Comment: default |
| 87 | + Name-Email: default |
| 88 | + Expire-Date: 0 |
| 89 | + Passphrase: $KEY_PW |
| 90 | + %commit |
| 91 | + %echo Done. |
| 92 | + eoGpgConf |
| 93 | +
|
| 94 | + # Enable gpg-preset-passphrase so that key passwords can be saved |
| 95 | + echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf |
| 96 | + gpg-connect-agent reloadagent /bye &>/dev/null |
| 97 | +
|
| 98 | + # Get information about the created keys |
| 99 | + export lines=$(gpg --list-secret-keys --with-colons --with-keygrip) |
| 100 | + export KEY_ID="" |
| 101 | + while read -r line |
| 102 | + do |
| 103 | + # Save the first key id to be used later |
| 104 | + if [[ $line =~ "fpr"* ]]; then |
| 105 | + if [[ $KEY_ID == "" ]]; then |
| 106 | + KEY_ID="$(echo "$line" | sed -r 's/fpr|://g')" |
| 107 | + fi |
| 108 | + fi |
| 109 | +
|
| 110 | + # Cache the passphrases for the keys so passwords do not need to be entered |
| 111 | + if [[ $line =~ "grp"* ]]; then |
| 112 | + export KEYGRIP_ID="$(echo "$line" | sed -r 's/grp|://g')" |
| 113 | + /usr/lib/gnupg/gpg-preset-passphrase --preset -P $KEY_PW $KEYGRIP_ID |
| 114 | + fi |
| 115 | + done <<< $lines |
| 116 | +
|
| 117 | + # Trust the key |
| 118 | + touch /tmp/test.txt |
| 119 | + gpg -a --encrypt -r $KEY_ID --trust-model always --batch --yes /tmp/test.txt |
| 120 | + echo "trusted-key $KEY_ID" >> ~/.gnupg/gpg.conf |
| 121 | +
|
| 122 | + # Initialize the password store |
| 123 | + pass init $KEY_ID &>/dev/null |
| 124 | +
|
| 125 | + - name: Checkout ${{ matrix.folder_name }} repo |
| 126 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 127 | + with: |
| 128 | + repository: ${{ matrix.github_repo }} |
| 129 | + path: support/src/${{ matrix.folder_name }} |
| 130 | + token: ${{ secrets.ELEVATED_GITHUB_TOKEN }} |
| 131 | + ref: ${{ matrix.boundary_branch }} |
| 132 | + |
| 133 | + - name: GH fix for localhost resolution |
| 134 | + run: | |
| 135 | + cat /etc/hosts && echo "-----------" |
| 136 | + sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts |
| 137 | + cat /etc/hosts |
| 138 | + ssh -V |
| 139 | +
|
| 140 | + echo "127.0.0.1 localhost boundary" | sudo tee -a /etc/hosts |
| 141 | + echo "127.0.0.1 localhost worker" | sudo tee -a /etc/hosts |
| 142 | + echo "127.0.0.1 localhost vault" | sudo tee -a /etc/hosts |
| 143 | +
|
| 144 | + - name: Set git config |
| 145 | + run: | |
| 146 | + git config --global url."https://oauth2:${{ secrets.ELEVATED_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" |
| 147 | +
|
| 148 | + - name: Install node dependencies |
| 149 | + run: | |
| 150 | + pnpm install --frozen-lockfile |
| 151 | + cd e2e-tests |
| 152 | + pnpm playwright install --with-deps |
| 153 | +
|
| 154 | + - name: Set up test infra |
| 155 | + id: infra |
| 156 | + run: | |
| 157 | + ssh-keygen -N '' -t ed25519 -f ~/.ssh/github_enos |
| 158 | + mkdir -p ./enos/terraform-plugin-cache |
| 159 | + echo ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} > ./support/src/${{matrix.folder_name}}/internal/ui/VERSION |
| 160 | + export ENOS_VAR_ui_build_override="oss" && \ |
| 161 | + export ENOS_VAR_boundary_edition=${{ matrix.boundary_edition_short }} && \ |
| 162 | + export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ |
| 163 | + export ENOS_VAR_aws_ssh_private_key_path=~/.ssh/github_enos && \ |
| 164 | + export ENOS_VAR_boundary_license="${{ secrets.BOUNDARY_ENT_LICENSE }}" && \ |
| 165 | + enos scenario launch --timeout 60m0s --chdir ./support/src/${{matrix.folder_name}}/enos ${{matrix.enos_scenario}} builder:local |
| 166 | +
|
| 167 | + - name: Move boundary binary |
| 168 | + run: | |
| 169 | + mv ./support/src/${{matrix.folder_name}}/bin/boundary /usr/local/bin/ |
| 170 | + boundary version |
| 171 | +
|
| 172 | + - name: Run Tests |
| 173 | + run: | |
| 174 | + source <(bash ./support/src/${{matrix.folder_name}}/enos/scripts/test_e2e_env.sh) |
| 175 | + cd e2e-tests |
| 176 | + pnpm run ${{ matrix.test_command }} --reporter=html |
| 177 | +
|
| 178 | + - name: Upload Playwright report |
| 179 | + if: ${{ failure() }} |
| 180 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 181 | + with: |
| 182 | + name: playwright-report-${{ matrix.boundary_edition }} |
| 183 | + path: e2e-tests/playwright-report |
| 184 | + |
| 185 | + - name: Clean up test infra |
| 186 | + if: ${{ always() }} |
| 187 | + run: | |
| 188 | + export ENOS_VAR_boundary_edition=${{ matrix.boundary_edition_short }} && \ |
| 189 | + export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ |
| 190 | + export ENOS_VAR_aws_ssh_private_key_path=~/.ssh/github_enos && \ |
| 191 | + enos scenario destroy --timeout 60m0s --chdir ./support/src/${{matrix.folder_name}}/enos ${{matrix.enos_scenario}} builder:local |
0 commit comments