Просмотр исходного кода

Merge pull request #2670 from porter-dev/master

Hotfix and preview env master -> staging
jusrhee 3 лет назад
Родитель
Сommit
2353ea2c58

+ 45 - 0
.github/workflows/porter_preview_env.yml

@@ -0,0 +1,45 @@
+"on":
+  workflow_dispatch:
+    inputs:
+      pr_branch_from:
+        description: Pull request head branch
+        required: true
+        type: string
+      pr_branch_into:
+        description: Pull request base branch
+        required: true
+        type: string
+      pr_number:
+        description: Pull request number
+        required: true
+        type: string
+      pr_title:
+        description: Pull request title
+        required: true
+        type: string
+name: Porter Preview Environment
+jobs:
+  porter-preview:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2.3.4
+    - name: Create Porter preview env
+      timeout-minutes: 30
+      uses: porter-dev/porter-preview-action@v0.2.1
+      with:
+        action_id: ${{ github.run_id }}
+        cluster: "2481"
+        host: https://dashboard.getporter.dev
+        installation_id: "18533943"
+        namespace: pr-${{ github.event.inputs.pr_number }}-porter
+        pr_branch_from: ${{ github.event.inputs.pr_branch_from }}
+        pr_branch_into: ${{ github.event.inputs.pr_branch_into }}
+        pr_id: ${{ github.event.inputs.pr_number }}
+        pr_name: ${{ github.event.inputs.pr_title }}
+        project: "6680"
+        repo_name: porter
+        repo_owner: porter-dev
+        token: ${{ secrets.PORTER_PREVIEW_6680_2481 }}
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.event.inputs.pr_number }}

+ 1 - 0
.github/workflows/release.yaml

@@ -81,6 +81,7 @@ jobs:
           curl -L https://github.com/porter-dev/porter/releases/download/${version}/porter_${version}_Darwin_x86_64.zip --output $name
 
           sha=$(cat porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip | openssl sha256 | sed 's/(stdin)= //g')
+          sha=${sha#"SHA256"}
 
           cat >porter.rb <<EOL
           class Porter < Formula

+ 1 - 1
api/server/handlers/environment/finalize_deployment_with_errors.go

@@ -125,7 +125,7 @@ func (c *FinalizeDeploymentWithErrorsHandler) ServeHTTP(w http.ResponseWriter, r
 	var lastErrors []string
 
 	for resName, errString := range request.Errors {
-		lastErrors = append(lastErrors, "%s: %s,", resName, errString)
+		lastErrors = append(lastErrors, fmt.Sprintf("%s: %s", resName, errString))
 	}
 
 	depl.LastErrors = strings.Join(lastErrors, ",")

+ 30 - 0
porter.yaml

@@ -0,0 +1,30 @@
+version: v2beta1
+
+builds:
+- name: porter
+  method: docker
+  dockerfile: ./docker/Dockerfile
+  env:
+    raw: {}
+    import_from:
+      - default/base-env
+
+apps:
+- name: porter-dashboard
+  depends_on:
+    - postgres
+  helm_chart:
+    name: web
+  build_ref: porter
+  helm_values: # refer https://github.com/porter-dev/porter-charts/blob/master/applications/web/values.yaml
+    container:
+      command: 
+    resources:
+      requests:
+        cpu: 400m
+        memory: 512Mi
+
+addons:
+- name: postgres
+  helm_chart:
+    name: postgres

+ 3 - 6
services/cli_install_script_container/install.sh

@@ -14,12 +14,9 @@ download_and_install() {
 
     echo "[INFO] Since the Porter CLI gets installed in /usr/local/bin, you may be asked to input your password."
 
-    name=$(curl -s https://api.github.com/repos/porter-dev/porter/releases/latest | grep "browser_download_url.*/porter_.*_${osname}_x86_64\.zip" | cut -d ":" -f 2,3 | tr -d \")
-    name=$(basename $name)
-
-    curl -L https://github.com/porter-dev/porter/releases/latest/download/$name --output $name
-    unzip -a $name
-    rm $name
+    curl -L $(curl -s https://api.github.com/repos/porter-dev/porter/releases/latest | grep "browser_download_url.*/porter_.*_${osname}_x86_64\.zip" | cut -d ":" -f 2,3 | tr -d \") --output porter.zip
+    unzip -a porter.zip
+    rm porter.zip
 
     chmod +x ./porter
     sudo mv ./porter /usr/local/bin/porter