Skip to content

Commit

Permalink
Remove .gitlab-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Dürscheid committed Jun 17, 2024
1 parent 53fb9b6 commit 3df502e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 101 deletions.
74 changes: 0 additions & 74 deletions .gitlab-ci.yml

This file was deleted.

7 changes: 1 addition & 6 deletions src/airgapped-devicetypes/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# usage:
# docker build -t openbalena-airgapped-devicetypes --build-arg=AWS_ACCESS_KEY_ID=$BALENA_IMAGES_S3_ACCESS_KEY_ID --build-arg=AWS_SECRET_ACCESS_KEY=$BALENA_IMAGES_S3_SECRET_ACCESS_KEY --DEVICE_TO_BUILD='[["raspberrypi3-64","~=5.2.8"], ["raspberrypi4-64","~=5.2.8"], ["jetson-tx2","~=5.2.8"], ["jetson-tx2-nx-devkit",">=2.50.0"], ["jetson-nano","~=5.2.8"]]'.
## docker build -t openbalena-airgapped-devicetypes --build-arg=AWS_ACCESS_KEY_ID=$BALENA_IMAGES_S3_ACCESS_KEY_ID --build-arg=AWS_SECRET_ACCESS_KEY=$BALENA_IMAGES_S3_SECRET_ACCESS_KEY --build-arg=DEVICES_TO_DOWNLOAD='[["raspberrypi3-64","~=5.2.8"], ["raspberrypi4-64","~=5.2.8"], ["jetson-tx2","~=5.2.8"], ["jetson-tx2-nx-devkit",">=2.50.0"], ["jetson-nano","~=5.2.8"]]' .

FROM python:3-alpine as downloader
RUN pip3 install --no-cache-dir --upgrade pipenv
ARG AWS_ACCESS_KEY_ID=""
ARG AWS_SECRET_ACCESS_KEY=""
ARG AWS_CONFIG_FILE=/root/.aws/config


WORKDIR /root/.aws
RUN printf "[default]]\naws_access_key_id = %s\naws_secret_access_key = %s" $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY > $AWS_CONFIG_FILE

WORKDIR /s3images
COPY Pipfile .
Expand Down
31 changes: 10 additions & 21 deletions src/airgapped-devicetypes/downloader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# based on https://forums.balena.io/t/supported-devices-in-open-balena/357665/21
# As of 04/June/2024 openbalena claims to requires at least v5.2.8: https://github.com/balena-io/open-balena?tab=readme-ov-file#compatibility.
# However, this might not be 100% true, e.g. the jetson-tx2-nx-devkit have been tested to work with 2.113.

import asyncio
import boto3
import os
Expand All @@ -6,30 +10,13 @@
from packaging.version import Version
from packaging.specifiers import SpecifierSet

# AWS credentials are taken from ~/.aws/credentials or config file

# AWS credentials are taken from $AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
# See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html for options
bucket_name = "resin-production-img-cloudformation"

# Initialize AWS S3 client
s3 = boto3.client("s3")
# See https://peps.python.org/pep-0440/#compatible-release for versionspec syntax. e.g.
# [
# ("raspberrypi3-64", "~=5.2.8"),
# ("raspberrypi4-64", "~=5.2.8"),
# ("jetson-tx2", "~=5.2.8"),
# ("jetson-nano", "~=5.2.8"),
# ]
# As if 04/June/2024 openbalena claims to requires at least v5.2.8: https://github.com/balena-io/open-balena?tab=readme-ov-file#compatibility.
# However, the jetson-tx2-nx-devkit have been tested to work with 2.113.
# To download all devices, use ("", "~=3.0") and set your version spec as needed
devices_types_with_versionspec = [
("raspberrypi3-64", "~=5.2.8"),
("raspberrypi4-64", "~=5.2.8"),
("jetson-tx2", "~=5.2.8"),
("jetson-tx2-nx-devkit", ">=2.50.0"),
("jetson-nano", "~=5.2.8"),
# ("", "~=5.2.8")
]


async def download_object(obj_key, download_path):
dirpath = os.path.dirname(download_path)
Expand Down Expand Up @@ -83,7 +70,9 @@ async def main(json_input):

if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py '<json_input>'")
print(
'Usage: \nexport AWS_ACCESS_KEY_ID=<your_key_id> && export AWS_SECRET_ACCESS_KEY=<your_access_key>\npython script.py \'[["raspberrypi3-64","~=5.2.8"], ["raspberrypi4-64","~=5.2.8"]]\'\nSee https://peps.python.org/pep-0440/#compatible-release for versionspec syntax '
)
sys.exit(1)
json_input = sys.argv[1]
asyncio.run(main(json_input))

0 comments on commit 3df502e

Please sign in to comment.