From 44f6c56e6826313d43312c8448f9ef3d9a3d6a48 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 15 Aug 2023 16:44:23 -0400 Subject: [PATCH] build: fix project, fix release type (#96) * fix: actually set project for python builds We were doing it for environment variables but not when we calculated the versions. * fix: release builds for release tags --- .github/actions/build-refs/action/__tests__/index.test.ts | 7 ++++++- .github/actions/build-refs/action/index.ts | 2 +- .github/actions/build-refs/dist/index.js | 2 +- .../meta-opentrons/classes/get_ot_package_version.bbclass | 2 +- .../opentrons-robot-server/opentrons-robot-server.bb | 4 ++-- .../opentrons-system-server/opentrons-system-server.bb | 2 +- .../opentrons-update-server/opentrons-update-server.bb | 2 +- .../opentrons-usb-bridge/opentrons-usb-bridge.bb | 2 +- 8 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/actions/build-refs/action/__tests__/index.test.ts b/.github/actions/build-refs/action/__tests__/index.test.ts index 483b1185..c5a290e7 100644 --- a/.github/actions/build-refs/action/__tests__/index.test.ts +++ b/.github/actions/build-refs/action/__tests__/index.test.ts @@ -138,10 +138,15 @@ const BUILD_TYPE_TEST_SPECS: Array<[string, [Ref], BuildType]> = [ 'develop', ], [ - 'when monorepo ref is a release tag is release', + 'when monorepo ref is an internal-release tag is release', ['refs/tags/ot3@0.0.0-dev'], 'release', ], + [ + 'when monorepo ref is a release tag is release', + ['refs/tags/v12.12.9-alpha.12'], + 'release', + ], ] BUILD_TYPE_TEST_SPECS.forEach( diff --git a/.github/actions/build-refs/action/index.ts b/.github/actions/build-refs/action/index.ts index a215fed9..40a951be 100644 --- a/.github/actions/build-refs/action/index.ts +++ b/.github/actions/build-refs/action/index.ts @@ -205,7 +205,7 @@ async function resolveRefs(toAttempt: AttemptableRefs): Promise { } export function resolveBuildType(ref: Ref): BuildType { - return ref.includes('refs/tags/ot3') ? 'release' : 'develop' + return ref.includes('refs/tags') ? 'release' : 'develop' } async function run() { diff --git a/.github/actions/build-refs/dist/index.js b/.github/actions/build-refs/dist/index.js index 2a709f06..d93b7d7e 100644 --- a/.github/actions/build-refs/dist/index.js +++ b/.github/actions/build-refs/dist/index.js @@ -9885,7 +9885,7 @@ function resolveRefs(toAttempt) { }); } function resolveBuildType(ref) { - return ref.includes('refs/tags/ot3') ? 'release' : 'develop'; + return ref.includes('refs/tags') ? 'release' : 'develop'; } function run() { return __awaiter(this, void 0, void 0, function* () { diff --git a/layers/meta-opentrons/classes/get_ot_package_version.bbclass b/layers/meta-opentrons/classes/get_ot_package_version.bbclass index 118f6fe9..92e77381 100644 --- a/layers/meta-opentrons/classes/get_ot_package_version.bbclass +++ b/layers/meta-opentrons/classes/get_ot_package_version.bbclass @@ -10,7 +10,7 @@ def get_ot_package_version(d): 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') + return get_version(d.getVar('OT_PACKAGE', 'robot-server'), d.getVar('OPENTRONS_PROJECT', 'ot3')) finally: sys.path = sys.path[:-1] diff --git a/layers/meta-opentrons/recipes-robot/opentrons-robot-server/opentrons-robot-server.bb b/layers/meta-opentrons/recipes-robot/opentrons-robot-server/opentrons-robot-server.bb index a7ce9641..22279701 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-robot-server/opentrons-robot-server.bb +++ b/layers/meta-opentrons/recipes-robot/opentrons-robot-server/opentrons-robot-server.bb @@ -36,8 +36,8 @@ 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 ot3 dump_br_version > ${D}/opentrons_versions/opentrons-robot-server-version.json - python3 ${S}/scripts/python_build_utils.py api ot3 dump_br_version > ${D}/opentrons_versions/opentrons-api-version.json + python3 ${S}/scripts/python_build_utils.py robot-server ${OPENTRONS_PROJECT} dump_br_version > ${D}/opentrons_versions/opentrons-robot-server-version.json + python3 ${S}/scripts/python_build_utils.py api ${OPENTRONS_PROJECT} dump_br_version > ${D}/opentrons_versions/opentrons-api-version.json install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/opentrons-robot-server.service ${D}${systemd_system_unitdir}/opentrons-robot-server.service diff --git a/layers/meta-opentrons/recipes-robot/opentrons-system-server/opentrons-system-server.bb b/layers/meta-opentrons/recipes-robot/opentrons-system-server/opentrons-system-server.bb index 682f1ee7..21d6eebe 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-system-server/opentrons-system-server.bb +++ b/layers/meta-opentrons/recipes-robot/opentrons-system-server/opentrons-system-server.bb @@ -29,7 +29,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 system-server ot3 dump_br_version > ${D}/opentrons_versions/opentrons-system-server-version.json + python3 ${S}/scripts/python_build_utils.py system-server ${OPENTRONS_PROJECT} dump_br_version > ${D}/opentrons_versions/opentrons-system-server-version.json install -d ${D}/${systemd_system_unitdir} install -m 0644 ${WORKDIR}/opentrons-system-server.service ${D}/${systemd_system_unitdir}/opentrons-system-server.service diff --git a/layers/meta-opentrons/recipes-robot/opentrons-update-server/opentrons-update-server.bb b/layers/meta-opentrons/recipes-robot/opentrons-update-server/opentrons-update-server.bb index 05402c56..0f9b2fc7 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-update-server/opentrons-update-server.bb +++ b/layers/meta-opentrons/recipes-robot/opentrons-update-server/opentrons-update-server.bb @@ -31,7 +31,7 @@ PIPENV_APP_BUNDLE_EXTRA_PIP_ENVARGS = "OPENTRONS_PROJECT=${OPENTRONS_PROJECT}" 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 ot3 dump_br_version > ${D}/opentrons_versions/opentrons-update-server-version.json + python3 ${S}/scripts/python_build_utils.py update-server ${OPENTRONS_PROJECT} 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 diff --git a/layers/meta-opentrons/recipes-robot/opentrons-usb-bridge/opentrons-usb-bridge.bb b/layers/meta-opentrons/recipes-robot/opentrons-usb-bridge/opentrons-usb-bridge.bb index 658b3cb0..51d31131 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-usb-bridge/opentrons-usb-bridge.bb +++ b/layers/meta-opentrons/recipes-robot/opentrons-usb-bridge/opentrons-usb-bridge.bb @@ -28,7 +28,7 @@ PIPENV_APP_BUNDLE_EXTRA_PIP_ENVARGS = "OPENTRONS_PROJECT=${OPENTRONS_PROJECT}" do_install_append() { # create json file to be used in VERSION.json install -d ${D}/opentrons_versions - python3 ${S}/scripts/python_build_utils.py usb-bridge ot3 dump_br_version > ${D}/opentrons_versions/opentrons-usb-bridge-version.json + python3 ${S}/scripts/python_build_utils.py usb-bridge ${OPENTRONS_PROJECT} dump_br_version > ${D}/opentrons_versions/opentrons-usb-bridge-version.json install -d ${D}/${systemd_system_unitdir} install -m 0644 ${WORKDIR}/opentrons-usb-bridge.service ${D}/${systemd_system_unitdir}/opentrons-usb-bridge.service