Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

fix: add immage flag for . image convention #69

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

chrishumanitec
Copy link
Contributor

Add -i|--image flag to allow for specifying the image to override when the image property in a score file has a value .

Description

  • Added a new Flag to all commands
  • Added a backwards compatible implementation to override .containers.{containerId}.image where the value is .

What does this PR do?

It is a convention when working with score that setting the image to . means: "the image in the current context". Usually, this means the image that is associated with the score file. The CI pipeline will know the generated image to be inserted.

Today, there are a number of workarounds involving --property overrides (which require knowledge of the container IDs) or even sed scripts such as:

sed -i -E "s/^(\\s+image:)\\s+.*\$/\\1 '${IMAGE_NAME}'/" score.yaml

This change will make updated in the current image much simpler:

score-humanitec delta -i my-image:my-tag --org....

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • New chore (expected functionality to be implemented)

Checklist:

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I've signed off with an email address that matches the commit author.

internal/command/run.go Outdated Show resolved Hide resolved
Copy link
Member

@astromechza astromechza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, just a duplicated typo in the flag description.

Signed-off-by: Chris Stephenson <chris.stephenson@humanitec.com>
@chrishumanitec
Copy link
Contributor Author

Change looks good, just a duplicated typo in the flag description.

Fixed the duplicated text and rebased to main.

Copy link
Member

@astromechza astromechza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrishumanitec chrishumanitec merged commit 6355a99 into main Feb 2, 2024
3 checks passed
@chrishumanitec chrishumanitec deleted the image-replacement-convention branch February 2, 2024 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants