Skip to content

Commit

Permalink
Merge pull request #6 from jcrood/build-n-docs
Browse files Browse the repository at this point in the history
Hopefully enable image pushes, update documentation, add fs tests.
  • Loading branch information
jcrood authored Jun 6, 2022
2 parents 2fa5ea7 + 6c78fcb commit e0dff3f
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
push: ${{ github.event_name != 'pull_request' && (github.ref_name == 'master' || github.ref_type == 'tag') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Changelog


## v3.4.0 (Unreleased)

### UI improments

Adds Windows Powershell instructions, cleans up templates and bakes in the required
css and js assets, allowing Gangway to function without an internet connection. Shows
cluster name on homepage. Mostly based on PR https://github.com/vmware-archive/gangway/pull/137

Fixes:
- https://github.com/vmware-archive/gangway/issues/102
- https://github.com/vmware-archive/gangway/issues/135
- https://github.com/vmware-archive/gangway/issues/136
- https://github.com/vmware-archive/gangway/issues/177
- https://github.com/vmware-archive/gangway/issues/189

### Support self-signed CA

Adds an `idp-certificate-authority-data` to the kubectl config to allow it to renew tokens
when the IDP uses a self-signed CA. Merged from https://github.com/vmware-archive/gangway/pull/94


### Allow custom assets to be used in custom templates

Adds the `customAssetsDir` config option to override the contents of /assets/ for use in
custom templates.

### todo

...

### Other minor stuff

* Update to Go 1.18
* Update dependencies
* Replace esc with go:embed
* Root path check (https://github.com/vmware-archive/gangway/pull/143)
* Fix URL encoding (https://github.com/vmware-archive/gangway/pull/179)
* BREAKING - corrected ENV variable name of `customHTMLTemplatesDir` to `CUSTOM_HTML_TEMPLATES_DIR`,
this was (incorrectly) `CUSTOM_HTTP_TEMPLATES_DIR`
* Config option `showClaims` to show/hide received claims


## v3.3.0 (2021-07-15)

All the stuff it did before, see https://github.com/vmware-archive/gangway
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# This is a fork of Heptio Gangway!

... which was EOL-ed by VMware. See https://github.com/vmware-archive/gangway for the original.

This fork aims to continue development of Gangway for the two people still using it ;) It
has several of the PRs on the original merged, fixes a couple of the open issues and adds a
few other new bits. See the [changelog](CHANGELOG.md) for details.

gangway
=======

# This is a fork of Heptio Gangway, which was EOL-ed by VMware. See https://github.com/vmware-archive/gangway for the original

_(noun): An opening in the bulwark of the ship to allow passengers to board or leave the ship._

An application that can be used to easily enable authentication flows via OIDC for a kubernetes cluster.
Expand Down
54 changes: 54 additions & 0 deletions assets/fs_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package assets_test

import (
"errors"
"github.com/jcrood/gangway/assets"
"io/fs"
"testing"
)

func TestAssetFS(t *testing.T) {
t.Run("finds gangway assets", func(t *testing.T) {
filenames := []string{"gangway.css", "gangway.js"}
var missing, empty []string

for _, filename := range filenames {
file, err := assets.FS.ReadFile(filename)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
missing = append(missing, filename)
continue
}
t.Fatalf("failed to open asset %s: %v", filename, err)
}
if len(file) == 0 {
empty = append(empty, filename)
}
}
if len(missing) > 0 {
t.Fatalf("couldn't find asset: %v", missing)
}
if len(empty) > 0 {
t.Fatalf("empty assets: %v", empty)
}
})

t.Run("does not include non-assets", func(t *testing.T) {
filenames := []string{"fs.go", "fs_test.go"}
var found []string

for _, filename := range filenames {
_, err := assets.FS.ReadFile(filename)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
continue
}
t.Fatalf("failed to open asset %s: %v", filename, err)
}
found = append(found, filename)
}
if len(found) > 0 {
t.Fatalf("found files: %v", found)
}
})
}
54 changes: 54 additions & 0 deletions templates/fs_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package templates_test

import (
"errors"
"github.com/jcrood/gangway/templates"
"io/fs"
"testing"
)

func TestTemplateFS(t *testing.T) {
t.Run("finds templates", func(t *testing.T) {
filenames := []string{"commandline.tmpl", "home.tmpl"}
var missing, empty []string

for _, filename := range filenames {
file, err := templates.FS.ReadFile(filename)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
missing = append(missing, filename)
continue
}
t.Fatalf("failed to open template %s: %v", filename, err)
}
if len(file) == 0 {
empty = append(empty, filename)
}
}
if len(missing) > 0 {
t.Fatalf("couldn't find templates: %v", missing)
}
if len(empty) > 0 {
t.Fatalf("empty templates: %v", empty)
}
})

t.Run("does not include non-templates", func(t *testing.T) {
filenames := []string{"fs.go", "fs_test.go"}
var found []string

for _, filename := range filenames {
_, err := templates.FS.ReadFile(filename)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
continue
}
t.Fatalf("failed to open template %s: %v", filename, err)
}
found = append(found, filename)
}
if len(found) > 0 {
t.Fatalf("found files: %v", found)
}
})
}

0 comments on commit e0dff3f

Please sign in to comment.