porter_preview_env.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 monorepo code
  26. id: checkout-monorepo-code
  27. uses: actions/checkout@v3
  28. - name: Checkout CCP code
  29. id: checkout-ccp-code
  30. uses: actions/checkout@v3
  31. with:
  32. repository: porter-dev/cluster-control-plane
  33. token: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  34. path: external/ccp
  35. - name: Create Porter preview env
  36. id: preview
  37. timeout-minutes: 30
  38. uses: porter-dev/porter-preview-action@dev
  39. with:
  40. action_id: ${{ github.run_id }}
  41. cluster: "2489"
  42. host: https://dashboard.getporter.dev
  43. installation_id: "18533943"
  44. namespace: pr-${{ github.event.inputs.pr_number }}-porter
  45. pr_branch_from: ${{ github.event.inputs.pr_branch_from }}
  46. pr_branch_into: ${{ github.event.inputs.pr_branch_into }}
  47. pr_id: ${{ github.event.inputs.pr_number }}
  48. pr_name: ${{ github.event.inputs.pr_title }}
  49. project: "6680"
  50. repo_name: porter
  51. repo_owner: porter-dev
  52. token: ${{ secrets.PORTER_PREVIEW_6680_2489 }}
  53. env:
  54. PORTER_APPLY_HONEYCOMB_PASSWORD: ${{ secrets.HONEYCOMB_PASSWORD_PREVIEW_ENVIRONMENTS }}
  55. - name: Attach vcluster
  56. run: |
  57. sudo apt-get update
  58. sudo apt-get install bash curl jq unzip
  59. /bin/bash -c "$(curl -fsSL https://install.porter.run)"
  60. echo "$VCLUSTER_KUBECONFIG" > /tmp/vcluster_kubeconfig
  61. dashboard_domain=$(echo "$DOMAINS" | jq '.subdomains[] | select(test("porter-dashboard*"))')
  62. dashboard_domain=$(sed -e 's/^"//' -e 's/"$//' <<<"$dashboard_domain")
  63. if [ -z "$dashboard_domain" ]; then
  64. exit
  65. fi
  66. export PORTER_HOST="https://${dashboard_domain}"
  67. porter connect kubeconfig --kubeconfig /tmp/vcluster_kubeconfig
  68. env:
  69. PORTER_TOKEN: ${{ secrets.PREVIEW_DEPLOYMENT_PORTER_KEY }}
  70. PORTER_PROJECT: 1
  71. VCLUSTER_KUBECONFIG: ${{ secrets.VCLUSTER_KUBECONFIG }}
  72. DOMAINS: ${{ steps.preview.outputs.domains }}
  73. concurrency:
  74. group: ${{ github.workflow }}-${{ github.event.inputs.pr_number }}