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

feat: Prefer local image #380

Closed
wants to merge 1 commit into from
Closed

Conversation

pmengelbert
Copy link
Contributor

@pmengelbert pmengelbert commented Oct 17, 2023

Use gateway client for config resolution

Implement buildkit.ExtractFileFromState
This code will still not compile, since the signature of buildkit.SolveToLocal is not satisfied by its calls.
Replace SolveToLocal in probeDPKGStatus method
In this case, we will write the status type to a file, which we thereafter read from the state as a single byte.
Fix error in awk script
Use ExtractFileFromState for dpkg installUpdates
Use ExtractFileFromState in unpackAndMergeUpdates
APK: Use ExtractFileFromState for upgradePackages
Do not use SolveToLocal.
Use ExtractFileFromState for probeRPMStatus
Replace buildkit.SolveToLocal in rpm.go
Update patchWithContext to pass the correct client
Fix errors and achieve parity with main branch
Update unit tests

Closes #177

The gateway client has options which allow for fetching the image config
locally before attempting to find it remotely.

However, this commit is broken, since the `buildkit.Config` object now
has a reference to a gateway client; however, `buildkit.SolveToLocal`
requires a normal buildkit client.

The following commit will replace `buildkit.SolveToLocal` with
`buildkit.ExtractFileFromState`.

Implement `buildkit.ExtractFileFromState`

This code will still not compile, since the signature of
`buildkit.SolveToLocal` is not satisfied by its calls.

Replace `SolveToLocal` in `probeDPKGStatus` method

In this case, we will write the status type to a file, which we
thereafter read from the state as a single byte.

Fix error in awk script

There was a confusion in the awk script between bash arrays and awk
arrays. You cannot pass in an awk array via the command line (see
https://stackoverflow.com/a/33106291).

The strings will be split by space to produce the array, so the
parentheses are unnecessary here.

Use `ExtractFileFromState` for dpkg `installUpdates`

Read the bytes and return them, instead of writing them to the local
filesystem.

Use `ExtractFileFromState` in `unpackAndMergeUpdates`

In dpkg.go

APK: Use `ExtractFileFromState` for `upgradePackages`

Do not use `SolveToLocal`.

Use `ExtractFileFromState` for `probeRPMStatus`

Replace `buildkit.SolveToLocal` in rpm.go

In all places

Update `patchWithContext` to pass the correct client

Fix errors and achieve parity with `main` branch

This commit passes the integration tests as well as the `main` branch
does.

Update unit tests

Signed-off-by: Peter Engelbert <[email protected]>
@sozercan sozercan deleted the pmengelbert/prefer_local_image/5 branch January 3, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[REQ] Skip request to container registry when image already exists locally
1 participant