소스 검색

Merge branch 'master' of https://github.com/porter-dev/porter into beta.3.integration-frontend

jusrhee 5 년 전
부모
커밋
baaeca6339

+ 25 - 16
.github/workflows/release.yaml

@@ -58,6 +58,31 @@ jobs:
         uses: actions/setup-go@v2
         with:
           go-version: 1.15
+      - name: Write Dashboard Environment Variables
+        run: |
+          cat >./dashboard/.env <<EOL
+          NODE_ENV=production
+          API_SERVER=dashboard.getporter.dev
+          FULLSTORY_ORG_ID=${{secrets.FULLSTORY_ORG_ID}}
+          DISCORD_KEY=${{secrets.DISCORD_KEY}}
+          DISCORD_CID=${{secrets.DISCORD_CID}}
+          FEEDBACK_ENDPOINT=${{secrets.FEEDBACK_ENDPOINT}}
+          EOL
+      - name: Build and zip static folder
+        run: |
+          mkdir -p ./release/static
+          cd dashboard
+          npm i --production=false
+          npm run build
+          cd ..
+          zip --junk-paths ./release/static/static_${{steps.tag_name.outputs.tag}}.zip ./dashboard/build/*
+        env:
+          NODE_ENV: production
+          API_SERVER: ${{ secrets.API_SERVER }}
+          FULLSTORY_ORG_ID: ${{ secrets.FULLSTORY_ORG_ID }}
+          DISCORD_KEY: ${{ secrets.DISCORD_KEY }}
+          DISCORD_CID: ${{ secrets.DISCORD_CID }}
+          FEEDBACK_ENDPOINT: ${{ secrets.FEEDBACK_ENDPOINT }}
       - name: Build Linux binaries
         run: |
           go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd.Version=${{steps.tag_name.outputs.tag}}'" -a -tags cli -o ./porter ./cli &
@@ -108,22 +133,6 @@ jobs:
           zip --junk-paths ./release/windows/porter_${{steps.tag_name.outputs.tag}}_Windows_x86_64.zip ./porter.exe
           zip --junk-paths ./release/windows/portersvr_${{steps.tag_name.outputs.tag}}_Windows_x86_64.zip ./portersvr.exe
           zip --junk-paths ./release/windows/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Windows_x86_64.zip ./docker-credential-porter.exe
-      - name: Build and zip static folder
-        run: |
-          mkdir -p ./release/static
-          cd dashboard
-          npm i
-          npm i html-webpack-plugin --save-dev
-          npm run build
-          cd ..
-          zip --junk-paths ./release/static/static_${{steps.tag_name.outputs.tag}}.zip ./dashboard/build/*
-        env:
-          NODE_ENV: production
-          API_SERVER: ${{ secrets.API_SERVER }}
-          FULLSTORY_ORG_ID: ${{ secrets.FULLSTORY_ORG_ID }}
-          DISCORD_KEY: ${{ secrets.DISCORD_KEY }}
-          DISCORD_CID: ${{ secrets.DISCORD_CID }}
-          FEEDBACK_ENDPOINT: ${{ secrets.FEEDBACK_ENDPOINT }}
       - name: Upload binaries
         uses: actions/upload-artifact@v2
         with:

+ 8 - 1
cli/cmd/docker.go

@@ -7,6 +7,7 @@ import (
 	"net/url"
 	"os"
 	"path/filepath"
+	"strings"
 
 	"github.com/porter-dev/porter/cli/cmd/api"
 	"github.com/porter-dev/porter/cli/cmd/github"
@@ -56,8 +57,14 @@ func dockerConfig(user *api.AuthCheckResponse, client *api.Client, args []string
 
 	for _, registry := range registries {
 		if registry.URL != "" {
+			rURL := registry.URL
+
+			if !strings.Contains(rURL, "http") {
+				rURL = "http://" + rURL
+			}
+
 			// strip the protocol
-			regURL, err := url.Parse(registry.URL)
+			regURL, err := url.Parse(rURL)
 
 			if err != nil {
 				continue

+ 4 - 0
cmd/docker-credential-porter/helper/helper.go

@@ -44,6 +44,8 @@ var ecrPattern = regexp.MustCompile(`(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(\-fi
 // Get retrieves credentials from the store.
 // It returns username and secret as strings.
 func (p *PorterHelper) Get(serverURL string) (user string, secret string, err error) {
+	p.init()
+
 	if strings.Contains(serverURL, "gcr.io") {
 		return p.getGCR(serverURL)
 	}
@@ -154,6 +156,8 @@ func (p *PorterHelper) getECR(serverURL string) (user string, secret string, err
 
 // List returns the stored serverURLs and their associated usernames.
 func (p *PorterHelper) List() (map[string]string, error) {
+	p.init()
+
 	credCache := BuildCredentialsCache("")
 	entries := credCache.List()
 

+ 1 - 6
dashboard/package-lock.json

@@ -981,11 +981,6 @@
       "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=",
       "dev": true
     },
-    "ansi-parser": {
-      "version": "3.2.10",
-      "resolved": "https://registry.npmjs.org/ansi-parser/-/ansi-parser-3.2.10.tgz",
-      "integrity": "sha512-CGKGIbd678lm15IXJXI1cTyOVAnMQw0jES+klW/yIc+GzYccsYanLMhczPIIj2hE64B79g75QfiuWrEWd6nJdg=="
-    },
     "ansi-regex": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
@@ -1158,7 +1153,7 @@
       "dev": true
     },
     "axios": {
-      "version": "0.21.1",
+      "version": "0.20.0",
       "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
       "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
       "requires": {

+ 41 - 4
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -430,6 +430,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
 
   componentDidMount() {
     let { currentCluster, currentProject } = this.context;
+    let { currentChart } = this.props;
 
     this.getChartData(this.props.currentChart);
     this.getControllers(this.props.currentChart)
@@ -438,6 +439,23 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
       this.props.currentChart 
     );
 
+    api.getChartComponents('<token>', {
+      namespace: currentChart.namespace,
+      cluster_id: currentCluster.id,
+      storage: StorageType.Secret
+    }, {
+      id: currentProject.id,
+      name: currentChart.name,
+      revision: currentChart.version
+    }, (err: any, res: any) => {
+      if (err) {
+        console.log(err)
+      } else {
+        this.setState({ components: res.data.Objects });
+        console.log(res.data.Objects)
+      }
+    });
+
     api.getIngress('<token>', { 
       cluster_id: currentCluster.id,
     }, {
@@ -449,9 +467,8 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
         console.log(err);
         return
       }
-      if (res.data) {
-        this.setState({url: `http://${res.data?.status?.loadBalancer?.ingress[0]?.hostname}` })
-      }
+      console.log(res.data)
+      this.setState({url: `http://${res.data?.status?.loadBalancer?.ingress[0]?.hostname}` })
     })
   }
 
@@ -472,7 +489,19 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
 
   renderUrl = () => {
     if (this.state.url) {
-      return <Url href={this.state.url} target='_blank'>{this.state.url}</Url>;
+      return <Url href={this.state.url} target='_blank'> <i className="material-icons">link</i> {this.state.url}</Url>;
+    } else {
+      let serviceName = null as string
+      let serviceNamespace = null as string
+
+      this.state.components.forEach((c: any) => {
+        if (c.Kind == "Service") {
+          serviceName = c.Name
+          serviceNamespace = c.Namespace
+        }
+      })
+
+      return <Url><i className="material-icons">link</i>{`${serviceName}.${serviceNamespace}.namespace.svc.cluster.local`}</Url>
     }
   }
 
@@ -551,6 +580,14 @@ const Url = styled.a`
   font-size: 13px;
   margin-top: 15px;
   margin-bottom: -5px;
+  user-select: text;
+  display: flex;
+  align-items: center;
+
+  > i {
+    font-size: 15px;
+    margin-right: 10px;
+  }
 `;
 
 const TabButton = styled.div`

+ 16 - 1
dashboard/src/main/home/modals/UpdateClusterModal.tsx

@@ -104,6 +104,12 @@ export default class UpdateClusterModal extends Component<PropsType, StateType>
           onYes={this.handleDelete}
           onNo={() => this.setState({ showDeleteOverlay: false })}
         />
+
+        <Warning>
+         ⚠️ Deletion via Porter may result in dangling resources.  
+         Please visit the AWS console to ensure that all resources have been removed.
+        </Warning>
+
       </StyledUpdateProjectModal>
       );
   }
@@ -196,4 +202,13 @@ const StyledUpdateProjectModal= styled.div`
   overflow: hidden;
   border-radius: 6px;
   background: #202227;
-`;
+`;
+
+const Warning = styled.div`
+  width: 65%;
+  margin-top: 3px;
+  font-family: 'Work Sans', sans-serif;
+  font-size: 13px;
+  color: #aaaabb;
+  text-align: justify;
+`

+ 14 - 1
dashboard/src/main/home/modals/UpdateProjectModal.tsx

@@ -128,6 +128,10 @@ export default class UpdateProjectModal extends Component<PropsType, StateType>
           onYes={this.handleDelete}
           onNo={() => this.setState({ showDeleteOverlay: false })}
         />
+        <Warning>
+         ⚠️ Deletion via Porter may result in dangling resources.  
+         Please visit the AWS console to ensure that all resources have been removed.
+        </Warning>
       </StyledUpdateProjectModal>
       );
   }
@@ -228,4 +232,13 @@ const StyledUpdateProjectModal= styled.div`
   overflow: hidden;
   border-radius: 6px;
   background: #202227;
-`;
+`;
+
+const Warning = styled.div`
+  width: 65%;
+  margin-top: 3px;
+  font-family: 'Work Sans', sans-serif;
+  font-size: 13px;
+  color: #aaaabb;
+  text-align: justify;
+`

+ 1 - 1
internal/kubernetes/provisioner/provisioner.go

@@ -61,7 +61,7 @@ func (conf *Conf) GetProvisionerJobTemplate() (*batchv1.Job, error) {
 	env = conf.attachDefaultEnv(env)
 
 	ttl := int32(3600)
-	backoffLimit := int32(3)
+	backoffLimit := int32(5)
 
 	labels := map[string]string{
 		"app": "provisioner",

+ 2 - 1
server/api/registry_handler.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"net/http"
 	"strconv"
+	"strings"
 	"time"
 
 	"github.com/porter-dev/porter/internal/registry"
@@ -198,7 +199,7 @@ func (app *App) HandleGetProjectRegistryGCRToken(w http.ResponseWriter, r *http.
 	var expiresAt *time.Time
 
 	for _, reg := range regs {
-		if reg.GCPIntegrationID != 0 && reg.URL == reqBody.ServerURL {
+		if reg.GCPIntegrationID != 0 && strings.Contains(reg.URL, reqBody.ServerURL) {
 			_reg := registry.Registry(*reg)
 
 			tokenCache, err := _reg.GetGCRToken(*app.Repo)