Commit Graph

25 Commits

Author SHA1 Message Date
Bryce Lampe
448c16a695 Improve exec error messages (#553)
Fixes https://github.com/pulumi/pulumi-docker-build/issues/549.
2025-06-04 11:53:24 -07:00
Bryce Lampe
82057d3065 Freeze v0.0.12 (#547)
### Changed

- Upgraded pulumi-go-provider to v1.0.0-rc2.

### Fixed

- Builds now respect cancellation.
(https://github.com/pulumi/pulumi-docker-build/issues/533,
https://github.com/pulumi/pulumi-docker-build/pull/522)
2025-05-16 12:08:02 -07:00
Bryce Lampe
30a01b6893 Handle context cancellation during builds (#539)
`buildx.Build` doesn't terminate if context is canceled, so this PR
rearranges things such that we can wait for the build or context to
finish.

Fixes #533.
2025-05-05 16:12:48 -07:00
Ian Wahbe
7eb1e3fe50 Flow context.Context through image builds (#522)
This should help with cancel responsiveness. Right now, there are
multiple places where docker does not respond to cancel for long periods
of time.
2025-05-02 12:31:40 +02:00
Bryce Lampe
7009361c0f Add missing changelog entries (#527) 2025-04-29 11:14:40 -07:00
Ramon Quitales
4d858c52b9 Prepare for v0.0.11 release (#520) 2025-04-11 21:19:58 +00:00
Ramon Quitales
f83b7a0a44 chore: update moby/buildkit to v0.20.1 (#519)
**Description:**  
This PR updates the `moby/buildkit` dependency to `v0.20.1` in order to
remain compatible with recent changes required by GitHub Actions (GHA)
caching.

During the upgrade, several upstream behavioral changes required forking
and restoring legacy logic to maintain compatibility:

- Introduced `containsGithubToken` to replicate logic that was
previously in `buildflags.ParseCacheEntry`, which is now removed. This
check ensures we return `nil` instead of a zero-value object.
- Forked the previous implementation of `ParseExports`, as its upstream
logic changed significantly. This ensures short-term compatibility for
release before the GHA deprecation deadline.
- A follow-up issue will be created to improve this forked logic and
align more closely with upstream behavior.

🚨 **Fixes critical issue:**  
This change addresses a high-priority issue where GitHub Actions cache
will stop working due to the upcoming deprecation of the legacy caching
service (effective **April 15, 2025**).

Recent build failures showed errors like:
> *"This legacy service is shutting down, effective April 15, 2025.
Migrate to the new service ASAP. For more information:
https://gh.io/gha-cache-sunset"*

Root cause was identified in #515, where using `buildx >= 0.21.0` is
required.
This repo was previously using `buildx 0.18.0`.

Closes: #515
2025-04-11 13:42:47 -07:00
Eron Wright
780fe97f99 Use 'buildkit' as default scope (#516)
This PR updates the schema to use the correct default value for `scope`
in the GHA caching options. This should be effectively a no-op.


From: https://docs.docker.com/build/cache/backends/gha/

<img width="892" alt="image"
src="https://github.com/user-attachments/assets/690cde79-e30e-4085-81fd-1c9dc1c6d7e9"
/>


Closes #496
2025-04-09 14:01:21 -07:00
Eron Wright
20f5f536dc Handle case of missing GH variables (#492)
Closes #482 

I traced the problem to where buildx parses the cli args
([here](fa4461b9a1/util/buildflags/cache.go (L14))),
and confirmed it applies defaults based on GHA environment variables and
ignores the cacheTo/cacheFrom directive altogether when the variables
aren't available.

The fix is to ignore the GHA cache directive when it the upstream parser
ignores it.
2025-03-20 09:27:59 -07:00
Ian Wahbe
dad72f7d65 Upgrade pulumi-go-provider to v0.24.1 (#413)
Fixes #403
2025-01-15 09:29:23 -05:00
Ramon Quitales
d46882f9eb Do not diff __internal property in DiffConfig (#414)
This PR updates the implementation of DiffConfig to remove the
`__internal` property when comparing provider config between old state
and new input. It is observed that the `__internal` property is present
when a default provider is used. This causes a provider replacement
every time a user upgrades pulumi-docker-build, as the `__internal`
property is always stripped from state, so Pulumi will always report a
diff.

Ideally, we should determine if this bug can be fixed in either upstream
pulumi-go-provider or pulumi itself. For now, we will fix this locally
within pulumi-docker-build to unblock our users.

Changes:

- Update DiffConfig implementation to strip `__internal` property from
new inputs.
- Add a nodejs upgrade test to test that this solution works

Fixes: #404
2025-01-14 15:01:51 -08:00
Bryce Lampe
195fbfc784 Add support for multiple exporters (#235)
Buildkit 0.13 introduced support for [multiple
exporters](https://docs.docker.com/build/exporters/#multiple-exporters).
We currently return an error in these situations.

Instead, inspect the builder's version when loading the node and relax
this error if we see it's running at least 0.13.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/21.
2024-12-10 09:05:36 -08:00
Bryce Lampe
2907567484 Don't attempt to parse custom syntax (#346)
The provider currently attempts to parse your Dockerfile in case there
are any obviously broken syntax errors.

However, Dockerfiles can use custom syntaxes which are implemented as
their own images. Buildkit detects `# syntax=` directives, pulls the
image, and uses it to parse.

It doesn't make sense for us to attempt to replicate that behavior, so
when we detect a custom syntax we will simply disable this validation.
If there are syntax errors the user will discover them after the build
is attempted.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/300
2024-12-09 15:41:58 -08:00
pulumi-renovate[bot]
0ce316d7de fix(deps): update module github.com/docker/buildx to v0.18.0 (main) (#312) 2024-11-20 20:00:22 -08:00
Bryce Lampe
30a26f61e4 Upgrade pulumi-go-provider (#268)
Fixes https://github.com/pulumi/pulumi-docker-build/issues/262.

@iwahbe I realized while putting this together that the provider config
case wasn't actually tested e2e, and I'm skeptical it was ever actually
working. I think it would be reasonable to pull in
https://github.com/pulumi/pulumi-docker-build/pull/253 IMO.
2024-09-27 09:57:50 -07:00
Bryce Lampe
d9c3284f40 Check if local exports exist (#197)
Check if local exports exist during diffing. For tar, the file must
exist. For local, the directory must exist and be populated.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/177.
2024-08-13 13:52:10 -07:00
Bryce Lampe
81a7aa4ec4 No-op during Read if credentials are invalid (#194)
The `Image` resource already ignores errors during read but the `Index`
resource was requiring the inspect call to always succeed. This will often 
fail due to https://github.com/pulumi/pulumi/issues/4981 (note however in
this case credentials are stored with the resource instead of the provider).

This changes our logic to instead emit a warning if the credentials are
invalid.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/121.
2024-08-13 12:54:14 -07:00
Bryce Lampe
0ba90b8cde Prepare for v0.0.5 release (#189)
### Fixed

- Fixed Go SDK publishing.

### Changed

- Upgraded docker from 27.0.3 to 27.1.0.
2024-08-08 16:48:00 -07:00
dependabot[bot]
724836b5ef Bump the other group across 1 directory with 13 updates (#152)
---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-07-12 16:40:59 -07:00
Bryce Lampe
bbdefef3c8 Fix an issue where warnings aren't displayed correctly (#136)
This is a byte array that needs to be string'd.
2024-06-27 14:07:25 -07:00
dependabot[bot]
343eadd0b6 Bump the security group across 1 directory with 3 updates (#128) 2024-06-26 12:32:54 -07:00
dependabot[bot]
1febe659ca Bump the docker group with 5 updates (#113)
Bumps the docker group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/docker/buildx](https://github.com/docker/buildx) |
`0.13.1` | `0.15.1` |
| [github.com/docker/cli](https://github.com/docker/cli) |
`26.0.0-rc1+incompatible` | `26.1.4+incompatible` |
|
[github.com/docker/distribution](https://github.com/docker/distribution)
| `2.8.2+incompatible` | `2.8.3+incompatible` |
| [github.com/docker/docker](https://github.com/docker/docker) |
`26.0.0-rc1+incompatible` | `26.1.4+incompatible` |
| [github.com/moby/buildkit](https://github.com/moby/buildkit) |
`0.13.0` | `0.14.1` |

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-06-26 11:07:02 -07:00
Bryce Lampe
4e8cf8f4ba Fix a panic that could occur when context was omitted (#83)
I could have sworn the context property was required, but evidently it
isn't and we weren't handling the case when it was missing.

This PR updates things to set a default location of the current
directory if the context is absent. Some unit tests are also added.

Fixes #78.
2024-05-31 14:41:22 +00:00
Bryce Lampe
9a1706a203 Fix publisher capitalization (#89)
Refs https://github.com/pulumi/pulumi-dbtcloud/pull/23.
2024-05-31 01:56:19 -07:00
Bryce Lampe
f0aaf7095d Fix GitHub action URL (#80)
Our docs and default value for the GitHub action cache URL were
referring to the
[wrong](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md)
environment variable.

I was under the impression that the underlying library ends up checking
for the correct variable later so this would be only cosmetic, but a
user
[confirmed](https://github.com/pulumi/pulumi-docker-build/issues/77#issuecomment-2135621983)
this does appear to break things.

I brought over an old test I had written while this was still in the
pulumi-docker repo, but unfortunately it doesn't currently test GHA due
to ci-mgmt limitations
https://github.com/pulumi/pulumi-docker-build/issues/82.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/77.
2024-05-29 12:29:58 +00:00