Skip to content

Commit

Permalink
Add versioning for Docker images (#25)
Browse files Browse the repository at this point in the history
* Add versioning for Docker images

* Update github-actions

* Exclude tagging and PR builds from GitHub-actions

* Use only a minor update that does not affect the application version
  • Loading branch information
night-codes committed Oct 19, 2023
1 parent 7950267 commit 75762c5
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 17 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/build_and_push_docker_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:
- name: Check out repository
uses: actions/checkout@v2

- name: Extract version from Chart.yaml
id: extract_version
run: |
VERSION=$(awk -F": " '/appVersion:/ {print $2}' ./helm-chart/Chart.yaml | tr -d '"')
echo "Extracted version: $VERSION"
echo "::set-output name=version::$VERSION"
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand All @@ -41,4 +49,6 @@ jobs:
with:
context: .
push: true
tags: public.ecr.aws/flexera/cbi-oi-kubecost-exporter:latest
tags: |
public.ecr.aws/flexera/cbi-oi-kubecost-exporter:${{ steps.extract_version.outputs.version }}
public.ecr.aws/flexera/cbi-oi-kubecost-exporter:latest
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: generate test depend

generate: depend test
# Extract appVersion from Chart.yaml and update it in values.yaml
@VERSION=$$(grep 'appVersion:' ./helm-chart/Chart.yaml | awk '{print $$2}' | tr -d '"') && \
sed -i '' -E "s/^( tag: ).*/\1\"$$VERSION\"/" ./helm-chart/values.yaml

# Run go generate
@go generate ./...

# Update README
@cd ./helm-chart && helm-docs

# Package the Helm chart
@cd ./helm-chart && helm package .

# Update Helm repo index
@helm repo index .

# Run Go tests
test:
@go test ./...

# Install dependencies
depend:
# Install Go dependencies
@go mod download

# Install helm-docs
@go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module cbi-oi-kubecost-exporter

go 1.21.2
go 1.21

require github.com/caarlos0/env/v7 v7.1.0
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Kubecost exporter helm chart for Kubernetes
# 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.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.4.1
version: 1.4.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. Versions are not expected to
Expand Down
11 changes: 4 additions & 7 deletions helm-chart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cbi-oi-kubecost-exporter

![Version: 1.4.1](https://img.shields.io/badge/Version-1.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4](https://img.shields.io/badge/AppVersion-1.4-informational?style=flat-square)
![Version: 1.4.2](https://img.shields.io/badge/Version-1.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4](https://img.shields.io/badge/AppVersion-1.4-informational?style=flat-square)

### Kubecost exporter helm chart for Kubernetes

Expand Down Expand Up @@ -84,17 +84,17 @@ You should see 200/201s in the logs, which indicates that the exporter is workin
## Values

| Key | Type | Default | Description |
| --- | --- | --- | --- |
|-----|------|---------|-------------|
| cronSchedule | string | `"0 */6 * * *"` | Setting up a cronJob scheduler to run an export task at the right time |
| filePath | string | `"/var/kubecost"` | Filepath to mount persistent volume |
| fileRotation | bool | `true` | Delete files generated for the previous month (or the month before the previous month if INCLUDE_PREVIOUS_MONTH is set to true) |
| flexera.billConnectId | string | `"cbi-oi-kubecost-1"` | Bill Connect ID |
| flexera.orgId | string | `""` | Flexera Organization ID |
| flexera.refreshToken | string | `""` | Refresh Token from FlexeraOne You can provide the refresh token in two ways: 1. Directly as a string: refreshToken: "your_token_here" 2. Reference it from a Kubernetes secret: refreshToken: valueFrom: secretKeyRef: name: flexera-secrets # Name of the Kubernetes secret key: refresh_token # Key in the secret containing the refresh token |
| flexera.refreshToken | string | `""` | Refresh Token from FlexeraOne You can provide the refresh token in two ways: 1. Directly as a string: refreshToken: "your_token_here" 2. Reference it from a Kubernetes secret: refreshToken: valueFrom: secretKeyRef: name: flexera-secrets # Name of the Kubernetes secret key: refresh_token # Key in the secret containing the refresh token |
| flexera.shard | string | `"NAM"` | Shard ("NAM", "EU", "AU") |
| image.pullPolicy | string | `"Always"` | |
| image.repository | string | `"public.ecr.aws/flexera/cbi-oi-kubecost-exporter"` | |
| image.tag | string | `"latest"` | |
| image.tag | string | `"1.4"` | |
| imagePullSecrets | list | `[]` | |
| includePreviousMonth | bool | `false` | Include data from previous month to export process |
| kubecost.aggregation | string | `"pod"` | Aggregation Level ("namespace", "controller", "pod") |
Expand All @@ -108,6 +108,3 @@ You should see 200/201s in the logs, which indicates that the exporter is workin
| persistentVolume.enabled | bool | `true` | Enable Persistent Volume. If this setting is disabled, it may lead to inability to store history and data uploads older than 15 days in Flexera One |
| persistentVolume.size | string | `"1Gi"` | Persistent Volume size |

---

Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
Binary file added helm-chart/cbi-oi-kubecost-exporter-1.4.2.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
image:
repository: public.ecr.aws/flexera/cbi-oi-kubecost-exporter
pullPolicy: Always
tag: "latest"
tag: "1.4"

imagePullSecrets: []

Expand Down
22 changes: 16 additions & 6 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ entries:
cbi-oi-kubecost-exporter:
- apiVersion: v2
appVersion: "1.4"
created: "2023-10-19T13:23:11.848738-06:00"
created: "2023-10-19T16:26:14.241281-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 5b296e921178d84717345be19b92a4eea0c9ca1c65410128dec596692220c8e2
name: cbi-oi-kubecost-exporter
type: application
urls:
- helm-chart/cbi-oi-kubecost-exporter-1.4.2.tgz
version: 1.4.2
- apiVersion: v2
appVersion: "1.4"
created: "2023-10-19T16:26:14.24105-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: ab6992a0af9f24d5c090db71679b7f274f3576b1cfbe91325e0d6e9af317657e
name: cbi-oi-kubecost-exporter
Expand All @@ -13,7 +23,7 @@ entries:
version: 1.4.1
- apiVersion: v2
appVersion: "1.4"
created: "2023-10-19T13:23:11.848386-06:00"
created: "2023-10-19T16:26:14.240691-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 870030e989ba274f8b0f9d122a4ada24a4d29ef2c071408bf46d86e18942effd
name: cbi-oi-kubecost-exporter
Expand All @@ -23,7 +33,7 @@ entries:
version: 1.4.0
- apiVersion: v2
appVersion: "1.3"
created: "2023-10-19T13:23:11.848033-06:00"
created: "2023-10-19T16:26:14.24028-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 0d967927bfab5f4bb6d40ce062710679e98b145c4b3f38709c0bf5d216ad8606
name: cbi-oi-kubecost-exporter
Expand All @@ -33,7 +43,7 @@ entries:
version: 1.3.0
- apiVersion: v2
appVersion: "1.2"
created: "2023-10-19T13:23:11.847211-06:00"
created: "2023-10-19T16:26:14.239255-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: d0c724c7bb085a1801e27f60ff748bc69aba14425cfd27fd132f99966692ed80
name: cbi-oi-kubecost-exporter
Expand All @@ -43,12 +53,12 @@ entries:
version: 1.2.0
- apiVersion: v2
appVersion: "1.1"
created: "2023-10-19T13:23:11.846807-06:00"
created: "2023-10-19T16:26:14.238861-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: c6f2681575b704b5934efea2357921896d55c4ad5e09692f31ab92b9e614cfea
name: cbi-oi-kubecost-exporter
type: application
urls:
- helm-chart/cbi-oi-kubecost-exporter-1.1.0.tgz
version: 1.1.0
generated: "2023-10-19T13:23:11.846038-06:00"
generated: "2023-10-19T16:26:14.237939-06:00"

0 comments on commit 75762c5

Please sign in to comment.