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 an option to retag rather than replacing the target image while rebasing #2023

Merged
merged 11 commits into from
Mar 8, 2024

Conversation

Parthiba-Hazra
Copy link
Contributor

@Parthiba-Hazra Parthiba-Hazra commented Jan 11, 2024

Resolves #1748

@Parthiba-Hazra Parthiba-Hazra requested review from a team as code owners January 11, 2024 18:44
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Jan 11, 2024
@github-actions github-actions bot added this to the 0.33.0 milestone Jan 11, 2024
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

@Parthiba-Hazra thank you for picking this up! I think unfortunately the requirements were not too clearly specified in the original issue - I left some suggestions below. Let us know what you think :)

internal/commands/rebase.go Outdated Show resolved Hide resolved
pkg/client/rebase.go Outdated Show resolved Hide resolved
@jjbustamante jjbustamante modified the milestones: 0.33.0, 0.34.0 Jan 24, 2024
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.72%. Comparing base (667bf4f) to head (ced704f).
Report is 12 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2023      +/-   ##
==========================================
+ Coverage   79.69%   79.72%   +0.04%     
==========================================
  Files         176      176              
  Lines       13257    13263       +6     
==========================================
+ Hits        10564    10573       +9     
+ Misses       2023     2021       -2     
+ Partials      670      669       -1     
Flag Coverage Δ
os_linux 78.64% <100.00%> (+0.04%) ⬆️
os_macos 76.36% <100.00%> (+0.04%) ⬆️
os_windows 79.11% <100.00%> (+0.04%) ⬆️
unit 79.72% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@github-actions github-actions bot modified the milestones: 0.34.0, 0.33.0 Jan 29, 2024
@github-actions github-actions bot added the type/chore Issue that requests non-user facing changes. label Jan 29, 2024
Parthiba-Hazra and others added 7 commits January 29, 2024 20:31
…ebasing

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>

add an option to "retag" rather than replacing the target image while rebasing

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Rizul Gupta <112455393+rizul2108@users.noreply.github.com>
During builder creation, end-users can provide the flag `--flatten` with
the buildpacks they want to put in one layer.

Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
… purpose.

If previous-image flag set then workingImage will be based off of opts.PreviousImage in the rebaser.Rebase

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>

fix merge conflicts

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>

resolve merge conflict

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>
@github-actions github-actions bot modified the milestones: 0.34.0, 0.33.0 Feb 1, 2024
@jjbustamante jjbustamante modified the milestones: 0.33.0, 0.34.0 Feb 1, 2024
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

@Parthiba-Hazra thank you for this! I left a couple nits, but overall this looks good :)

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>

update documentation for PreviousImage filed in RebaseOptions

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>

update docs

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>
repoName = opts.PreviousImage
}

appImage, err := c.imageFetcher.Fetch(ctx, repoName, image.FetchOptions{Daemon: !opts.Publish, PullPolicy: opts.PullPolicy})
Copy link
Member

Choose a reason for hiding this comment

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

@Parthiba-Hazra

Could you add some test coverage for this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes sure, let me check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jjbustamante can you check if I am missing some other scenarios.

Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>
@github-actions github-actions bot modified the milestones: 0.34.0, 0.33.0 Feb 2, 2024
@jjbustamante jjbustamante modified the milestones: 0.33.0, 0.34.0 Feb 2, 2024
@jjbustamante
Copy link
Member

Manual Test

  • I created a spring boot app using the initializr

  • I used the latest pack version to publish the app image into my dockerhub account pack build jbustamantevmware/my-spring-app --publish, I am using paketobuildpacks/builder-jammy-base as my default builder.

  • The app was published correctly
    Screenshot 2024-03-05 at 1 01 35 PM

  • I compiled this feature branch

  • I ran pack rebase using the new --previous-image flag

> git:(retag) out/pack rebase --previous-image jbustamantevmware/my-spring-app:latest jbustamantevmware/my-spring-app:sometag --publish
Rebasing jbustamantevmware/my-spring-app:latest on run image index.docker.io/paketobuildpacks/run-jammy-base:latest
Saving jbustamantevmware/my-spring-app:sometag...
*** Images (sha256:ca7d958efd12d2b9c409e803d4f5b78dc9496ba1c1d3457a8f25103956f8a8e4):
      jbustamantevmware/my-spring-app:sometag
Rebased Image: index.docker.io/jbustamantevmware/my-spring-app@sha256:ca7d958efd12d2b9c409e803d4f5b78dc9496ba1c1d3457a8f25103956f8a8e4
Successfully rebased image jbustamantevmware/my-spring-app:sometag

As we can see a new tag was created for my application

Screenshot 2024-03-05 at 1 03 54 PM

Copy link
Member

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

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

@Parthiba-Hazra Thank you so much for this!

@jjbustamante jjbustamante merged commit 2a15554 into buildpacks:main Mar 8, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rebase option to "retag" rather than replacing the target image
4 participants