Skip to content

Commit 2b66d10

Browse files
committed
Initial Push
1 parent e432544 commit 2b66d10

26 files changed

+2644
-1
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.gitignore
3+
.github
4+
.gitattributes
5+
READMETEMPLATE.md
6+
README.md

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

.github/CONTRIBUTING.md

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Contributing to homeassistant
2+
3+
## Gotchas
4+
5+
* While contributing make sure to make all your changes before creating a Pull Request, as our pipeline builds each commit after the PR is open.
6+
* Read, and fill the Pull Request template
7+
* If this is a fix for a typo in code or documentation in the README please file an issue
8+
* If the PR is addressing an existing issue include, closes #\<issue number>, in the body of the PR commit message
9+
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn)
10+
11+
## Common files
12+
13+
| File | Use case |
14+
| :----: | --- |
15+
| `Dockerfile` | Dockerfile used to build amd64 images |
16+
| `Dockerfile.aarch64` | Dockerfile used to build 64bit ARM architectures |
17+
| `Dockerfile.armhf` | Dockerfile used to build 32bit ARM architectures |
18+
| `Jenkinsfile` | This file is a product of our builder and should not be edited directly. This is used to build the image |
19+
| `jenkins-vars.yml` | This file is used to generate the `Jenkinsfile` mentioned above, it only affects the build-process |
20+
| `package_versions.txt` | This file is generated as a part of the build-process and should not be edited directly. It lists all the installed packages and their versions |
21+
| `README.md` | This file is a product of our builder and should not be edited directly. This displays the readme for the repository and image registries |
22+
| `readme-vars.yml` | This file is used to generate the `README.md` |
23+
24+
## Readme
25+
26+
If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit.
27+
Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-homeassistant/edit/master/readme-vars.yml).
28+
29+
These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play.
30+
Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-homeassistant)
31+
32+
### Fixing typos or clarify the text in the readme
33+
34+
There are variables for multiple parts of the readme, the most common ones are:
35+
36+
| Variable | Description |
37+
| :----: | --- |
38+
| `project_blurb` | This is the short excerpt shown above the project logo. |
39+
| `app_setup_block` | This is the text that shows up under "Application Setup" if enabled |
40+
41+
### Parameters
42+
43+
The compose and run examples are also generated from these variables.
44+
45+
We have a [reference file](https://github.com/linuxserver/docker-jenkins-builder/blob/master/vars/_container-vars-blank) in our Jenkins Builder.
46+
47+
These are prefixed with `param_` for required parameters, or `opt_param` for optional parameters, except for `cap_add`.
48+
Remember to enable param, if currently disabled. This differs between parameters, and can be seen in the reference file.
49+
50+
Devices, environment variables, ports and volumes expects its variables in a certain way.
51+
52+
### Devices
53+
54+
```yml
55+
param_devices:
56+
- { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" }
57+
opt_param_devices:
58+
- { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" }
59+
```
60+
61+
### Environment variables
62+
63+
```yml
64+
param_env_vars:
65+
- { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." }
66+
opt_param_env_vars:
67+
- { env_var: "VERSION", env_value: "latest", desc: "Supported values are LATEST, PLEXPASS or a specific version number." }
68+
```
69+
70+
### Ports
71+
72+
```yml
73+
param_ports:
74+
- { external_port: "80", internal_port: "80", port_desc: "Application WebUI" }
75+
opt_param_ports:
76+
- { external_port: "80", internal_port: "80", port_desc: "Application WebUI" }
77+
```
78+
79+
### Volumes
80+
81+
```yml
82+
param_volumes:
83+
- { vol_path: "/config", vol_host_path: "</path/to/appdata/config>", desc: "Configuration files." }
84+
opt_param_volumes:
85+
- { vol_path: "/config", vol_host_path: "</path/to/appdata/config>", desc: "Configuration files." }
86+
```
87+
88+
### Testing template changes
89+
90+
After you make any changes to the templates, you can use our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) to have the files updated from the modified templates. Please use the command found under `Running Locally` [on this page](https://github.com/linuxserver/docker-jenkins-builder/blob/master/README.md) to generate them prior to submitting a PR.
91+
92+
## Dockerfiles
93+
94+
We use multiple Dockerfiles in our repos, this is because sometimes some CPU architectures needs different packages to work.
95+
If you are proposing additional packages to be added, ensure that you added the packages to all the Dockerfiles in alphabetical order.
96+
97+
### Testing your changes
98+
99+
```
100+
git clone https://github.com/linuxserver/docker-homeassistant.git
101+
cd docker-homeassistant
102+
docker build \
103+
--no-cache \
104+
--pull \
105+
-t linuxserver/homeassistant:latest .
106+
```
107+
108+
The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static`
109+
```
110+
docker run --rm --privileged multiarch/qemu-user-static:register --reset
111+
```
112+
113+
Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`.
114+
115+
## Update the chagelog
116+
117+
If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-homeassistant/tree/master/root), add an entry to the changelog
118+
119+
```yml
120+
changelogs:
121+
- { date: "DD.MM.YY:", desc: "Added some love to templates" }
122+
```

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: linuxserver
2+
open_collective: linuxserver

.github/ISSUE_TEMPLATE/config.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discord chat support
4+
url: https://discord.gg/YWrKVTn
5+
about: Realtime support / chat with the community and the team.
6+
7+
- name: Discourse discussion forum
8+
url: https://discourse.linuxserver.io
9+
about: Post on our community forum.
10+
11+
- name: Documentation
12+
url: https://docs.linuxserver.io/images/docker-homeassistant
13+
about: Documentation - information about all of our containers.

.github/ISSUE_TEMPLATE/issue.bug.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
[linuxserverurl]: https://linuxserver.io
7+
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]
8+
9+
<!--- If you are new to Docker or this application our issue tracker is **ONLY** used for reporting bugs or requesting features. Please use [our discord server](https://discord.gg/YWrKVTn) for general support. --->
10+
11+
<!--- Provide a general summary of the bug in the Title above -->
12+
13+
------------------------------
14+
15+
## Expected Behavior
16+
<!--- Tell us what should happen -->
17+
18+
## Current Behavior
19+
<!--- Tell us what happens instead of the expected behavior -->
20+
21+
## Steps to Reproduce
22+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
23+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
24+
1.
25+
2.
26+
3.
27+
4.
28+
29+
## Environment
30+
**OS:**
31+
**CPU architecture:** x86_64/arm32/arm64
32+
**How docker service was installed:**
33+
<!--- ie. from the official docker repo, from the distro repo, nas OS provided, etc. -->
34+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
35+
36+
## Command used to create docker container (run/create/compose/screenshot)
37+
<!--- Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container -->
38+
39+
## Docker logs
40+
<!--- Provide a full docker log, output of "docker logs homeassistant" -->
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
[linuxserverurl]: https://linuxserver.io
7+
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]
8+
9+
<!--- If you are new to Docker or this application our issue tracker is **ONLY** used for reporting bugs or requesting features. Please use [our discord server](https://discord.gg/YWrKVTn) for general support. --->
10+
11+
<!--- If this acts as a feature request please ask yourself if this modification is something the whole userbase will benefit from --->
12+
<!--- If this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ -->
13+
14+
<!--- Provide a general summary of the request in the Title above -->
15+
16+
------------------------------
17+
18+
## Desired Behavior
19+
<!--- Tell us what should happen -->
20+
21+
## Current Behavior
22+
<!--- Tell us what happens instead of the expected behavior -->
23+
24+
## Alternatives Considered
25+
<!--- Tell us what other options you have tried or considered -->

.github/PULL_REQUEST_TEMPLATE.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
[linuxserverurl]: https://linuxserver.io
4+
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]
5+
6+
7+
<!--- Before submitting a pull request please check the following -->
8+
9+
<!--- If this is a fix for a typo in code or documentation in the README please file an issue and let us sort it out we do not need a PR -->
10+
<!--- Ask yourself if this modification is something the whole userbase will benefit from, if this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ -->
11+
<!--- That if the PR is addressing an existing issue include, closes #<issue number> , in the body of the PR commit message -->
12+
<!--- You have included links to any files / patches etc your PR may be using in the body of the PR commit message -->
13+
<!--- We maintain a changelog of major revisions to the container at the end of readme-vars.yml in the root of this repository, please add your changes there if appropriate -->
14+
15+
16+
<!--- Coding guidelines: -->
17+
<!--- 1. Installed packages in the Dockerfiles should be in alphabetical order -->
18+
<!--- 2. Changes to Dockerfile should be replicated in Dockerfile.armhf and Dockerfile.aarch64 if applicable -->
19+
<!--- 3. Indentation style (tabs vs 4 spaces vs 1 space) should match the rest of the document -->
20+
<!--- 4. Readme is auto generated from readme-vars.yml, make your changes there -->
21+
22+
------------------------------
23+
24+
- [ ] I have read the [contributing](https://github.com/linuxserver/docker-homeassistant/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications
25+
26+
------------------------------
27+
28+
<!--- We welcome all PR’s though this doesn’t guarantee it will be accepted. -->
29+
30+
## Description:
31+
<!--- Describe your changes in detail -->
32+
33+
## Benefits of this PR and context:
34+
<!--- Please explain why we should accept this PR. If this fixes an outstanding bug, please reference the issue # -->
35+
36+
## How Has This Been Tested?
37+
<!--- Please describe in detail how you tested your changes. -->
38+
<!--- Include details of your testing environment, and the tests you ran to -->
39+
<!--- see how your change affects other areas of the code, etc. -->
40+
41+
42+
## Source / References:
43+
<!--- Please include any forum posts/github links relevant to the PR -->
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: External Trigger Main
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
external-trigger-master:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/[email protected]
11+
12+
- name: External Trigger
13+
if: github.ref == 'refs/heads/master'
14+
run: |
15+
if [ -n "${{ secrets.PAUSE_EXTERNAL_TRIGGER_HOMEASSISTANT_MASTER }}" ]; then
16+
echo "**** Github secret PAUSE_EXTERNAL_TRIGGER_HOMEASSISTANT_MASTER is set; skipping trigger. ****"
17+
exit 0
18+
fi
19+
echo "**** External trigger running off of master branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_HOMEASSISTANT_MASTER\". ****"
20+
echo "**** Retrieving external version ****"
21+
EXT_RELEASE=$(curl -sL "https://pypi.python.org/pypi/homeassistant/json" |jq -r '. | .info.version')
22+
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
23+
echo "**** Can't retrieve external version, exiting ****"
24+
FAILURE_REASON="Can't retrieve external version for homeassistant branch master"
25+
GHA_TRIGGER_URL="https://github.com/linuxserver/docker-homeassistant/actions/runs/${{ github.run_id }}"
26+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
27+
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n**Trigger URL:** '"${GHA_TRIGGER_URL}"' \n"}],
28+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
29+
exit 1
30+
fi
31+
EXT_RELEASE=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
32+
echo "**** External version: ${EXT_RELEASE} ****"
33+
echo "**** Retrieving last pushed version ****"
34+
image="linuxserver/homeassistant"
35+
tag="latest"
36+
token=$(curl -sX GET \
37+
"https://ghcr.io/token?scope=repository%3Alinuxserver%2Fhomeassistant%3Apull" \
38+
| jq -r '.token')
39+
multidigest=$(curl -s \
40+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
41+
--header "Authorization: Bearer ${token}" \
42+
"https://ghcr.io/v2/${image}/manifests/${tag}" \
43+
| jq -r 'first(.manifests[].digest)')
44+
digest=$(curl -s \
45+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
46+
--header "Authorization: Bearer ${token}" \
47+
"https://ghcr.io/v2/${image}/manifests/${multidigest}" \
48+
| jq -r '.config.digest')
49+
image_info=$(curl -sL \
50+
--header "Authorization: Bearer ${token}" \
51+
"https://ghcr.io/v2/${image}/blobs/${digest}" \
52+
| jq -r '.container_config')
53+
IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}')
54+
IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}')
55+
if [ -z "${IMAGE_VERSION}" ]; then
56+
echo "**** Can't retrieve last pushed version, exiting ****"
57+
FAILURE_REASON="Can't retrieve last pushed version for homeassistant tag latest"
58+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
59+
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
60+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
61+
exit 1
62+
fi
63+
echo "**** Last pushed version: ${IMAGE_VERSION} ****"
64+
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
65+
echo "**** Version ${EXT_RELEASE} already pushed, exiting ****"
66+
exit 0
67+
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-homeassistant/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
68+
echo "**** New version ${EXT_RELEASE} found; but there already seems to be an active build on Jenkins; exiting ****"
69+
exit 0
70+
else
71+
echo "**** New version ${EXT_RELEASE} found; old version was ${IMAGE_VERSION}. Triggering new build ****"
72+
response=$(curl -iX POST \
73+
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-homeassistant/job/master/buildWithParameters?PACKAGE_CHECK=false \
74+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
75+
echo "**** Jenkins job queue url: ${response%$'\r'} ****"
76+
echo "**** Sleeping 10 seconds until job starts ****"
77+
sleep 10
78+
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
79+
buildurl="${buildurl%$'\r'}"
80+
echo "**** Jenkins job build url: ${buildurl} ****"
81+
echo "**** Attempting to change the Jenkins job description ****"
82+
curl -iX POST \
83+
"${buildurl}submitDescription" \
84+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
85+
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
86+
--data-urlencode "Submit=Submit"
87+
echo "**** Notifying Discord ****"
88+
TRIGGER_REASON="A version change was detected for homeassistant tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
89+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
90+
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
91+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
92+
fi

0 commit comments

Comments
 (0)