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

resync pulumi-tf-bridge to latest #58

Merged
merged 3 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# REQUIRED: provider is the name of the provider without the pulumi-prefix e.g. "aws".
provider: koyeb

# The name of the GitHub organization or username the repository lives in. Defaults to 'pulumi'
organization: koyeb

# The external template only includes workflows relevant for non-Pulumi managed providers.
template: external-bridged-provider

# The name of the GitHub organisation or username where the upstream terraform provider lives.
upstreamProviderOrg: pulumi

# major version of the current provider - used in make files
# This should always be set by all providers as this is key to go module paths.
major-version: 1

# Enable using the terraform converter for example generation.
pulumiConvert: 1

# Set a GitHub username here for automatic upgrade PRs to be assigned to.
# pr-assign: pulumi-bot

# List of pulumi plugins to install in the "install_plugins" makefile target. Will include at least the terraform plugin
# Should be set for all bridged providers
plugins:
- name: terraform
version: "1.0.16"
kind: converter

# providerDefaultBranch is used to customise the default branch for the repo
providerDefaultBranch: main

# Explicit list of languages to support for SDKs. Java is currently excluded because it doesn't yet work well for non-internal providers.
languages:
- dotnet
- go
- nodejs
- python

# Disable Java publishing and pushing the provider binary to the CDN as these only work internally within Pulumi.
publish:
sdk: "all,!java"
cdn: false

# Enables automatic generation of basic docs pages for the registry.
# registryDocs: true

# Disables a pulumi-internal-only step for running create_docs_build during the release
publishRegistry: false

# Disables the pulumi-internal mechanism for auto-releasing after merging PRs with special labels.
enableAutoRelease: false

# For additional options, please refer to the defaults set in ci-mgmt:
# https://github.com/pulumi/ci-mgmt/blob/master/provider-ci/internal/pkg/templates/defaults.config.yaml
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM jetpackio/devbox:latest

# Installing your devbox project
WORKDIR /code
COPY devbox.json devbox.json
COPY devbox.lock devbox.lock
RUN sudo chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /code


RUN devbox run -- echo "Installed Packages."

RUN devbox shellenv --init-hook >> ~/.profile
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Devbox Remote Container",
"build": {
"dockerfile": "./Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"jetpack-io.devbox"
]
}
},
"remoteUser": "devbox"
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdk/**/* linguist-generated=true
16 changes: 16 additions & 0 deletions .github/actions/download-bin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Download binary assets
description: Downloads the provider and tfgen binaries to `bin/`.

runs:
using: "composite"
steps:
- name: Download provider + tfgen binaries
uses: actions/download-artifact@v4
with:
name: koyeb-provider.tar.gz
path: ${{ github.workspace }}/bin
- name: Untar provider binaries
shell: bash
run: |
tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace}}/bin
find ${{ github.workspace }} -name "pulumi-*-koyeb" -print -exec chmod +x {} \;
19 changes: 19 additions & 0 deletions .github/actions/download-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Download SDK asset
description: Restores the SDK asset for a language.

inputs:
language:
required: true
description: One of nodejs, python, dotnet, go, java

runs:
using: "composite"
steps:
- name: Download ${{ inputs.language }} SDK
uses: actions/download-artifact@v4
with:
name: ${{ inputs.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress SDK folder
shell: bash
run: tar -zxf ${{ github.workspace }}/sdk/${{ inputs.language }}.tar.gz -C ${{ github.workspace }}/sdk/${{ inputs.language }}
81 changes: 81 additions & 0 deletions .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Setup tools
description: Installs Go, Pulumi, pulumictl, schema-tools, Node.JS, Python, dotnet and Java.

inputs:
tools:
description: |
Comma separated list of tools to install. The default of "all" installs all tools. Available tools are:
go
pulumicli
pulumictl
schema-tools
nodejs
python
dotnet
java
default: all

runs:
using: "composite"
steps:
- name: Install Go
if: inputs.tools == 'all' || contains(inputs.tools, 'go')
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
cache-dependency-path: |
provider/*.sum
upstream/*.sum
sdk/*.sum

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
tag: v0.0.46
repo: pulumi/pulumictl

- name: Install Pulumi CLI
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumicli')
uses: pulumi/actions@v5
with:
pulumi-version: "dev"

- name: Install Schema Tools
if: inputs.tools == 'all' || contains(inputs.tools, 'schema-tools')
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: pulumi/schema-tools

- name: Setup Node
if: inputs.tools == 'all' || contains(inputs.tools, 'nodejs')
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org

- name: Setup DotNet
if: inputs.tools == 'all' || contains(inputs.tools, 'dotnet')
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Setup Python
if: inputs.tools == 'all' || contains(inputs.tools, 'python')
uses: actions/setup-python@v5
with:
python-version: 3.11.8

- name: Setup Java
if: inputs.tools == 'all' || contains(inputs.tools, 'java')
uses: actions/setup-java@v4
with:
cache: gradle
distribution: temurin
java-version: 11

- name: Setup Gradle
if: inputs.tools == 'all' || contains(inputs.tools, 'java')
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
15 changes: 15 additions & 0 deletions .github/actions/upload-bin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Upload bin assets
description: Uploads the provider and tfgen binaries to `bin/`.

runs:
using: "composite"
steps:
- name: Tar provider binaries
shell: bash
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace }}/bin/ pulumi-resource-koyeb pulumi-tfgen-koyeb
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: koyeb-provider.tar.gz
path: ${{ github.workspace }}/bin/provider.tar.gz
retention-days: 30
20 changes: 20 additions & 0 deletions .github/actions/upload-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Upload SDK asset
description: Upload the SDK for a specific language as an asset for the workflow.

inputs:
language:
required: true
description: One of nodejs, python, dotnet, go, java

runs:
using: "composite"
steps:
- name: Compress SDK folder
shell: bash
run: tar -zcf sdk/${{ inputs.language }}.tar.gz -C sdk/${{ inputs.language }} .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ inputs.language }}.tar.gz
retention-days: 30
17 changes: 0 additions & 17 deletions .github/dependabot.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/build_provider.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Build Provider"

on:
workflow_call:
inputs:
version:
required: true
type: string
description: Version of the provider to build

jobs:
build_provider:
name: Build ${{ matrix.platform.os }}-${{ matrix.platform.arch }}
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ inputs.version }}
strategy:
fail-fast: true
matrix:
platform:
- os: linux
arch: amd64
- os: linux
arch: arm64
- os: darwin
arch: amd64
- os: darwin
arch: arm64
- os: windows
arch: amd64
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, go
- name: Download schema-embed.json
uses: actions/download-artifact@v4
with:
# Use a pattern to avoid failing if the artifact doesn't exist
pattern: schema-embed.*
# Avoid creating directories for each artifact
merge-multiple: true
path: provider/cmd/pulumi-resource-koyeb/schema-embed.json
- name: Prepare for build
# This installs plugins and prepares upstream
run: make upstream
- name: Build & package provider
run: make provider_dist-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pulumi-resource-koyeb-v${{ inputs.version }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
path: bin/pulumi-resource-koyeb-v${{ inputs.version }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
retention-days: 30
76 changes: 76 additions & 0 deletions .github/workflows/build_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Build SDK"

on:
workflow_call:
inputs:
version:
required: true
type: string

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_API: https://api.pulumi-staging.io
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
PYPI_USERNAME: __token__
SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }}
SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
TF_APPEND_USER_AGENT: pulumi
PROVIDER_VERSION: ${{ inputs.version }}

jobs:
build_sdk:
name: build_sdk
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
language:
- dotnet
- go
- nodejs
- python
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cache examples generation
uses: actions/cache@v4
with:
path: |
.pulumi/examples-cache
key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }}
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Download bin
uses: ./.github/actions/download-bin
- name: Install plugins
run: make install_plugins
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/*.csproj
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Upload SDK
uses: ./.github/actions/upload-sdk
with:
language: ${{ matrix.language }}
Loading
Loading