-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d139af5
commit 88f4c88
Showing
16 changed files
with
404 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
publish: | ||
description: Whether or not to publish the chart | ||
type: boolean | ||
outputs: | ||
chart_version: | ||
value: ${{ jobs.publish_chart.outputs.chart_version }} | ||
|
||
jobs: | ||
publish_chart: | ||
runs-on: | ||
- self-hosted | ||
|
||
outputs: | ||
chart_version: ${{ steps.version.outputs.chart_version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- id: version | ||
run: | | ||
chart_version=$(yq '.version' ./charts/home-assistant-integrations/Chart.yaml) | ||
echo chart_version=$chart_version >> $GITHUB_OUTPUT | ||
- id: package | ||
env: | ||
chart_version: ${{ steps.version.outputs.chart_version }} | ||
run: | | ||
helm package ./charts/home-assistan-integrations | ||
old_filepath=home-assistant-integrations-$chart_version.tgz | ||
new_filepath=home-assistant-integrations.$chart_version.tgz | ||
mv $old_filepath $new_filepath | ||
echo "filepath=$new_filepath" | tee -a $GITHUB_OUTPUT | ||
- uses: OctopusDeploy/login@v1 | ||
if: inputs.publish == true | ||
with: | ||
server: ${{ vars.OCTOPUS_DEPLOY_SERVER_URL }} | ||
service_account_id: ${{ vars.OCTOPUS_DEPLOY_EXTERNAL_ID }} | ||
|
||
- uses: OctopusDeploy/push-package-action@v3 | ||
if: inputs.publish == true | ||
with: | ||
packages: ${{ steps.package.outputs.filepath }} | ||
overwrite_mode: FailIfExists | ||
|
||
- uses: OctopusDeploy/push-build-information-action@v3 | ||
if: inputs.publish == true | ||
with: | ||
packages: ${{ vars.OCTOPUS_DEPLOY_CHART_PACKAGE_ID }} | ||
version: ${{ steps.version.outputs.chart_version }} | ||
overwrite_mode: FailIfExists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
publish: | ||
description: Whether or not to publish the image | ||
type: boolean | ||
default: false | ||
outputs: | ||
image_tag: | ||
value: ${{ jobs.publish_image.outputs.image_tag }} | ||
|
||
env: | ||
IMAGE: public.ecr.aws/axatol/home-assistant-integrations | ||
|
||
jobs: | ||
publish_image: | ||
runs-on: | ||
- self-hosted | ||
|
||
outputs: | ||
image_tag: ${{ steps.version.outputs.image_tag }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- id: version | ||
run: | | ||
image_tag=$(yq '.appVersion' ./charts/home-assistant-integrations/Chart.yaml) | ||
echo image_tag=$image_tag >> $GITHUB_OUTPUT | ||
- env: | ||
image: ${{ env.IMAGE }} | ||
tag: ${{ steps.version.outputs.image_tag }} | ||
run: | | ||
make build-image IMAGE_NAME=$image BUILD_VERSION=$tag | ||
docker tag $image:$tag $image:latest | ||
- if: inputs.publish == true | ||
env: | ||
image: ${{ env.IMAGE }} | ||
tag: ${{ steps.version.outputs.image_tag }} | ||
run: | | ||
docker push $image:$tag | ||
docker push $image:latest | ||
- uses: axatol/actions/assume-aws-role@release | ||
if: inputs.publish == true | ||
with: | ||
aws-region: us-east-1 | ||
role-to-assume: ${{ secrets.AWS_ECR_IMAGE_PUBLISHER_ROLE_ARN }} | ||
|
||
- uses: aws-actions/amazon-ecr-login@v2 | ||
if: inputs.publish == true | ||
with: | ||
registry-type: public | ||
mask-password: true | ||
|
||
- uses: OctopusDeploy/login@v1 | ||
if: inputs.publish == true | ||
with: | ||
server: ${{ vars.OCTOPUS_DEPLOY_SERVER_URL }} | ||
service_account_id: ${{ vars.OCTOPUS_DEPLOY_EXTERNAL_ID }} | ||
|
||
- uses: OctopusDeploy/push-build-information-action@v3 | ||
if: inputs.publish == true | ||
with: | ||
packages: ${{ vars.OCTOPUS_DEPLOY_IMAGE_PACKAGE_ID }} | ||
version: ${{ steps.version.outputs.image_tag }} | ||
overwrite_mode: FailIfExists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
chart_version: | ||
description: The version of the chart to release | ||
type: string | ||
required: true | ||
image_tag: | ||
description: The tag of the image to release | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
release: | ||
runs-on: | ||
- self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- uses: OctopusDeploy/login@v1 | ||
with: | ||
server: ${{ vars.OCTOPUS_DEPLOY_SERVER_URL }} | ||
service_account_id: ${{ vars.OCTOPUS_DEPLOY_EXTERNAL_ID}} | ||
|
||
- uses: OctopusDeploy/create-release-action@v3 | ||
id: release | ||
with: | ||
project: ${{ vars.OCTOPUS_DEPLOY_PROJECT }} | ||
packages: | | ||
*:image:${{ inputs.image_tag }} | ||
*:chart:${{ inputs.chart_version }} | ||
- uses: OctopusDeploy/deploy-release-action@v3 | ||
id: deploy | ||
with: | ||
project: ${{ vars.OCTOPUS_DEPLOY_PROJECT }} | ||
environments: Production | ||
release_number: ${{ steps.release.outputs.release_number }} | ||
|
||
- uses: OctopusDeploy/await-task-action@v3 | ||
with: | ||
server_task_id: ${{ fromJson(steps.deploy.outputs.server_tasks)[0].serverTaskId }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
test: | ||
runs-on: | ||
- self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- name: Template | ||
run: | | ||
helm template ./charts/home-assistant-integrations \ | ||
--set mqttUri tcp://localhost:1883 \ | ||
--debug | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: ./go.mod | ||
cache: false | ||
|
||
- name: Check | ||
run: | | ||
go vet ./... | ||
go test -v ./... | ||
- uses: golangci/golangci-lint-action@v4 | ||
with: | ||
skip-cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- v2 | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/_test.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: | ||
push: | ||
branches: | ||
- v2 | ||
paths-ignore: | ||
- "**/*.md" | ||
- "**/*.sh" | ||
- LICENSE | ||
|
||
jobs: | ||
publish_image: | ||
uses: ./.github/workflows/_publish_image.yaml | ||
with: | ||
publish: true | ||
|
||
publish_chart: | ||
uses: ./.github/workflows/_publish_chart.yaml | ||
with: | ||
publish: true | ||
|
||
release: | ||
name: >- | ||
Release | ||
${{ needs.publish_image.outputs.image_tag }} | ||
(${{ needs.publish_chart.outputs.chart_version }}) | ||
needs: [publish_image, publish_chart] | ||
uses: ./.github/workflows/_release.yaml | ||
with: | ||
chart_version: ${{ github.sha }} | ||
image_tag: ${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
FROM golang:1.21.5-alpine AS builder | ||
FROM golang:1.22-alpine AS builder | ||
RUN apk add --no-cache make | ||
WORKDIR /go/src/app | ||
COPY . . | ||
RUN go mod download | ||
ENV CGO_ENABLED=0 | ||
RUN go build -o /go/bin/app . | ||
ARG BUILD_VERSION | ||
ARG BUILD_TIME | ||
ARG BUILD_COMMIT | ||
RUN make build-binary \ | ||
BINARY_NAME=/go/bin/app \ | ||
BUILD_VERSION=${BUILD_VERSION} \ | ||
BUILD_TIME=${BUILD_TIME} \ | ||
BUILD_COMMIT=${BUILD_COMMIT} | ||
|
||
FROM gcr.io/distroless/base-debian11 | ||
COPY --from=builder /go/bin/app / | ||
CMD ["/app"] | ||
FROM gcr.io/distroless/base-debian12 | ||
COPY --from=builder /go/bin/app /bin/app | ||
CMD ["/bin/app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v2 | ||
name: home-assistant-integrations | ||
version: 0.0.1 | ||
appVersion: 0.0.1 | ||
type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# home-assistant-integrations | ||
|
||
   | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| image.repository | string | `"public.ecr.aws/axatol/home-assistant-integrations"` | | | ||
| image.tag | string | `""` | image tag, defaults to the chart's appVersion | | ||
| logFormat | string | `"json"` | log format for the application, (e.g. json, text) | | ||
| logLevel | string | `"info"` | log level for the application, (e.g. trace, error) | | ||
| mqttUri | string | `""` | uri of the mqtt broker to publish data to | | ||
| providers.huaweiHg659.address | string | `""` | router address | | ||
| providers.huaweiHg659.enabled | bool | `false` | enable the provider | | ||
| providers.huaweiHg659.entityName | string | `"huawei_hg659"` | id of entity in home assistant | | ||
| providers.huaweiHg659.pollRate | string | `"60s"` | poll rate for the provider | | ||
| providers.zeverSolarTlc5000.address | string | `""` | zever solar inverter address | | ||
| providers.zeverSolarTlc5000.enabled | bool | `false` | enable the provider | | ||
| providers.zeverSolarTlc5000.entityName | string | `""` | id of entity in home assistant | | ||
| providers.zeverSolarTlc5000.pollRate | string | `"30s"` | poll rate for the provider | | ||
|
||
---------------------------------------------- | ||
Autogenerated from chart metadata using [helm-docs v1.13.1](/~https://github.com/norwoodj/helm-docs/releases/v1.13.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "home-assistant-integrations.labels" -}} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{ include "home-assistant-integrations.selectors" . }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common selectors | ||
*/}} | ||
{{- define "home-assistant-integrations.selectors" -}} | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
28 changes: 28 additions & 0 deletions
28
charts/home-assistant-integrations/templates/configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }} | ||
labels: {{- include "home-assistant-integrations.labels" . | nindent 4 }} | ||
data: | ||
LOG_LEVEL: {{ .Values.logLevel }} | ||
LOG_FORMAT: {{ .Values.logFormat }} | ||
MQTT_URI: {{ .Values.mqttUri | required ".Values.mqttUri is required" }} | ||
|
||
{{- with .Values.providers.huaweiHg659 }} | ||
{{- if .enabled }} | ||
HUAWEI_HG659_ENABLED: true | ||
HUAWEI_HG659_ADDRESS: {{ .address | required ".Values.huaweiHg659.address is required"}} | ||
HUAWEI_HG659_ENTITY_NAME: {{ .entityName }} | ||
HUAWEI_HG659_POLL_RATE: {{ .pollRate }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- with .Values.providers.zeverSolarTlc5000 }} | ||
{{- if .enabled }} | ||
ZEVER_SOLAR_TLC5000_ENABLED: true | ||
ZEVER_SOLAR_TLC5000_ADDRESS: {{ .address | required ".Values.zeverSolarTlc5000.address is required" }} | ||
ZEVER_SOLAR_TLC5000_ENTITY_NAME: {{ .entityName }} | ||
ZEVER_SOLAR_TLC5000_POLL_RATE: {{ .pollRate }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.