improvements

cleans package.json, update binary download URL, etc
This commit is contained in:
2025-04-25 19:22:29 -04:00
parent 9fe19d2cc2
commit 908889d9af
16 changed files with 82 additions and 253 deletions

View File

@@ -15,7 +15,7 @@ tfgen:
RUN curl -fsSL https://get.pulumi.com | HOME=${WORKING_DIR} sh -s -- --version "$(cat .pulumi/version)"
RUN pulumi plugin install converter terraform 1.0.16
RUN go mod download
ENV PROVIDER_VERSION=1.0.0-alpha.0+dev
ENV PROVIDER_VERSION=1.0.0-beta.1
ENV LDFLAGS_PROJ_VERSION="-X git.kalinow.ski/nimbus/pulumi-incus/provider/pkg/version.Version=${PROVIDER_VERSION}"
ENV PULUMI_CONVERT=1
ENV PULUMI_CONVERT_EXAMPLES_CACHE_DIR=/go/src/git.kalinow.ski/nimbus/pulumi-incus/provider/.pulumi/examples-cache
@@ -38,17 +38,18 @@ nodejs:
FROM node:23-bookworm
WORKDIR /root/sdk/nodejs
RUN corepack enable pnpm
COPY scripts/clean-package-json.js /bin
COPY +tfgen/nodejs .
RUN pnpm install && pnpm tsc && cp package.json pnpm-lock.yaml ./bin/
COPY README.md LICENSE bin
SAVE ARTIFACT bin AS LOCAL sdk/nodejs/bin
# publish publishes the nodejs SDK
publish:
FROM +nodejs
RUN --push --secret TOKEN=token-package-rw npm config set @kiterun:registry=https://git.kalinow.ski/api/packages/kiterun/npm/ && \
npm config set -- '//git.kalinow.ski/api/packages/kiterun/npm/:_authToken' "$TOKEN" && \
npm publish sdk/nodejs/bin
WORKDIR /root/sdk/nodejs/bin
RUN node /bin/clean-package-json.js
# push the nodejs SDK and delete the secret file
RUN --push --secret TOKEN pnpm config set @kiterun:registry=https://git.kalinow.ski/api/packages/kiterun/npm/ && \
pnpm config set -g -- '//git.kalinow.ski/api/packages/kiterun/npm/:_authToken' "$TOKEN" && \
pnpm publish . && \
rm /root/.npmrc
# provider builds and publishes the provider binaries
provider:
@@ -62,14 +63,18 @@ provider:
DO +BINARY --GOOS=darwin --GOARCH=amd64
DO +BINARY --GOOS=darwin --GOARCH=arm64
SAVE ARTIFACT /root/dist AS LOCAL dist
# ENV FILENAME=pulumi-resource-incus-v${VERSION}-linux-amd64.tar.gz
# RUN tar -czvf $FILENAME pulumi-resource-incus
# RUN --push --secret TOKEN=token-package-rw curl --user kiterun:$TOKEN --upload-file $FILENAME \
# https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/$PROVIDER_VERSION/$FILENAME
RUN --push --secret TOKEN=token-package-rw \
sh -c 'for FILENAME in /root/dist/*; do \
curl --user kiterun:$TOKEN --upload-file "$FILENAME" \
https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/$PROVIDER_VERSION/$(basename "$FILENAME"); \
done'
BINARY:
FUNCTION
ARG GOOS
ARG GOARCH
RUN cd $WORKING_DIR/provider && GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -o ../bin/$GOOS-$GOARCH/pulumi-resource-incus -ldflags "${LDFLAGS_PROJ_VERSION} -s -w" git.kalinow.ski/nimbus/pulumi-incus/provider/cmd/pulumi-resource-incus
RUN cd $WORKING_DIR && tar --gzip -cf /root/dist/pulumi-resource-incus-v${PROVIDER_VERSION}-$GOOS-$GOARCH.tar.gz README.md LICENSE -C bin/$GOOS-$GOARCH .
RUN cd $WORKING_DIR/provider && GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build \
-o ../bin/$GOOS-$GOARCH/pulumi-resource-incus -ldflags "${LDFLAGS_PROJ_VERSION} -s -w" \
git.kalinow.ski/nimbus/pulumi-incus/provider/cmd/pulumi-resource-incus
RUN cd $WORKING_DIR && tar --gzip -cf /root/dist/pulumi-resource-incus-v${PROVIDER_VERSION}-$GOOS-$GOARCH.tar.gz \
README.md LICENSE -C bin/$GOOS-$GOARCH .

View File

@@ -1,3 +1,4 @@
import * as pulumi from "@pulumi/pulumi";
import * as incus from "@kiterun/incus";
const resource = new incus.Instance("instance1", {

View File

@@ -1,16 +1,13 @@
{
"name": "basic",
"main": "index.ts",
"devDependencies": {
"@types/node": "^18"
"@types/node": "^18.19.87"
},
"dependencies": {
"@kiterun/incus": "link:../../../../../../Library/pnpm/global/5/node_modules/@kiterun/incus",
"@pulumi/pulumi": "^3.0.0"
"@kiterun/incus": "1.0.0-beta.0",
"@pulumi/pulumi": "^3.165.0"
},
"pnpm": {
"overrides": {
"@kiterun/incus": "link:../../../../../../Library/pnpm/global/5/node_modules/@kiterun/incus"
}
"overrides": {}
}
}

7
inkjet.md Normal file
View File

@@ -0,0 +1,7 @@
# pulumi-incus
## nodejs
```bash
sops exec-env secrets.sops.env 'earthly --secret TOKEN=$TOKEN --push -i +nodejs'
```

View File

@@ -9,10 +9,10 @@
"nimbus"
],
"homepage": "https://linuxcontainers.org",
"license": "Apache-2.0",
"attribution": "This Pulumi package is based on the [`incus` Terraform Provider](https://github.com/lxc/terraform-provider-incus).",
"repository": "https://git.kalinow.ski/nimbus/pulumi-incus",
"logoUrl": "https://linuxcontainers.org/static/img/containers.png",
"pluginDownloadURL": "https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/${VERSION}/",
"publisher": "Kite.run",
"meta": {
"moduleFormat": "(.*)(?:/[^/]*)"

View File

@@ -129,7 +129,7 @@ func Provider() tfbridge.ProviderInfo {
// PluginDownloadURL is an optional URL used to download the Provider
// for use in Pulumi programs
// e.g. https://github.com/org/pulumi-provider-name/releases/download/v${VERSION}/
PluginDownloadURL: "",
PluginDownloadURL: "https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/${VERSION}/",
Description: "A Pulumi package for creating and managing incus cloud resources.",
// category/cloud tag helps with categorizing the package in the Pulumi Registry.
// For all available categories, see `Keywords` in

View File

@@ -0,0 +1,35 @@
import * as fs from "node:fs/promises";
const packageJsonPath = "./package.json";
const authorString = "Brandon Kalinowski <brandon@brandonkalinowski.com> (http://brandonkalinowski.com/)";
const keysOrdered = [
"name",
"version",
"description",
"author",
"keywords",
"homepage",
"dependencies",
"pulumi",
];
const packageJsonString = await fs.readFile(packageJsonPath, 'utf8');
const packageJson = JSON.parse(packageJsonString);
packageJson.author = authorString;
function sortAndFilterTopLevelKeys(obj, order) {
const sorted = {};
for (const key of order) {
if (key in obj) {
sorted[key] = obj[key];
}
}
return sorted;
}
const newPackageJsonString = JSON.stringify(sortAndFilterTopLevelKeys(packageJson, keysOrdered), null, 4);
await fs.writeFile(
packageJsonPath,
newPackageJsonString,
);

8
sdk/nodejs/index.ts generated
View File

@@ -70,11 +70,6 @@ export type NetworkIntegration = import("./networkIntegration").NetworkIntegrati
export const NetworkIntegration: typeof import("./networkIntegration").NetworkIntegration = null as any;
utilities.lazyLoad(exports, ["NetworkIntegration"], () => require("./networkIntegration"));
export { NetworkLbArgs, NetworkLbState } from "./networkLb";
export type NetworkLb = import("./networkLb").NetworkLb;
export const NetworkLb: typeof import("./networkLb").NetworkLb = null as any;
utilities.lazyLoad(exports, ["NetworkLb"], () => require("./networkLb"));
export { NetworkLoadBalancerArgs, NetworkLoadBalancerState } from "./networkLoadBalancer";
export type NetworkLoadBalancer = import("./networkLoadBalancer").NetworkLoadBalancer;
export const NetworkLoadBalancer: typeof import("./networkLoadBalancer").NetworkLoadBalancer = null as any;
@@ -164,8 +159,6 @@ const _module = {
return new NetworkForward(name, <any>undefined, { urn })
case "incus:index/networkIntegration:NetworkIntegration":
return new NetworkIntegration(name, <any>undefined, { urn })
case "incus:index/networkLb:NetworkLb":
return new NetworkLb(name, <any>undefined, { urn })
case "incus:index/networkLoadBalancer:NetworkLoadBalancer":
return new NetworkLoadBalancer(name, <any>undefined, { urn })
case "incus:index/networkPeer:NetworkPeer":
@@ -201,7 +194,6 @@ pulumi.runtime.registerResourceModule("incus", "index/network", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkAcl", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkForward", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkIntegration", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkLb", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkLoadBalancer", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkPeer", _module)
pulumi.runtime.registerResourceModule("incus", "index/networkZone", _module)

140
sdk/nodejs/networkLb.ts generated
View File

@@ -1,140 +0,0 @@
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as utilities from "./utilities";
/**
* @deprecated incus.index/networklb.NetworkLb has been deprecated in favor of incus.index/networkloadbalancer.NetworkLoadBalancer
*/
export class NetworkLb extends pulumi.CustomResource {
/**
* Get an existing NetworkLb resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NetworkLbState, opts?: pulumi.CustomResourceOptions): NetworkLb {
pulumi.log.warn("NetworkLb is deprecated: incus.index/networklb.NetworkLb has been deprecated in favor of incus.index/networkloadbalancer.NetworkLoadBalancer")
return new NetworkLb(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'incus:index/networkLb:NetworkLb';
/**
* Returns true if the given object is an instance of NetworkLb. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is NetworkLb {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === NetworkLb.__pulumiType;
}
/**
* Network load balancer backend
*/
public readonly backends!: pulumi.Output<outputs.NetworkLbBackend[] | undefined>;
public readonly config!: pulumi.Output<{[key: string]: string}>;
public readonly description!: pulumi.Output<string>;
public readonly listenAddress!: pulumi.Output<string>;
public readonly network!: pulumi.Output<string>;
/**
* Network load balancer port
*/
public readonly ports!: pulumi.Output<outputs.NetworkLbPort[] | undefined>;
public readonly project!: pulumi.Output<string | undefined>;
public readonly remote!: pulumi.Output<string | undefined>;
/**
* Create a NetworkLb resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
/** @deprecated incus.index/networklb.NetworkLb has been deprecated in favor of incus.index/networkloadbalancer.NetworkLoadBalancer */
constructor(name: string, args: NetworkLbArgs, opts?: pulumi.CustomResourceOptions)
/** @deprecated incus.index/networklb.NetworkLb has been deprecated in favor of incus.index/networkloadbalancer.NetworkLoadBalancer */
constructor(name: string, argsOrState?: NetworkLbArgs | NetworkLbState, opts?: pulumi.CustomResourceOptions) {
pulumi.log.warn("NetworkLb is deprecated: incus.index/networklb.NetworkLb has been deprecated in favor of incus.index/networkloadbalancer.NetworkLoadBalancer")
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as NetworkLbState | undefined;
resourceInputs["backends"] = state ? state.backends : undefined;
resourceInputs["config"] = state ? state.config : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["listenAddress"] = state ? state.listenAddress : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["ports"] = state ? state.ports : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["remote"] = state ? state.remote : undefined;
} else {
const args = argsOrState as NetworkLbArgs | undefined;
if ((!args || args.listenAddress === undefined) && !opts.urn) {
throw new Error("Missing required property 'listenAddress'");
}
if ((!args || args.network === undefined) && !opts.urn) {
throw new Error("Missing required property 'network'");
}
resourceInputs["backends"] = args ? args.backends : undefined;
resourceInputs["config"] = args ? args.config : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["listenAddress"] = args ? args.listenAddress : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["ports"] = args ? args.ports : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["remote"] = args ? args.remote : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkLb.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering NetworkLb resources.
*/
export interface NetworkLbState {
/**
* Network load balancer backend
*/
backends?: pulumi.Input<pulumi.Input<inputs.NetworkLbBackend>[]>;
config?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
description?: pulumi.Input<string>;
listenAddress?: pulumi.Input<string>;
network?: pulumi.Input<string>;
/**
* Network load balancer port
*/
ports?: pulumi.Input<pulumi.Input<inputs.NetworkLbPort>[]>;
project?: pulumi.Input<string>;
remote?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a NetworkLb resource.
*/
export interface NetworkLbArgs {
/**
* Network load balancer backend
*/
backends?: pulumi.Input<pulumi.Input<inputs.NetworkLbBackend>[]>;
config?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
description?: pulumi.Input<string>;
listenAddress: pulumi.Input<string>;
network: pulumi.Input<string>;
/**
* Network load balancer port
*/
ports?: pulumi.Input<pulumi.Input<inputs.NetworkLbPort>[]>;
project?: pulumi.Input<string>;
remote?: pulumi.Input<string>;
}

View File

@@ -88,8 +88,6 @@ export class NetworkLoadBalancer extends pulumi.CustomResource {
resourceInputs["remote"] = args ? args.remote : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "incus:index/networkLb:NetworkLb" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(NetworkLoadBalancer.__pulumiType, name, resourceInputs, opts);
}
}

View File

@@ -10,7 +10,6 @@
],
"homepage": "https://linuxcontainers.org",
"repository": "https://git.kalinow.ski/nimbus/pulumi-incus",
"license": "Apache-2.0",
"scripts": {
"build": "tsc"
},
@@ -24,6 +23,7 @@
"pulumi": {
"resource": true,
"name": "incus",
"version": "1.0.0-alpha.0+dev"
"version": "1.0.0-alpha.0+dev",
"server": "https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/${VERSION}/"
}
}

View File

@@ -29,7 +29,6 @@
"networkAcl.ts",
"networkForward.ts",
"networkIntegration.ts",
"networkLb.ts",
"networkLoadBalancer.ts",
"networkPeer.ts",
"networkZone.ts",

View File

@@ -272,44 +272,6 @@ export interface NetworkForwardPort {
targetPort: pulumi.Input<string>;
}
export interface NetworkLbBackend {
/**
* LB backend description
*/
description?: pulumi.Input<string>;
/**
* LB backend name
*/
name: pulumi.Input<string>;
/**
* LB backend target address
*/
targetAddress: pulumi.Input<string>;
/**
* LB backend target port
*/
targetPort?: pulumi.Input<string>;
}
export interface NetworkLbPort {
/**
* Port description
*/
description?: pulumi.Input<string>;
/**
* Port to listen to
*/
listenPort: pulumi.Input<string>;
/**
* Port protocol
*/
protocol?: pulumi.Input<string>;
/**
* List of target LB backends
*/
targetBackends: pulumi.Input<pulumi.Input<string>[]>;
}
export interface NetworkLoadBalancerBackend {
/**
* LB backend description

View File

@@ -255,44 +255,6 @@ export interface NetworkForwardPort {
targetPort: string;
}
export interface NetworkLbBackend {
/**
* LB backend description
*/
description: string;
/**
* LB backend name
*/
name: string;
/**
* LB backend target address
*/
targetAddress: string;
/**
* LB backend target port
*/
targetPort: string;
}
export interface NetworkLbPort {
/**
* Port description
*/
description: string;
/**
* Port to listen to
*/
listenPort: string;
/**
* Port protocol
*/
protocol: string;
/**
* List of target LB backends
*/
targetBackends: string[];
}
export interface NetworkLoadBalancerBackend {
/**
* LB backend description

View File

@@ -53,7 +53,7 @@ export function getVersion(): string {
/** @internal */
export function resourceOptsDefaults(): any {
return { version: getVersion() };
return { version: getVersion(), pluginDownloadURL: "https://git.kalinow.ski/api/packages/kiterun/generic/pulumi-incus/${VERSION}/" };
}
/** @internal */

11
secrets.sops.env Normal file
View File

@@ -0,0 +1,11 @@
TOKEN=ENC[AES256_GCM,data:FwfMjDDX5UIuhknAmY26yBzQ4fH/78zHxIGUHEzcFHp3pVszT5nTvg==,iv:UrWD+FKcMjhTZR1YJFuWZlEcZeb6vWRluRoOJ5FR/r8=,tag:IUS0I+oDnUHfLuTZ3kDx+g==,type:str]
sops_age__list_0__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpSHBkcHdRbldqQ3RtTU1u\nOWl3NHRWNGdhUUNNOHNKMEFEN0dRb0hDOEZrCjRtK0RNVTlZOVdrbmRveXJkK2pC\nRWJjaklsK05Lekw1N1dQMytsUjRzNm8KLS0tIEJIUGRidDV3TnJXYWN1bDJPeEdo\nMEJBQk1uZWdCRGdQVzZsb2djVExuRUkKC2B7t/nqbJ6rS5mjQpx0pvowWNgWEj/k\nRss+bOszGgaSqm/Az/CwHZUC42fTUiPPZWFL1fULu76vUmx8ZniCDA==\n-----END AGE ENCRYPTED FILE-----\n
sops_age__list_0__map_recipient=age1dp0cvjr6keqdrtl6yscr5n4fcmeqypq28qn5s2yzwp59uvuehs0qgw4ppz
sops_kms__list_0__map_arn=arn:aws:kms:us-east-1:299272328660:alias/nimbus-dev
sops_kms__list_0__map_aws_profile=
sops_kms__list_0__map_created_at=2025-04-25T18:17:17Z
sops_kms__list_0__map_enc=AQICAHhPWJ6j6KErQP+vs104s/spXKG2rFb34+ShXCwX3mES5gEvm/bCLqI9TndyLwwH/hdCAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMzmBxIsNyTFzUQbnZAgEQgDtdlFPQo+P07JJocwFC0Zqb10PE7iuLdhsfvTJl80oi1vpk6xWBANjZnOHepLAdMyOAkZ41biupUfhzCg==
sops_lastmodified=2025-04-25T18:17:55Z
sops_mac=ENC[AES256_GCM,data:7K6+Wa6GQW+w1EiinrKKUAR+eNbuGF/S4+qnC0iMvaHx3AaymNsbYH8ucqFfJrDlkU0AqLGgQZAoR8qRgaH7Jqflb+8dfZEeAkJdagtj4OXDZ6SaKSbM13QoYabiu3UF4X+EGuZ5vACk0k70uYF7F3BnmmClbiQ89MDML8IdMqE=,iv:fVy2xjEw+PZn+5KJ5f6R6el0WjrfruOmYCk+0UNaU3Y=,tag:elGmdkLxqSU5PKXLp9jMkg==,type:str]
sops_unencrypted_suffix=_unencrypted
sops_version=3.10.2