Skip to content

Commit

Permalink
Merge pull request #148 from jmlopez-rod/hotfix/0.35.2
Browse files Browse the repository at this point in the history
(hotfix) 0.35.2
  • Loading branch information
jmlopez-rod authored Jun 18, 2024
2 parents d654f90 + 2f15c9b commit 9d7b075
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ The format of this changelog is based on
## [Unreleased]

## [0.35.2] <a name="0.35.2" href="#0.35.2">-</a> June 18, 2024

- Add missing docker tag. There was other parts of the code that were missing
the default branch tag.

## [0.35.1] <a name="0.35.1" href="#0.35.1">-</a> June 17, 2024

- `m npm add_tags` no longer attempts to tag `v#.#` since these are npm sem
Expand Down Expand Up @@ -594,7 +599,8 @@ latest on the `master` branch.
- Provides basic utilities to create a CI/CD flow via the m cli.
- As a library, it facilities the creation of clis similar to m.

[unreleased]: https://github.com/jmlopez-rod/m/compare/0.35.1...HEAD
[unreleased]: https://github.com/jmlopez-rod/m/compare/0.35.2...HEAD
[0.35.2]: https://github.com/jmlopez-rod/m/compare/0.35.1...0.35.2
[0.35.1]: https://github.com/jmlopez-rod/m/compare/0.35.0...0.35.1
[0.35.0]: https://github.com/jmlopez-rod/m/compare/0.34.3...0.35.0
[0.34.3]: https://github.com/jmlopez-rod/m/compare/0.34.2...0.34.3
Expand Down
2 changes: 1 addition & 1 deletion m/m.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
owner: jmlopez-rod
repo: m
version: 0.35.1
version: 0.35.2
workflow: m_flow
build_tag_with_version: true
2 changes: 1 addition & 1 deletion packages/python/m/ci/docker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def write_ci_steps(
push_script = (
create_push_script(registry)
if self.architectures
else create_push_script_tags(registry, m_env.m_tag)
else create_push_script_tags(registry, m_env.m_tag, m_env.default_branch)
)
script_results = [
rw.write_file(f'{files.ci_dir}/_find-cache.sh', cache_script),
Expand Down
2 changes: 2 additions & 0 deletions packages/python/m/ci/docker/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def ci_manifest(self: 'DockerImage', m_env: MEnvDocker) -> Res[str]:
m_tag = '1.1.1'
registry = m_env.registry
tags = [m_tag, *docker_tags(m_tag)]
if 'latest' in tags:
tags.append(m_env.default_branch)
img_name = f'{registry}/{self.image_name}'
all_tags = [
f' -t {img_name}:{tag} \\'
Expand Down
5 changes: 4 additions & 1 deletion packages/python/m/ci/docker/shell_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ def create_push_script(docker_registry: str) -> str:
return PUSH_SCRIPT.format(docker_registry=docker_registry)


def create_push_script_tags(docker_registry: str, m_tag: str) -> str:
def create_push_script_tags(docker_registry: str, m_tag: str, default_branch: str) -> str:
"""Create a script to push an image.
This is meant to be used when building for a single architecture.
Args:
docker_registry: The docker registry where the images will be pushed.
m_tag: The unique tag for the image.
default_branch: The default branch for the repository.
Returns:
A script to push an image.
Expand All @@ -89,6 +90,8 @@ def create_push_script_tags(docker_registry: str, m_tag: str) -> str:
logger.warning('M_TAG not found in non-CI environment. Using 1.1.1')
m_tag = '1.1.1'
tags = [m_tag, *docker_tags(m_tag)]
if 'latest' in tags:
tags.append(default_branch)
tagged_images = '\n'.join([
f'docker tag staged-image:latest "{docker_registry}/$imageName:{tag}"'
for tag in tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ docker buildx imagetools create \
-t ghcr.io/repo-owner/m-image1:latest \
-t ghcr.io/repo-owner/m-image1:v1 \
-t ghcr.io/repo-owner/m-image1:v1.1 \
-t ghcr.io/repo-owner/m-image1:master \
ghcr.io/repo-owner/amd64-m-image1:1.1.1 \
ghcr.io/repo-owner/arm64-m-image1:1.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ docker buildx imagetools create \
-t ghcr.io/repo-owner/m-image2:latest \
-t ghcr.io/repo-owner/m-image2:v1 \
-t ghcr.io/repo-owner/m-image2:v1.1 \
-t ghcr.io/repo-owner/m-image2:master \
ghcr.io/repo-owner/amd64-m-image2:1.1.1 \
ghcr.io/repo-owner/arm64-m-image2:1.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ docker buildx imagetools create \
-t ghcr.io/repo-owner/m-image1:latest \
-t ghcr.io/repo-owner/m-image1:v1 \
-t ghcr.io/repo-owner/m-image1:v1.1 \
-t ghcr.io/repo-owner/m-image1:master \
ghcr.io/repo-owner/amd64-m-image1:1.1.1 \
ghcr.io/repo-owner/arm64-m-image1:1.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ docker buildx imagetools create \
-t ghcr.io/repo-owner/m-image2:latest \
-t ghcr.io/repo-owner/m-image2:v1 \
-t ghcr.io/repo-owner/m-image2:v1.1 \
-t ghcr.io/repo-owner/m-image2:master \
ghcr.io/repo-owner/amd64-m-image2:1.1.1 \
ghcr.io/repo-owner/arm64-m-image2:1.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ docker tag staged-image:latest "ghcr.io/repo-owner/$imageName:1.1.1"
docker tag staged-image:latest "ghcr.io/repo-owner/$imageName:latest"
docker tag staged-image:latest "ghcr.io/repo-owner/$imageName:v1"
docker tag staged-image:latest "ghcr.io/repo-owner/$imageName:v1.1"
docker tag staged-image:latest "ghcr.io/repo-owner/$imageName:master"
docker image push --all-tags "ghcr.io/repo-owner/$imageName"

0 comments on commit 9d7b075

Please sign in to comment.