Skip to content

Commit

Permalink
Makefile improvement, helm update repo ref
Browse files Browse the repository at this point in the history
* select right tag for binary build, since we now tag
  chart version too
* change repo reference to the new one (hosted on gcp). Old
  reference is still available (behind --> redirect to the new chart
  location), but will be deprecated at some point
  • Loading branch information
fydrah committed Jan 11, 2022
1 parent eacfed7 commit 7bf88be
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG REPO=github.com/fydrah/loginapp
RUN apk add --no-cache git build-base
COPY . /go/src/${REPO}
WORKDIR /go/src/${REPO}
RUN make go_build_static
RUN make

FROM scratch
ARG REPO=github.com/fydrah/loginapp
Expand Down
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Dirs
BUILDDIR := build
CMDDIR := cmd
TESTDIR := test

# Git
GIT_REPOSITORY := github.com/fydrah/loginapp
GIT_COMMIT_ID := $(shell git log -n 1 --pretty=format:%h)
GIT_TAG := $(shell git describe --tags)
GIT_TAG := $(shell git describe --tags --exclude="chart-*")

# Go
GOFLAGS :=
Expand All @@ -23,51 +24,58 @@ all: go_build

.PHONY: go_packr2
go_packr2:
# Go: install packr2
@echo "[Go] install packr2"
@which packr2 >/dev/null || go install github.com/gobuffalo/packr/v2/packr2@$(PACKR_VERSION)
@# packr2 still requires GO111MODULE var
# Go: run packr2 (embded assets)
@echo "[Go] run packr2 (embded assets)"
@packr2 clean
@GO111MODULE=on packr2

.PHONY: go_fmt
go_fmt:
# Go: fmt
@echo "[Go] fmt"
@go fmt ./...

.PHONY: go_mod_vendor
go_mod_vendor:
# Go: vendor
@echo "[Go] vendor"
@go mod vendor

.PHONY: go_build
go_build: go_mod_vendor go_packr2
# Go: build
CGO_ENABLED=0 go build -mod=vendor -o $(BUILDDIR)/loginapp $(GOFLAGS) -ldflags '$(LDFLAGS)' $(GIT_REPOSITORY)
@echo "[Go] build"
@CGO_ENABLED=0 go build -mod=vendor -o $(BUILDDIR)/loginapp $(GOFLAGS) -ldflags '$(LDFLAGS)' $(GIT_REPOSITORY)

.PHONY: docker_build
docker_build:
# Docker: build image
@echo "[Docker] build image"
@$(DOCKER_BUILD) -t $(DOCKER_REPOSITORY):$(GIT_COMMIT_ID)

.PHONY: docker_push
docker_push: docker_build
# Docker: push image
@echo "[Docker] push image"
@$(DOCKER_BIN) push $(DOCKER_REPOSITORY):$(GIT_COMMIT_ID)

.PHONY: helm_doc
helm_doc:
# Helm: doc
@echo "[Helm] doc"
@chart-doc-gen -d docs/chart.yaml -v=helm/loginapp/values.yaml > ./helm/loginapp/README.md

.PHONY: helm_package
helm_package: helm_doc
# Helm: package chart
@echo "[Helm] package chart"
@helm package -u helm/loginapp -d $(BUILDDIR)

.PHONY: clean
clean:
# Clean: binaries
@echo "[Clean] binaries"
@rm -f $(BUILDDIR)/loginapp
@rm -f $(BUILDDIR)/loginapp-*.tgz
@rm -f $(BUILDDIR)/index.yaml

.PHONY: clean_test
clean_test:
@echo "[Clean] dev env"
@rm -rf $(TESTDIR)/generated
@rm -rf $(TESTDIR)/kubernetes/generated
@rm -rf $(TESTDIR)/helm/generated
4 changes: 2 additions & 2 deletions docs/chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project:
url: https://github.com/fydrah/loginapp
description: OIDC authentication helper for Kubernetes
repository:
url: https://charts.fydrah.com
name: fydrah-stable
url: https://loginapp-releases.storage.googleapis.com/charts/
name: loginapp
chart:
name: loginapp
values: "-- generate from values file --"
Expand Down
2 changes: 1 addition & 1 deletion helm/loginapp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: v1.2.1
version: v1.2.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
10 changes: 5 additions & 5 deletions helm/loginapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
## TL;DR;

```console
$ helm repo add fydrah-stable https://charts.fydrah.com
$ helm repo add loginapp https://loginapp-releases.storage.googleapis.com/charts/
$ helm repo update
$ helm install loginapp fydrah-stable/loginapp -n auth
$ helm install loginapp loginapp/loginapp -n auth
```

## Introduction
Expand All @@ -28,7 +28,7 @@ This chart deploys on a [Kubernetes](http://kubernetes.io) cluster using the [H
To install the chart with the release name `loginapp`:

```console
$ helm install loginapp fydrah-stable/loginapp -n auth
$ helm install loginapp loginapp/loginapp -n auth
```

The command deploys on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
Expand Down Expand Up @@ -98,12 +98,12 @@ The following table lists the configurable parameters of the `loginapp` chart an
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:

```console
$ helm install loginapp fydrah-stable/loginapp -n auth --set replicas=1
$ helm install loginapp loginapp/loginapp -n auth --set replicas=1
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while
installing the chart. For example:

```console
$ helm install loginapp fydrah-stable/loginapp -n auth --values values.yaml
$ helm install loginapp loginapp/loginapp -n auth --values values.yaml
```

0 comments on commit 7bf88be

Please sign in to comment.