Skip to content

Commit 375276d

Browse files
authored
Merge pull request #55 from linuxserver/54-feat-use-release-tag-instead-of-latest-on-s3-to-split-up-branch-build-results
54 feat use release tag instead of latest on s3 to split up branch build results
2 parents 15c0000 + a3bcd72 commit 375276d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

ci/ci.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def __init__(self) -> None:
8686
self.ssl: str = os.environ.get("SSL", "false")
8787
self.region: str = os.environ.get("S3_REGION", "us-east-1")
8888
self.bucket: str = os.environ.get("S3_BUCKET", "ci-tests.linuxserver.io")
89+
self.release_tag: str = os.environ.get("RELEASE_TAG", "latest")
8990

9091
if os.environ.get("DELAY_START"):
9192
self.logger.warning("DELAY_START env is obsolete, and not in use anymore")
@@ -103,6 +104,7 @@ def __init__(self) -> None:
103104
IMAGE: '{os.environ.get("IMAGE")}'
104105
BASE: '{os.environ.get("BASE")}'
105106
META_TAG: '{os.environ.get("META_TAG")}'
107+
RELEASE_TAG: '{os.environ.get("RELEASE_TAG")}'
106108
TAGS: '{os.environ.get("TAGS")}'
107109
S6_VERBOSITY: '{os.environ.get("S6_VERBOSITY")}'
108110
CI_S6_VERBOSITY '{os.environ.get("CI_S6_VERBOSITY")}'
@@ -674,18 +676,22 @@ def create_html_ansi_file(self, blob:str, tag:str, name:str, full:bool = True) -
674676

675677
@testing
676678
def upload_file(self, file_path:str, object_name:str, content_type:dict) -> None:
677-
"""Upload a file to an S3 bucket
679+
"""Upload a file to an S3 bucket.
680+
681+
The file is uploaded to two directories in the bucket, one for the meta tag and one for the release tag.
682+
683+
e.g. `https://ci-tests.linuxserver.io/linuxserver/plex/1.40.5.8921-836b34c27-ls233/index.html` and `https://ci-tests.linuxserver.io/linuxserver/plex/latest/index.html`
678684
679685
Args:
680686
file_path (str): File to upload
681687
object_name (str): S3 object name.
682688
content_type (dict): Content type for the file
683689
"""
684690
self.logger.info("Uploading %s to %s bucket",file_path, self.bucket)
685-
destination_dir: str = f"{self.image}/{self.meta_tag}"
686-
latest_dir: str = f"{self.image}/latest"
687-
self.s3_client.upload_file(file_path, self.bucket, f"{destination_dir}/{object_name}", ExtraArgs=content_type)
688-
self.s3_client.upload_file(file_path, self.bucket, f"{latest_dir}/{object_name}", ExtraArgs=content_type)
691+
meta_dir: str = f"{self.image}/{self.meta_tag}"
692+
release_dir: str = f"{self.image}/{self.release_tag}"
693+
self.s3_client.upload_file(file_path, self.bucket, f"{meta_dir}/{object_name}", ExtraArgs=content_type)
694+
self.s3_client.upload_file(file_path, self.bucket, f"{release_dir}/{object_name}", ExtraArgs=content_type)
689695

690696
def log_upload(self) -> None:
691697
"""Upload the ci.log to S3

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ full_custom_readme: |
5555
-e DOCKER_LOGS_TIMEOUT=<optional, How long to wait in seconds while tailing the container logs before timing out. Defaults to '120'> \
5656
-e DRY_RUN=<optional, Set to 'true' when you don't want to upload files to S3 when testing> \
5757
-e NODE_NAME=<optional, Name of the builder that runs the CI test.> \
58+
-e RELEASE_TAG=<optional, The release tag of the docker image. Used for upload location. Defaults to 'latest'> \
5859
-t lsiodev/ci:latest \
5960
python3 test_build.py
6061
```

0 commit comments

Comments
 (0)