-
Notifications
You must be signed in to change notification settings - Fork 1
Updater for HA addon version #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d206dfd
Updater for HA addon version
LukBelter 2a361f9
Update PAT name
LukBelter fa7dd00
extend function to update multiple addon tracks
LukBelter a723083
wipe using bco user within docker
DivineThreepwood 450ebb9
cleanup bco submodules
DivineThreepwood 15d8c84
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
DivineThreepwood f18ef5f
remove if for testing
LukBelter c0137f5
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
LukBelter 21d38fe
fix indentation
LukBelter 526a900
fix indentation
LukBelter 1c9cac8
fix input name
LukBelter cd53f06
fix startsWith
LukBelter 1bd4b84
fix mqtt host handling by making configuration explicit and not impli…
DivineThreepwood 0d416fe
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
DivineThreepwood 4c94e38
terminate property parsing.
DivineThreepwood 9a1bfb5
fix docker tag detection via regex
DivineThreepwood b383eb5
update jul
DivineThreepwood 4157fcc
wip
LukBelter beccbce
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
LukBelter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,105 @@ | ||
| name: Home Assistant Add-ons Update | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| description: 'The version to set for the add-ons' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| addon: | ||
| description: 'The add-on to update' | ||
| required: true | ||
| type: string | ||
| tags: | ||
| description: 'The tags associated with the version' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| track: | ||
| description: 'The track associated with the version' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| secrets: | ||
| CI_GITHUB_TOKEN: | ||
| description: 'CI GitHub token' | ||
| required: true | ||
|
|
||
| jobs: | ||
| update-addons: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout addon repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| repository: openbase/homeassistant.addons.bco | ||
| path: addons-repo | ||
|
|
||
| - name: Dig up tag | ||
| id: dig-up-tag | ||
| env: | ||
| TAGS: "${{ inputs.tags }}" | ||
| TRACK: "${{ inputs.track }}" | ||
| run: | | ||
| echo "Received TAGS: $TAGS" | ||
| echo "Searching for tag for track: $TRACK" | ||
|
|
||
| if [ -n "$TRACK" ]; then | ||
| MATCHED_TAG=$(printf "%s\n" "$TAGS" \ | ||
| | sed -n "s/.*:${TRACK}-\([^[:space:]]*\).*/${TRACK}-\\1/p" \ | ||
| | sort -u \ | ||
| | head -n1) | ||
| if [ -n "$MATCHED_TAG" ]; then | ||
| echo "Found matching tag: $MATCHED_TAG" | ||
| echo "SELECTED_TAG=$MATCHED_TAG" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
| echo "No tag found for track '$TRACK'. Exiting with error." | ||
| exit 1 | ||
| else | ||
| echo "No track specified, skipping tag selection." | ||
| echo 'SELECTED_TAG=""' >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Update add-on versions | ||
| env: | ||
| ADDON: "${{ inputs.addon }}" | ||
| TRACK: "${{ inputs.track }}" | ||
| GIT_USERNAME: "Minou [bot]" | ||
| GIT_EMAIL: "minou[bot]@users.noreply.github.com" | ||
| run: | | ||
|
|
||
| if [ -z $TRACK ]; then | ||
| echo "No track specified, using default folder." | ||
| if [ -z "${{ inputs.version }}" ]; then | ||
| echo "No version specified, exiting with error." | ||
| exit 1 | ||
| fi | ||
| VERSION="${{ inputs.version }}" | ||
| ADDON_DIR="${ADDON}" | ||
| else | ||
| echo "Track specified: ${TRACK}, using ${TRACK} folder." | ||
| VERSION="${{ steps.dig-up-tag.outputs.SELECTED_TAG }}" | ||
| ADDON_DIR="${ADDON}-${TRACK}" | ||
| fi | ||
|
|
||
| cd addons-repo/$ADDON_DIR | ||
|
|
||
| # Update version in config.yaml | ||
| sed -i "s/^version: .*/version: $VERSION/" config.yaml | ||
|
|
||
| # Commit and push changes | ||
| git config user.name "$GIT_USERNAME" | ||
| git config user.email "$GIT_EMAIL" | ||
| git add config.yaml | ||
| git commit -m "Update add-on $ADDONS_DIR version to $VERSION" || { | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| } | ||
|
|
||
| git push | ||
|
|
||
| echo "✅ Add-on $ADDON_DIR version updated to $VERSION and changes pushed." |
This file contains hidden or 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,29 +1,22 @@ | ||
| # Install dependencies | ||
| FROM eclipse-temurin:21-jdk AS builder | ||
|
|
||
| ENV \ | ||
| JAVA_OPTS="" \ | ||
| LC_ALL="en_US.UTF-8" \ | ||
| LANG="en_US.UTF-8" \ | ||
| LANGUAGE="en_US.UTF-8" | ||
| # syntax=docker/dockerfile:1.7 | ||
|
|
||
| ############################################ | ||
| # Stage 1 — Build with a lightweight JDK | ||
| ############################################ | ||
| ARG JAVA_VERSION=21 | ||
| FROM eclipse-temurin:${JAVA_VERSION}-jdk-alpine AS build | ||
| WORKDIR /workspace | ||
|
|
||
| # Setup build deps | ||
| ARG DEBIAN_FRONTEND=noninteractive | ||
| RUN apt update && \ | ||
| apt install -y \ | ||
| git \ | ||
| gradle \ | ||
| rsync \ | ||
| curl \ | ||
| ca-certificates \ | ||
| locales \ | ||
| locales-all \ | ||
| wget && \ | ||
| apt clean | ||
| # Optional: useful for Gradle plugins that invoke git, etc. | ||
| RUN apk add --no-cache git | ||
|
|
||
| # Install bash | ||
| RUN apk add --no-cache bash | ||
|
|
||
| # Copy repo into working directory | ||
| # Speed up builds with a persistent Gradle cache (BuildKit required) | ||
| ENV GRADLE_USER_HOME=/home/gradle/.gradle | ||
|
|
||
| # Now copy sources and build for real | ||
| COPY . . | ||
|
|
||
| # Setup Gradle Wrapper | ||
|
|
@@ -37,22 +30,22 @@ RUN cd lib/jul && \ | |
| # Build bco | ||
| RUN ./gradlew :bco.app.util:installDist -x test -x javadoc --no-daemon --stacktrace | ||
|
|
||
| # Switch to baseline image | ||
| FROM eclipse-temurin:21-jre | ||
|
|
||
| ############################################ | ||
| # Stage 2 — Minimal runtim | ||
| ############################################ | ||
| FROM eclipse-temurin:21-jre AS runtime | ||
|
|
||
| # # Install app | ||
| COPY --from=builder /workspace/module/app/util/build/install/bco/bin /usr/bin/ | ||
| COPY --from=builder /workspace/module/app/util/build/install/bco/lib /usr/lib/ | ||
| # COPY --from=builder /workspace/build/share /usr/share/ | ||
| COPY --from=build /workspace/module/app/util/build/install/bco/bin /usr/bin/ | ||
| COPY --from=build /workspace/module/app/util/build/install/bco/lib /usr/lib/ | ||
|
|
||
| # Install runtime deps | ||
| ## gosu: required to switch to another user ofter entrypoint is started as root. | ||
| ## tini: required to forward app signals such as sigint. | ||
| RUN apt update && \ | ||
| apt install -y software-properties-common && \ | ||
| apt update && \ | ||
| apt install -y \ | ||
| gosu \ | ||
| gnupg \ | ||
| tini \ | ||
| fontconfig \ | ||
|
|
@@ -66,7 +59,7 @@ RUN apt update && \ | |
|
|
||
| # Set variables and locales | ||
| ENV \ | ||
| JAVA_OPTS="" \ | ||
| JAVA_TOOL_OPTIONS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=75" \ | ||
| LC_ALL="en_US.UTF-8" \ | ||
| LANG="en_US.UTF-8" \ | ||
| LANGUAGE="en_US.UTF-8" \ | ||
|
|
@@ -76,20 +69,19 @@ ENV \ | |
| BCO_LOGS="/home/bco/data/log" \ | ||
| BCO_BINARY="/usr/bin/bco" \ | ||
| MQTT_BROKER="mqtt-broker" \ | ||
| BCO_OPTIONS="--host ${MQTT_BROKER}" | ||
| BCO_OPTIONS="--" | ||
|
|
||
| # Basic build-time metadata as defined at http://label-schema.org | ||
| LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
| org.label-schema.docker.dockerfile="docker/Dockerfile" \ | ||
| LABEL org.label-schema.docker.dockerfile="docker/Dockerfile" \ | ||
| org.label-schema.license="GPL3" \ | ||
| org.label-schema.name="bco" \ | ||
| org.label-schema.vendor="openbase.org" \ | ||
| org.label-schema.version=$VERSION \ | ||
| org.label-schema.description="A behaviour based smart environment plattform" \ | ||
| org.label-schema.url="https://www.basecubeone.org" \ | ||
| org.label-schema.vcs-ref=$VCS_REF \ | ||
| org.label-schema.vcs-type="Git" \ | ||
| org.label-schema.vcs-url="https://github.com/openbase/bco.git" \ | ||
| io.hass.type="addon" \ | ||
| io.hass.arch="aarch64|amd64" \ | ||
| maintainer="Divine Threepwood <[email protected]>" | ||
|
|
||
| # Expose volume | ||
|
|
@@ -105,18 +97,10 @@ RUN ln -s /usr/local/bin/docker-entrypoint.sh && \ | |
| chmod +x /usr/local/bin/docker-entrypoint.sh | ||
| ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | ||
|
|
||
| # TODO: probably deprecated by setting the variables BCO_LOGS above | ||
| # Configure logger | ||
| # COPY logback-debug.xml /etc/bco/ | ||
| # COPY logback.xml /etc/bco/ | ||
|
|
||
| # Configure healthcheck | ||
| # todo: make sure only the registry availability is checks since devices are not maintained by this instance. | ||
| HEALTHCHECK --interval=15m --timeout=2m CMD bco-validate --host ${MQTT_BROKER} > /dev/null || exit 1 | ||
|
|
||
| # switch to root, let the entrypoint drop back to bco user | ||
| USER root | ||
|
|
||
| # Set command | ||
| ## Need to be in array form to not encapsulate command in another shell session because | ||
| ## the shell is not forwarding SIGINT and SIGTERM to bco than. | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -22,20 +22,16 @@ FROM openbaseorg/bco:${BCO_BASE_IMAGE_VERSION} | |
| # Set variables and locales | ||
| ENV \ | ||
| JAVA_OPTS="" \ | ||
| OPENHAB_CONF="/etc/openhab2" \ | ||
| BCO_OPTIONS="--db /tmp/bco/db --host ${MQTT_BROKER}" \ | ||
| BCO_OPTIONS="--db /tmp/bco/db" \ | ||
| BCO_MODULE_PREPARE_SCRIPT="bco-module-prepare.sh" | ||
|
|
||
| # Basic build-time metadata as defined at http://label-schema.org | ||
| LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
| org.label-schema.docker.dockerfile="/docker/bco-demo/Dockerfile" \ | ||
| LABEL org.label-schema.docker.dockerfile="/docker/bco-demo/Dockerfile" \ | ||
| org.label-schema.license="GPL3" \ | ||
| org.label-schema.name="bco-test" \ | ||
| org.label-schema.vendor="openbase.org" \ | ||
| org.label-schema.version=$VERSION \ | ||
| org.label-schema.description="The BCO Demo downloads the demo db and starts bco in test mode." \ | ||
| org.label-schema.url="https://www.basecubeone.org" \ | ||
| org.label-schema.vcs-ref=$VCS_REF \ | ||
| org.label-schema.vcs-type="Git" \ | ||
| org.label-schema.vcs-url="https://github.com/openbase/bco.git" \ | ||
| maintainer="Divine Threepwood <[email protected]>" | ||
|
|
@@ -50,11 +46,7 @@ RUN mkdir -p /usr/share/bco/ | |
| COPY --from=builder /workspace/db /usr/share/bco/db/ | ||
|
|
||
| # Configure healthcheck | ||
| # todo: make sure only device offered by this device manager are checked | ||
| HEALTHCHECK --interval=15m --timeout=2m CMD bco-validate --host ${MQTT_BROKER} >/dev/null || exit 1 | ||
|
|
||
| # switch to root, let the entrypoint drop back to bco user | ||
| USER root | ||
|
|
||
| # Set command | ||
| CMD ["bco-test"] | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,15 +9,12 @@ ENV \ | |
| BCO_MODULE_PREPARE_SCRIPT="bco-module-prepare.sh" | ||
|
|
||
| # Basic build-time metadata as defined at http://label-schema.org | ||
| LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
| org.label-schema.docker.dockerfile="/docker/device-manager/openhab/Dockerfile" \ | ||
| LABEL org.label-schema.docker.dockerfile="/docker/device-manager/openhab/Dockerfile" \ | ||
| org.label-schema.license="GPL3" \ | ||
| org.label-schema.name="bco-device-manager-openhab" \ | ||
| org.label-schema.vendor="openbase.org" \ | ||
| org.label-schema.version=$VERSION \ | ||
| org.label-schema.description="The BCO Device Manager connects all openhab devices to the bco infrastructure." \ | ||
| org.label-schema.url="https://www.basecubeone.org" \ | ||
| org.label-schema.vcs-ref=$VCS_REF \ | ||
| org.label-schema.vcs-type="Git" \ | ||
| org.label-schema.vcs-url="https://github.com/openbase/bco.git" \ | ||
| maintainer="Divine Threepwood <[email protected]>" | ||
|
|
@@ -34,8 +31,5 @@ RUN ln -s /usr/local/bin/${BCO_MODULE_PREPARE_SCRIPT} && \ | |
| # todo: make sure only device offered by this device manager are checked | ||
| HEALTHCHECK --interval=15m --timeout=2m CMD bco-validate --host ${MQTT_BROKER} >/dev/null || exit 1 | ||
|
|
||
| # switch to root, let the entrypoint drop back to bco user | ||
| USER root | ||
|
|
||
| # Set command | ||
| CMD ["bco-manager-device-openhab"] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.