Skip to content
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

opentrons-robot-server: version from git #37

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-ot3-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
if: ${{ matrix.build_env == 'stage-prod' }}
uses: slackapi/[email protected]
with:
payload: "{\"s3-url\":\"${{ steps.upload-results.outputs.console_url }}/\",\"type\":\"branch\", \"reflike\":\"${{ github.ref }}\", \"full-image\":\"${{ steps.upload-results.outputs.fullimage_url }}\", \"system-update\":\"${{ steps.upload-results.outputs.system_url }}\", \"version-file\":\"${{ steps.upload-results.outputs.version_file_url }}\"}"
payload: "{\"s3-url\":\"${{ steps.upload-results.outputs.console_url }}/\",\"type\":\"branch\", \"reflike\":\"${{ steps.build-refs.outputs.oe-core }}\", \"full-image\":\"${{ steps.upload-results.outputs.fullimage_url }}\", \"system-update\":\"${{ steps.upload-results.outputs.system_url }}\", \"version-file\":\"${{ steps.upload-results.outputs.version_file_url }}\"}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Remove build data
Expand Down
12 changes: 10 additions & 2 deletions layers/meta-opentrons/classes/get_ot_package_version.bbclass
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
PACKAGEJSON_FILE ?= "${S}/package.json"
OT_PACKAGE ?= ''
DEST_SYSTEMD_DROPFILE ?= "${B}/version.conf"
MONOREPO_ROOT_PATH = "${S}"

def get_ot_package_version(d):
import json
import os
s = d.getVar('MONOREPO_ROOT_PATH')
f = d.getVar('PACKAGEJSON_FILE')
return json.load(open(f))['version']
try:
sys.path.append(os.path.join(s, 'scripts'))
from python_build_utils import get_version
return get_version(d.getVar('OT_PACKAGE', 'robot-server'), 'ot3')
finally:
sys.path = sys.path[:-1]

# Add this as a task if you want to use it:
# addtask do_write_systemd_dropfile after do_compile before do_install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

# Modify these as desired
PACKAGEJSON_FILE = "${S}/robot-server/robot_server/package.json"
DEST_SYSTEMD_DROPFILE ?= "${B}/robot-server-version.conf"
OT_PACKAGE = "robot-server"
inherit insane systemd get_ot_package_version

SYSTEMD_AUTO_ENABLE = "enable"
Expand All @@ -31,7 +31,7 @@ addtask do_write_systemd_dropfile after do_compile before do_install
do_install_append () {
# create json file to be used in VERSION.json
install -d ${D}/opentrons_versions
python3 ${S}/scripts/python_build_utils.py robot-server dump_br_version > ${D}/opentrons_versions/opentrons-robot-server-version.json
python3 ${S}/scripts/python_build_utils.py robot-server ot3 dump_br_version > ${D}/opentrons_versions/opentrons-robot-server-version.json

install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/opentrons-robot-server.service ${D}${systemd_system_unitdir}/opentrons-robot-server.service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PIPENV_APP_BUNDLE_USE_GLOBAL = "python3-aiohttp systemd-python"
do_install_append() {
# create json file to be used in VERSION.json
install -d ${D}/opentrons_versions
python3 ${S}/scripts/python_build_utils.py update-server dump_br_version > ${D}/opentrons_versions/opentrons-update-server-version.json
python3 ${S}/scripts/python_build_utils.py update-server ot3 dump_br_version > ${D}/opentrons_versions/opentrons-update-server-version.json

install -d ${D}/${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/opentrons-update-server.service ${D}/${systemd_unitdir}/system
Expand Down