Repository: vmware-tanzu/octant
Pull request #839 (2020-04-10 23:41:45)

tag nightly
Signed-off-by: Wayne Witzel III <wayne@riotousliving.com>


**What this PR does / why we need it**:
Fixes the nightly build process that has been offline since April 4th when we disabled the drone nightly build.

wwitzel3: I'm testing this over on my fork tonight to see if setting the tag fixes the publishing issue.
GuessWhoSamFoo: how did this look on the fork?
wwitzel3: It can't parse the env variable again, will the call to push to the bucket is failing, so I need to jiggle the wires some more.
wwitzel3: Confirmed that this new approach works on my personal fork.

https://github.com/wwitzel3/octant/actions/runs/77555669

Patch:
diff --git a/.drone.yml b/.drone.yml
deleted file mode 100644
index 61c43439..00000000
--- a/.drone.yml
+++ /dev/null
@@ -1,71 +0,0 @@
----
-kind: pipeline
-name: octant
-
-workspace:
-  base: /go
-  path: src/github.com/vmware-tanzu/octant
-
-steps:
-  - name: fetch
-    image: docker:git
-    commands:
-      - git fetch --tags
-  - name: frontend
-    image: sfoo/node-chrome:0.0.2
-    commands:
-      - cd web
-      - npm ci
-      - npm run-script build
-      - npm run lint
-      - npm run test:headless
-  - name: backend
-    image: golang:1.13
-    environment:
-      GOFLAGS: -mod=vendor
-      GO111MODULE: on
-    commands:
-      - go run build.go go-install
-      - go run build.go test
-      - go generate ./web ./pkg/icon
-      - go run build.go vet
-    depends_on:
-    - frontend
-  - name: build
-    image: golang:1.13
-    environment:
-      CGO_ENABLED: 0
-    commands:
-      - go run build.go build
-    depends_on:
-    - frontend
-    - backend
-  - name: releaser
-    environment:
-      GITHUB_TOKEN:
-        from_secret: github_token
-    when:
-      event:
-        - tag
-    image: goreleaser/goreleaser:v0.120-cgo
-    commands:
-      - ci/drone-deploy.sh
-    depends_on:
-    - build
-  - name: releaser-nightly
-    environment:
-      GOOGLE_APPLICATION_JSON:
-        from_secret: google_application_json
-    when:
-      cron: [ nightly ]
-    image: goreleaser/goreleaser:v0.120-cgo
-    commands:
-      - echo "$GOOGLE_APPLICATION_JSON" | base64 -d > /tmp/gs.json
-      - GOOGLE_APPLICATION_CREDENTIALS=/tmp/gs.json goreleaser -f .goreleaser-nightly.yml --rm-dist --skip-validate
-    depends_on:
-     - build 
----
-kind: signature
-hmac: 9540a6d6fc51dceafdff21f9b5ebae279cc0679b55b4c7e3d58f775c20dd84f7
-
-...
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index 15457ef5..59161423 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -64,7 +64,12 @@ jobs:
           mv rice-web/rice-box.go ./web/
       - name: Run goreleaser
         run: |
-          goreleaser -f .goreleaser-nightly.yml --rm-dist --skip-validate --snapshot
+          git fetch --tags
+          git tag -d nightly
+          git tag nightly
+          echo "$GOOGLE_APPLICATION_JSON" > /tmp/gs.json
+          goreleaser -f .goreleaser-nightly.yml --rm-dist --skip-validate
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APP_JSON }}
+          GOOGLE_APPLICATION_JSON: ${{ secrets.GOOGLE_APP_JSON }}
+          GOOGLE_APPLICATION_CREDENTIALS: /tmp/gs.json
diff --git a/README.md b/README.md
index e335dbb9..65730515 100644
--- a/README.md
+++ b/README.md
@@ -131,8 +131,6 @@ Plugins are a core part of Octant in the Kubernetes ecosystem. A plugin can read
 
 An example plugin can be found in [`cmd/octant-sample-plugin`](cmd/octant-sample-plugin) and installed to the default plugin path with `go run build.go install-test-plugin`.
 
-Some plugins can be found on GitHub in the [`#octant-plugin`](https://github.com/topics/octant-plugin) topic (tag).
-
 Documentation for plugin components can be found in the [Plugins section](https://octant.dev/docs/master/plugins/) of the documentation.
 
 ## Discussion
diff --git a/changelogs/unreleased/831-wwitzel3 b/changelogs/unreleased/831-wwitzel3
deleted file mode 100644
index 1717a32c..00000000
--- a/changelogs/unreleased/831-wwitzel3
+++ /dev/null
@@ -1,1 +0,0 @@
-Fix bug that prevented Pod summary loading if status was nil/unknown.
diff --git a/changelogs/unreleased/839-wwitzel3 b/changelogs/unreleased/839-wwitzel3
new file mode 100644
index 00000000..935f5b95
--- /dev/null
+++ b/changelogs/unreleased/839-wwitzel3
@@ -0,0 +1,1 @@
+Fix nightly builds that broke when we moved to GitHub Actions
diff --git a/internal/printer/container.go b/internal/printer/container.go
index 47f38373..92b3653f 100644
--- a/internal/printer/container.go
+++ b/internal/printer/container.go
@@ -9,7 +9,6 @@ import (
 	"context"
 	"encoding/json"
 	"fmt"
-	"github.com/vmware-tanzu/octant/internal/log"
 	"path"
 	"sort"
 	"strings"
@@ -29,32 +28,8 @@ import (
 	"github.com/vmware-tanzu/octant/pkg/view/component"
 )
 
-
 type containerActionFunc func(runtime.Object, *corev1.Container) (component.Action, error)
 
-// ContainerConfigurationOption
-type ContainerConfigurationOption func(*ContainerConfiguration)
-
-func IsInit(b bool) ContainerConfigurationOption {
-	return func(cc *ContainerConfiguration) {
-		cc.isInit = b
-	}
-}
-
-func WithPrintOptions(options Options) ContainerConfigurationOption {
-	return func(cc *ContainerConfiguration) {
-		cc.options = options
-	}
-}
-
-func WithActions(actions ...containerActionFunc) ContainerConfigurationOption {
-	return func(cc *ContainerConfiguration) {
-		for _, action := range actions {
-			cc.actionGenerators = append(cc.actionGenerators, action)
-		}
-	}
-}
-
 // ContainerConfiguration generates container configuration.
 type ContainerConfiguration struct {
 	parent             runtime.Object
@@ -67,18 +42,17 @@ type ContainerConfiguration struct {
 }
 
 // NewContainerConfiguration creates an instance of ContainerConfiguration.
-func NewContainerConfiguration(ctx context.Context, parent runtime.Object, c *corev1.Container, pfs portforward.PortForwarder, opts ...ContainerConfigurationOption) *ContainerConfiguration {
-	cc := &ContainerConfiguration{
+func NewContainerConfiguration(ctx context.Context, parent runtime.Object, c *corev1.Container, pfs portforward.PortForwarder, isInit bool, options Options) *ContainerConfiguration {
+	actionGenerators := []containerActionFunc{}
+	return &ContainerConfiguration{
 		parent:             parent,
 		container:          c,
+		isInit:             isInit,
 		portForwardService: pfs,
+		options:            options,
 		context:            ctx,
-		actionGenerators:   []containerActionFunc{},
+		actionGenerators:   actionGenerators,
 	}
-	for _, o := range opts {
-		o(cc)
-	}
-	return cc
 }
 
 // Create creates a deployment configuration summary.
@@ -133,6 +107,10 @@ func (cc *ContainerConfiguration) Create() (*component.Summary, error) {
 
 		sections.AddText("Ready", fmt.Sprintf("%t", containerStatus.Ready))
 		sections.AddText("Restart Count", fmt.Sprintf("%d", containerStatus.RestartCount))
+	} else {
+		if !cc.isInit {
+			cc.actionGenerators = append(cc.actionGenerators, editContainerAction)
+		}
 	}
 
 	envTbl, err := describeContainerEnv(cc.context, cc.parent, c, cc.options)
@@ -167,9 +145,7 @@ func (cc *ContainerConfiguration) Create() (*component.Summary, error) {
 	for _, actionFunc := range cc.actionGenerators {
 		action, err := actionFunc(cc.parent, c)
 		if err != nil {
-			logger := log.From(cc.context)
-			logger.Errorf("failed loading actions: %w", err)
-			continue
+			return nil, errors.Wrap(err, "loading actions")
 		}
 		summary.AddAction(action)
 	}
@@ -554,6 +530,6 @@ func containersPathForObject(object runtime.Object) ([]string, error) {
 	case g.Group == "apps" && g.Kind == "StatefulSet":
 		return []string{"spec", "template", "spec", "containers"}, nil
 	default:
-		return nil, errors.Errorf("unable to find containers location for %+v, %s, %s", g, g.Group, g.Kind)
+		return nil, errors.Errorf("unable to find containers location for %s", g)
 	}
 }
diff --git a/internal/printer/job_template.go b/internal/printer/job_template.go
index e1ee0f44..60094b42 100644
--- a/internal/printer/job_template.go
+++ b/internal/printer/job_template.go
@@ -51,7 +51,7 @@ func (jt *JobTemplate) AddToFlexLayout(fl *flexlayout.FlexLayout, options Option
 	containerSection := fl.AddSection()
 
 	for _, container := range jt.jobTemplateSpec.Spec.Template.Spec.Containers {
-		containerConfig := NewContainerConfiguration(jt.context, jt.parent, &container, portForwarder, IsInit(false), WithPrintOptions(options))
+		containerConfig := NewContainerConfiguration(jt.context, jt.parent, &container, portForwarder, false, options)
 		summary, err := containerConfig.Create()
 		if err != nil {
 			return err
diff --git a/internal/printer/pod.go b/internal/printer/pod.go
index 14dd7cd7..2326f54f 100644
--- a/internal/printer/pod.go
+++ b/internal/printer/pod.go
@@ -749,7 +749,7 @@ func (p *podHandler) Containers(ctx context.Context, options Options) error {
 
 func defaultPodContainers(ctx context.Context, pod *corev1.Pod, container *corev1.Container, isInit bool, options Options) (*component.Summary, error) {
 	portForwarder := options.DashConfig.PortForwarder()
-	creator := NewContainerConfiguration(ctx, pod, container, portForwarder, IsInit(isInit), WithPrintOptions(options))
+	creator := NewContainerConfiguration(ctx, pod, container, portForwarder, isInit, options)
 	return creator.Create()
 }
 
diff --git a/internal/printer/pod_template.go b/internal/printer/pod_template.go
index d7d1505c..b4edbd50 100644
--- a/internal/printer/pod_template.go
+++ b/internal/printer/pod_template.go
@@ -109,13 +109,7 @@ func podTemplateContainers(ctx context.Context, fl *flexlayout.FlexLayout, optio
 	width := component.WidthHalf
 
 	for index, container := range options.containers {
-		containerConfig := NewContainerConfiguration(
-			ctx, options.parent, &container, portForwarder,
-			IsInit(options.isInit),
-			WithPrintOptions(options.printOptions),
-			WithActions(editContainerAction),
-		)
-
+		containerConfig := NewContainerConfiguration(ctx, options.parent, &container, portForwarder, options.isInit, options.printOptions)
 		summary, err := containerConfig.Create()
 		if err != nil {
 			return err
diff --git a/site/_includes/anchor_headings.html b/site/_includes/anchor_headings.html
index 4a8b32ff..21e2d047 100644
--- a/site/_includes/anchor_headings.html
+++ b/site/_includes/anchor_headings.html
@@ -1,6 +1,6 @@
 {% capture headingsWorkspace %}
   {% comment %}
-    Version 1.0.6
+    Version 1.0.4
       https://github.com/allejo/jekyll-anchor-headings
 
     "Be the pull request you wish to see in the world." ~Ben Balter
@@ -13,8 +13,7 @@
 
     Optional Parameters:
       * beforeHeading (bool)   : false  - Set to true if the anchor should be placed _before_ the heading's content
-      * anchorAttrs   (string) :  ''    - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
-                                          the `%heading%` placeholder is available
+      * anchorAttrs   (string) :  ''    - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`
       * anchorBody    (string) :  ''    - The content that will be placed inside the anchor; the `%heading%` placeholder is available
       * anchorClass   (string) :  ''    - The class(es) that will be used for each anchor. Separate multiple classes with a space
       * anchorTitle   (string) :  ''    - The `title` attribute that will be used for anchors
@@ -44,15 +43,11 @@
     {% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
     {% assign headerLevel = nextChar | times: 1 %}
 
-    <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
+    <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it -->
     {% if headerLevel == 0 %}
-      <!-- Split up the node based on closing angle brackets and get the first one. -->
-      {% assign firstChunk = node | split: '>' | first %}
-
-      <!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
-      {% unless firstChunk contains '<' %}
+      {% if nextChar != '<' and nextChar != '' %}
         {% capture node %}<h{{ node }}{% endcapture %}
-      {% endunless %}
+      {% endif %}
 
       {% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
       {% continue %}
@@ -81,7 +76,7 @@
       {% endif %}
 
       {% if include.anchorAttrs %}
-        {% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header }}{% endcapture %}
+        {% capture anchor %}{{ anchor }} {{ include.anchorAttrs }}{% endcapture %}
       {% endif %}
 
       {% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
@@ -107,4 +102,4 @@
     {% endcapture %}
     {% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
   {% endfor %}
-{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
+{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
\ No newline at end of file
diff --git a/site/_layouts/docs.html b/site/_layouts/docs.html
index e8461aed..f22f5401 100644
--- a/site/_layouts/docs.html
+++ b/site/_layouts/docs.html
@@ -31,12 +31,7 @@
               </div>
               <div class="col-md-8">
               <div class="documentation-container">
-                {% include anchor_headings.html
-                     html=content
-                     anchorClass="anchor-link"
-                     anchorBody='<i class="fas fa-link"></i><noscript>#</noscript>'
-                     anchorAttrs='aria-label="Link to &quot;%heading%&quot;"'
-                %}
+                {% include anchor_headings.html html=content %}
               </div>
               </div>
             </div>
diff --git a/site/_scss/site/common/_type.scss b/site/_scss/site/common/_type.scss
index 55533666..f5dfaacf 100644
--- a/site/_scss/site/common/_type.scss
+++ b/site/_scss/site/common/_type.scss
@@ -6,11 +6,6 @@ h4,
 h5,
 h6 {
   font-weight: $font-weight-medium;
-
-  a.anchor-link {
-    font-size: 0.55em;
-    vertical-align: middle;
-  }
 }
 
 h1,
diff --git a/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.html b/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.html
index 0aa20307..eb137b12 100644
--- a/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.html
+++ b/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.html
@@ -1,16 +1,13 @@
 <div class="labels-wrapper" *ngIf="labels">
-  <div class="labels-container">
-    <ng-container *ngFor="let label of showLabels; trackBy: trackByIdentity">
-        <span
-          *ngFor="let item of label | keyvalue; trackBy: trackByIdentity"
-          class="label label-light-blue clickable"
-          [title]="item.key+':'+item.value"
-          (click)="filterLabel(item.key, item.value)"
-        >
-          {{ item.key }}:{{ item.value }}
-        </span>
-    </ng-container>
-  </div>
+  <ng-container *ngFor="let label of showLabels; trackBy: trackByIdentity">
+    <span
+      *ngFor="let item of label | keyvalue; trackBy: trackByIdentity"
+      class="label label-light-blue clickable"
+      (click)="filterLabel(item.key, item.value)"
+    >
+      {{ item.key }}:{{ item.value }}
+    </span>
+  </ng-container>
 
   <clr-signpost *ngIf="overflowLabels && overflowLabels.length > 0">
     <span class="badge badge-light-blue" clrSignpostTrigger>
diff --git a/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.scss b/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.scss
index fc9d44c1..cfc266a3 100644
--- a/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.scss
+++ b/web/src/app/modules/shared/components/presentation/overflow-labels/overflow-labels.component.scss
@@ -5,22 +5,10 @@
 .labels-wrapper {
   display: flex;
   align-items: center;
+  flex-wrap: nowrap;
 
-  .labels-container {
-    display: grid;
-    grid-auto-flow: column;
-
-    .label {
-      display: inline-block;
-      line-height: 0.9rem;
-      white-space: nowrap;
-      overflow: hidden;
-      text-overflow: ellipsis;
-
-      &.clickable {
-        cursor: pointer;
-      }
-    }
+  .label.clickable {
+    cursor: pointer;
   }
 }
 
diff --git a/web/src/styles.scss b/web/src/styles.scss
index 0a6c44f2..3d91225a 100644
--- a/web/src/styles.scss
+++ b/web/src/styles.scss
@@ -10,6 +10,17 @@
 @import '~highlight.js/styles/github.css';
 @import '~@ng-select/ng-select/themes/default.theme.css';
 
+/* Clarity's Datagrid overflow is hidden making impossible to display something 
+ * like a Signpost inside of it. This makes it possible.
+ */ 
+clr-datagrid .datagrid-outer-wrapper {
+  &, .datagrid-inner-wrapper {
+    &, .datagrid {
+      overflow: visible;
+    }
+  }
+}
+
 // Avoid Datagrid's header sticky position.
 .datagrid-table .datagrid-header {
   position: initial;


Test patch:
diff --git a/internal/printer/container_test.go b/internal/printer/container_test.go
index c60c72c5..d7927d91 100644
--- a/internal/printer/container_test.go
+++ b/internal/printer/container_test.go
@@ -364,7 +364,7 @@ func Test_ContainerConfiguration(t *testing.T) {
 				tpo.objectStore.EXPECT().Get(ctx, gomock.Eq(key)).Return(testutil.ToUnstructured(t, configMap), nil).AnyTimes()
 			}
 
-			cc := NewContainerConfiguration(ctx, parentPod, tc.container, pf, IsInit(tc.isInit), WithPrintOptions(printOptions))
+			cc := NewContainerConfiguration(ctx, parentPod, tc.container, pf, tc.isInit, printOptions)
 			summary, err := cc.Create()
 			if tc.isErr {
 				require.Error(t, err)