Skip to content

Commit

Permalink
Fix some issues with tar inputs (#126)
Browse files Browse the repository at this point in the history
* Go crap

* Fix tar inputs

* Regen SDKs
  • Loading branch information
UnstoppableMango authored Aug 13, 2024
1 parent c4ef20a commit 1b4869c
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 17 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ $(GO_MODULES:%=.make/tidy/%): .make/tidy/%: $(addprefix %/,go.mod go.sum)
docker build ${WORKING_DIR} -f $< -t ${PROVISIONER_NAME}:${DOCKER_TAG}
@touch $@

.make/provisioner_docker_test: provider/cmd/provisioner/Dockerfile .dockerignore $(PROVIDER_SRC)
docker build ${WORKING_DIR} -f $< --target test -t ${PROVISIONER_NAME}:test
@touch $@

.make/examples/%: examples/yaml/** bin/$(PROVIDER)
rm -rf ${WORKING_DIR}/examples/$*
pulumi convert \
Expand All @@ -218,7 +222,7 @@ $(GO_MODULES:%=.make/tidy/%): .make/tidy/%: $(addprefix %/,go.mod go.sum)
export GRPC_GO_LOG_SEVERITY_LEVEL ?=
TEST_FLAGS ?=

.test/provider: .make/provisioner_test_docker_build
.test/provider: .make/provisioner_docker_test
cd tests && $(GINKGO) run -v --silence-skips ${TEST_FLAGS}

.test/pkg: $(PKG_SRC)
Expand Down
8 changes: 6 additions & 2 deletions provider/cmd/provisioner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ COPY provider/pkg/ ./pkg/

RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/provisioner cmd/main.go

FROM --platform=$BUILDPLATFORM ubuntu:noble-20240605 AS test
FROM --platform=$BUILDPLATFORM ubuntu:noble-20240605 AS test-base

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt install -y \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /testdata \
&& curl -fLo /testdata/cni-plugins-linux-amd64-v1.5.1.tgz https://github.com/containernetworking/plugins/releases/download/v1.5.1/cni-plugins-linux-amd64-v1.5.1.tgz

FROM test-base AS test
COPY --from=build /out/provisioner /
ENTRYPOINT ["/provisioner"]

Expand Down
2 changes: 0 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ github.com/pulumi/pulumi-go-provider v0.21.0 h1:sDHBtWkWRrWn6klfdvDIorlUGMBt6Bwh
github.com/pulumi/pulumi-go-provider v0.21.0/go.mod h1:2qQ4M1LXzv+SpY6v8JiTbPVGdeCeqfBMgsqb7WyH77o=
github.com/pulumi/pulumi/pkg/v3 v3.127.0 h1:C3qa1SPegwqN5OOO9yX/4Nq0rPyVZfnWQjkVx+kvsJs=
github.com/pulumi/pulumi/pkg/v3 v3.127.0/go.mod h1:p1oeYtP+nXjULDxN1hrj9hz/jFBaqIE/OS8T09079zY=
github.com/pulumi/pulumi/sdk/v3 v3.128.0 h1:5VPFfygxt6rva0bEYVQZXxsGAo2/D1wsb9erGOtXxzk=
github.com/pulumi/pulumi/sdk/v3 v3.128.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY=
github.com/pulumi/pulumi/sdk/v3 v3.129.0 h1:uZpTTwWTx7Mk8UT9FgatzxzArim47vZ6hzNCKvgvX6A=
github.com/pulumi/pulumi/sdk/v3 v3.129.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down
12 changes: 11 additions & 1 deletion provider/pkg/provider/cmd/builder.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package cmd

import pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1"
import (
"strconv"

pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1"
)

type Builder interface {
FsManipulator
Expand Down Expand Up @@ -43,6 +47,12 @@ func (b *B) Opv(value, name string) {
}
}

func (b *B) Opi(value int, name string) {
if value > 0 {
b.add(name, strconv.Itoa(value))
}
}

func (b *B) Stdin(value string) {
b.stdin = &value
}
Expand Down
8 changes: 7 additions & 1 deletion provider/pkg/provider/coreutils/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type TarArgs struct {
Extract bool `pulumi:"extract,optional"`
List bool `pulumi:"list,optional"`
Update bool `pulumi:"update,optional"`
Version bool `pulummi:"version,optional"`
Version bool `pulumi:"version,optional"`

// Operation modifiers
NoSeek bool `pulumi:"noSeek,optional"`
Expand Down Expand Up @@ -69,8 +69,10 @@ type TarArgs struct {
ExcludeFrom string `pulumi:"excludeFrom,optional"`

// File name transformations
Anchored bool `pulumi:"anchored,optional"`
StripComponents int `pulumi:"stripComponents,optional"`
Transform string `pulumi:"transform,optional"`
NoAnchored bool `pulumi:"noAnchored,optional"`

// Informative output
Verbose bool `pulumi:"verbose,optional"`
Expand Down Expand Up @@ -123,6 +125,10 @@ func (t TarArgs) Cmd() (*pb.Command, error) {
b.Opv(t.Suffix, "--suffix")
b.Opv(t.Transform, "--transform")

b.Op(t.Anchored, "--anchored")
b.Op(t.NoAnchored, "--no-anchored")
b.Opi(t.StripComponents, "--strip-components")

return &pb.Command{
Bin: pb.Bin_BIN_TAR,
Args: b.Args,
Expand Down
9 changes: 9 additions & 0 deletions sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace UnMango.Baremetal.Coreutils.Inputs

public sealed class TarArgsArgs : global::Pulumi.ResourceArgs
{
[Input("anchored")]
public Input<bool>? Anchored { get; set; }

[Input("append")]
public Input<bool>? Append { get; set; }

Expand Down Expand Up @@ -84,6 +87,9 @@ public InputList<string> Args
[Input("lzop")]
public Input<bool>? Lzop { get; set; }

[Input("noAnchored")]
public Input<bool>? NoAnchored { get; set; }

[Input("noOverwriteDir")]
public Input<bool>? NoOverwriteDir { get; set; }

Expand Down Expand Up @@ -129,6 +135,9 @@ public InputList<string> Args
[Input("verify")]
public Input<bool>? Verify { get; set; }

[Input("version")]
public Input<bool>? Version { get; set; }

[Input("xz")]
public Input<bool>? Xz { get; set; }

Expand Down
12 changes: 12 additions & 0 deletions sdk/dotnet/Coreutils/Outputs/TarArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace UnMango.Baremetal.Coreutils.Outputs
[OutputType]
public sealed class TarArgs
{
public readonly bool? Anchored;
public readonly bool? Append;
public readonly ImmutableArray<string> Args;
public readonly bool? Bzip2;
Expand All @@ -36,6 +37,7 @@ public sealed class TarArgs
public readonly bool? Lzip;
public readonly bool? Lzma;
public readonly bool? Lzop;
public readonly bool? NoAnchored;
public readonly bool? NoOverwriteDir;
public readonly bool? NoSeek;
public readonly bool? Overwrite;
Expand All @@ -51,11 +53,14 @@ public sealed class TarArgs
public readonly bool? Update;
public readonly bool? Verbose;
public readonly bool? Verify;
public readonly bool? Version;
public readonly bool? Xz;
public readonly bool? Zstd;

[OutputConstructor]
private TarArgs(
bool? anchored,

bool? append,

ImmutableArray<string> args,
Expand Down Expand Up @@ -100,6 +105,8 @@ private TarArgs(

bool? lzop,

bool? noAnchored,

bool? noOverwriteDir,

bool? noSeek,
Expand Down Expand Up @@ -130,10 +137,13 @@ private TarArgs(

bool? verify,

bool? version,

bool? xz,

bool? zstd)
{
Anchored = anchored;
Append = append;
Args = args;
Bzip2 = bzip2;
Expand All @@ -156,6 +166,7 @@ private TarArgs(
Lzip = lzip;
Lzma = lzma;
Lzop = lzop;
NoAnchored = noAnchored;
NoOverwriteDir = noOverwriteDir;
NoSeek = noSeek;
Overwrite = overwrite;
Expand All @@ -171,6 +182,7 @@ private TarArgs(
Update = update;
Verbose = verbose;
Verify = verify;
Version = version;
Xz = xz;
Zstd = zstd;
}
Expand Down
18 changes: 18 additions & 0 deletions sdk/go/baremetal/coreutils/pulumiTypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions sdk/go/baremetal/x/coreutils/pulumiTypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sdk/nodejs/types/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export namespace coreutils {
}

export interface TarArgsArgs {
anchored?: pulumi.Input<boolean>;
append?: pulumi.Input<boolean>;
args?: pulumi.Input<pulumi.Input<string>[]>;
bzip2?: pulumi.Input<boolean>;
Expand All @@ -93,6 +94,7 @@ export namespace coreutils {
lzip?: pulumi.Input<boolean>;
lzma?: pulumi.Input<boolean>;
lzop?: pulumi.Input<boolean>;
noAnchored?: pulumi.Input<boolean>;
noOverwriteDir?: pulumi.Input<boolean>;
noSeek?: pulumi.Input<boolean>;
overwrite?: pulumi.Input<boolean>;
Expand All @@ -108,6 +110,7 @@ export namespace coreutils {
update?: pulumi.Input<boolean>;
verbose?: pulumi.Input<boolean>;
verify?: pulumi.Input<boolean>;
version?: pulumi.Input<boolean>;
xz?: pulumi.Input<boolean>;
zstd?: pulumi.Input<boolean>;
}
Expand Down
Loading

0 comments on commit 1b4869c

Please sign in to comment.