Skip to content

Commit

Permalink
feat: update postman extension
Browse files Browse the repository at this point in the history
- added helm chart
- added audit stept and removed all warnings
- fixed user in dockerfile
- removed unused sources
  • Loading branch information
ReuDa committed Apr 19, 2023
1 parent ff6ddfd commit e4a0af6
Show file tree
Hide file tree
Showing 21 changed files with 674 additions and 64 deletions.
128 changes: 117 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,28 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
audit:
name: Audit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v4
with:
go-version: '^1.20.0'

- name: Audit
run: |
go mod download
make audit
build-images:
name: Build Docker Images
needs:
- audit
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -23,22 +44,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'

- name: Execute go tests
run: |
go mod download
go test ./...
- name: Log in to the container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
Expand All @@ -53,7 +67,7 @@ jobs:
images: steadybit/extension-postman

- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: ./
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -64,3 +78,95 @@ jobs:
NAME=${{ github.repository }}
VERSION=${{ steps.meta.outputs.version }}
REVISION=${{ github.sha }}
test-helm-charts:
name: "Test Helm Charts"
runs-on: ubuntu-latest
needs:
- build-images
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.9.0

- name: Add dependency chart repos
run: |
helm repo add steadybit https://steadybit.github.io/helm-charts
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Add unit testing plugin
run: |
helm plugin install https://github.com/quintush/helm-unittest
- name: Run unit tests
run: make charttesting

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
if: github.event_name == 'pull_request'
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --config chartTesting.yaml
if: github.event_name == 'pull_request'

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --config chartTesting.yaml


release-helm-chart:
name: "Release Helm Chart"
runs-on: ubuntu-latest
needs:
- test-helm-charts
if: github.event_name != 'pull_request'

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.8.1

- name: Add dependency chart repos
run: |
helm repo add steadybit https://steadybit.github.io/helm-charts
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ RUN go mod download
COPY . .

RUN go build \
-ldflags="\
-X 'github.com/steadybit/extension-kit/extbuild.ExtensionName=${NAME}' \
-X 'github.com/steadybit/extension-kit/extbuild.Version=${VERSION}' \
-X 'github.com/steadybit/extension-kit/extbuild.Revision=${REVISION}'" \
-o /extension-postman
-ldflags="\
-X 'github.com/steadybit/extension-kit/extbuild.ExtensionName=${NAME}' \
-X 'github.com/steadybit/extension-kit/extbuild.Version=${VERSION}' \
-X 'github.com/steadybit/extension-kit/extbuild.Revision=${REVISION}'" \
-o ./extension

##
## Runtime
Expand All @@ -34,7 +34,7 @@ ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" ALPINE_NODE_R
RUN npm install -g [email protected] [email protected] [email protected]

ARG USERNAME=steadybit
ARG USER_UID=10000
ARG USER_UID=1000

RUN adduser -u $USER_UID -D $USERNAME

Expand Down
72 changes: 72 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ==================================================================================== #
# HELPERS
# ==================================================================================== #

## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'


# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #

## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v

## audit: run quality control checks
.PHONY: audit
audit:
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...
go test -race -vet=off ./...
go mod verify

## charttesting: Run Helm chart unit tests
.PHONY: charttesting
charttesting:
for dir in charts/steadybit-extension-*; do \
echo "Unit Testing $$dir"; \
helm unittest $$dir; \
done

# ==================================================================================== #
# BUILD
# ==================================================================================== #

## build: build the extension
.PHONY: build
build:
go mod verify
go build -o=./extension

## run: run the extension
.PHONY: run
run: tidy build
./extension

## container: build the container image
.PHONY: container
container:
docker build -t extension-scaffold:latest .

# ==================================================================================== #
# EJECT
# ==================================================================================== #

## eject: remove / clear up files associated with the scaffold repository
.PHONY: eject
eject:
rm CHANGELOG.md
mv CHANGELOG.SCAFFOLD.md CHANGELOG.md
rm CONTRIBUTING.md
mv CONTRIBUTING.SCAFFOLD.md CONTRIBUTING.md
rm README.md
mv README.SCAFFOLD.md README.md
rm LICENSE
mv LICENSE.SCAFFOLD LICENSE
8 changes: 8 additions & 0 deletions chartTesting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
target-branch: main
chart-dirs:
- charts
chart-repos:
- steadybit=https://steadybit.github.io/helm-charts
helm-extra-args: --timeout 600s
24 changes: 24 additions & 0 deletions charts/steadybit-extension-postman/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
tests/
6 changes: 6 additions & 0 deletions charts/steadybit-extension-postman/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: extensionlib
repository: file://../extensionlib
version: 1.1.0
digest: sha256:879bad84294a47470dfe46ec15a7a10e9f42e2c3ce12ddf7bcbcb79577caa918
generated: "2023-03-21T21:24:24.917222+01:00"
25 changes: 25 additions & 0 deletions charts/steadybit-extension-postman/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: steadybit-extension-postman
description: Steadybit Postman extension Helm chart for Kubernetes.
version: 1.6.2
appVersion: latest
home: https://www.steadybit.com/
icon: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png
maintainers:
- email: [email protected]
name: reuda
sources:
- https://github.com/steadybit/helm-charts
annotations:
artifacthub.io/images: |
- name: logo
image: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png
artifacthub.io/links: |-
- name: steadybit website
url: https://www.steadybit.com
- name: steadybit Kubernetes Helm charts
url: https://github.com/steadybit/helm-charts
dependencies:
- name: extensionlib
version: ~1.1.0
repository: file://../extensionlib
26 changes: 26 additions & 0 deletions charts/steadybit-extension-postman/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Steadybit Postman Extension

This Helm chart adds the Steadybit Postman extension to your Kubernetes cluster via a deployment.

## Quick Start

### Add Steadybit Helm repository

```
helm repo add steadybit https://steadybit.github.io/helm-charts
helm repo update
```

### Installing the Chart

To install the chart with the name `steadybit-extension-postman` and set the required configuration values.

```bash
$ helm upgrade steadybit-extension-postman \
--install \
--wait \
--timeout 5m0s \
--create-namespace \
--namespace steadybit-extension \
steadybit/steadybit-extension-postman
```
Binary file not shown.
Loading

0 comments on commit e4a0af6

Please sign in to comment.