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

Add env var for platform of underlying device #101

Merged
merged 2 commits into from
Dec 11, 2023
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
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ Buildrunner injects special environment variables and volume mounts into every
run container. The following environment variables are set and available in
every run container:

:``BUILDRUNNER_PLATFORM``: the platform of the current device (x86_64, aarch64, etc), equivalent to ``platform.machine()``
:``BUILDRUNNER_BUILD_NUMBER``: the build number
:``BUILDRUNNER_BUILD_ID``: a unique id identifying the build (includes vcs and build number
information), e.g. "main-1791.Ia09cc5.M0-1661374484"
Expand Down
2 changes: 2 additions & 0 deletions buildrunner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import json
import logging
import os
import platform as python_platform
import shutil
import sys
import tarfile
Expand Down Expand Up @@ -89,6 +90,7 @@ def _get_config_context(self, ctx=None, global_env=None):
"""

context = {
'BUILDRUNNER_PLATFORM': str(python_platform.machine()),
'BUILDRUNNER_BUILD_NUMBER': str(self.build_number),
'BUILDRUNNER_BUILD_ID': str(self.build_id),
'BUILDRUNNER_BUILD_DOCKER_TAG': str(sanitize_tag(self.build_id)),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from setuptools import setup, find_packages


BASE_VERSION = '3.0'
BASE_VERSION = '3.1'

SOURCE_DIR = os.path.dirname(
os.path.abspath(__file__)
Expand Down
8 changes: 7 additions & 1 deletion tests/test-files/test-general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,10 @@ steps:
test-uncompressed-dirs:
run:
image: {{ DOCKER_REGISTRY }}/centos:8
cmd: 'if [ $(ls -laR /artifacts/setup-uncompress-dirs/ | grep tar.gz | wc -l) != 0 ]; then exit 1; fi'
cmd: 'if [ $(ls -laR /artifacts/setup-uncompress-dirs/ | grep tar.gz | wc -l) != 0 ]; then exit 1; fi'

test-platform:
run:
image: {{ DOCKER_REGISTRY }}/centos:8
cmd: 'if [ -z "{{ BUILDRUNNER_PLATFORM }}" ]; then exit 1; else echo "Platform is {{ BUILDRUNNER_PLATFORM }}"; fi'

Loading