porter_preview_env.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. "on":
  2. workflow_dispatch:
  3. inputs:
  4. pr_branch_from:
  5. description: Pull request head branch
  6. required: true
  7. type: string
  8. pr_branch_into:
  9. description: Pull request base branch
  10. required: true
  11. type: string
  12. pr_number:
  13. description: Pull request number
  14. required: true
  15. type: string
  16. pr_title:
  17. description: Pull request title
  18. required: true
  19. type: string
  20. name: Porter Preview Environment
  21. jobs:
  22. porter-preview:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Checkout code
  26. id: checkout-code
  27. uses: actions/checkout@v3
  28. - name: Create Porter preview env
  29. id: preview
  30. timeout-minutes: 30
  31. uses: porter-dev/porter-preview-action@dev
  32. with:
  33. action_id: ${{ github.run_id }}
  34. cluster: "2489"
  35. host: https://dashboard.getporter.dev
  36. installation_id: "18533943"
  37. namespace: pr-${{ github.event.inputs.pr_number }}-porter
  38. pr_branch_from: ${{ github.event.inputs.pr_branch_from }}
  39. pr_branch_into: ${{ github.event.inputs.pr_branch_into }}
  40. pr_id: ${{ github.event.inputs.pr_number }}
  41. pr_name: ${{ github.event.inputs.pr_title }}
  42. project: "6680"
  43. repo_name: porter
  44. repo_owner: porter-dev
  45. token: ${{ secrets.PORTER_PREVIEW_6680_2489 }}
  46. - name: Attach vcluster
  47. run: |
  48. sudo apt-get update
  49. sudo apt-get install bash curl jq unzip
  50. /bin/bash -c "$(curl -fsSL https://install.porter.run)"
  51. echo "$VCLUSTER_KUBECONFIG" > /tmp/vcluster_kubeconfig
  52. dashboard_domain=$(echo "$DOMAINS" | jq '.subdomains[] | select(test("porter-dashboard*"))')
  53. dashboard_domain=$(sed -e 's/^"//' -e 's/"$//' <<<"$dashboard_domain")
  54. if [ -z "$dashboard_domain" ]; then
  55. exit 1
  56. fi
  57. export PORTER_HOST="https://${dashboard_domain}"
  58. porter connect kubeconfig --kubeconfig /tmp/vcluster_kubeconfig
  59. env:
  60. PORTER_TOKEN: ${{ secrets.PREVIEW_DEPLOYMENT_PORTER_KEY }}
  61. PORTER_PROJECT: 1
  62. VCLUSTER_KUBECONFIG: ${{ secrets.VCLUSTER_KUBECONFIG }}
  63. DOMAINS: ${{ steps.preview.outputs.domains }}
  64. concurrency:
  65. group: ${{ github.workflow }}-${{ github.event.inputs.pr_number }}