Skip to content

Commit

Permalink
Merge pull request #37 from pulumiverse/feat/time-sleep-upgrade
Browse files Browse the repository at this point in the history
feat: Add `time_sleep` resource and upgrade terraform provider version
  • Loading branch information
tmeckel authored Oct 10, 2023
2 parents 7abbc97 + 45a5e51 commit 089d730
Show file tree
Hide file tree
Showing 41 changed files with 2,689 additions and 1,111 deletions.
56 changes: 22 additions & 34 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,32 @@
ARG UBUNTU_VERSION=latest
FROM ubuntu:${UBUNTU_VERSION}
ARG GO_VERSION=1.20.4
FROM golang:${GO_VERSION}-bullseye

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Update apt-get and install various needed utilities
RUN apt-get update && \
apt-get install -y curl && \
apt-get install -y wget && \
apt-get install -y xz-utils && \
apt-get install -y make && \
apt-get install -y gcc && \
apt-get install -y git

# Install bridged provider prerequisites
# See README.md

# Install go
ARG GO_VERSION=1.20.4
RUN rm -rf /usr/local/go && \
wget -O ${GO_VERSION}.tar.gz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf ${GO_VERSION}.tar.gz && \
rm ${GO_VERSION}.tar.gz

ENV GOPATH=/root/go
ENV PATH=$PATH:/usr/local/go/bin
apt-get install -y --no-install-recommends curl xz-utils make git

# Install go linter
RUN mkdir -p $GOPATH/bin && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.46.2
ARG GOLANGCI_LINT_VERSION=v1.54.2
RUN mkdir -p "$GOPATH/bin" && \
curl -sSfL 'https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh' | sh -s -- -b "$GOPATH/bin" ${GOLANGCI_LINT_VERSION}

ENV PATH=$PATH:$GOPATH/bin

# Install pulumictl
ARG PULUMICTL_VERSION=v0.0.42
ARG PULUMICTL_VERSION=v0.0.44
RUN rm -rf /usr/local/bin/pulumictl && \
wget -O pulumictl.${PULUMICTL_VERSION}.tar.gz https://github.com/pulumi/pulumictl/releases/download/${PULUMICTL_VERSION}/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz && \
tar -C /usr/local/bin -xzf pulumictl.${PULUMICTL_VERSION}.tar.gz
curl -fsSL "https://github.com/pulumi/pulumictl/releases/download/${PULUMICTL_VERSION}/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz" | \
tar -C /usr/local/bin -xzf -

# Install nodejs
ARG NODEJS_VERSION=v16.16.0
ARG NODEJS_PKG=node-${NODEJS_VERSION}-linux-x64
ARG NODEJS_TARBALL=${NODEJS_PKG}.tar.xz
RUN rm -rf /usr/local/node && \
wget -O ${NODEJS_TARBALL} https://nodejs.org/dist/${NODEJS_VERSION}/${NODEJS_TARBALL} && \
tar -C /usr/local -xf ${NODEJS_TARBALL} && \
curl -sSfL "https://nodejs.org/dist/${NODEJS_VERSION}/${NODEJS_TARBALL}" | \
tar -C /usr/local -xJf - && \
mv /usr/local/${NODEJS_PKG} /usr/local/node

ENV PATH=$PATH:/usr/local/node/bin
Expand All @@ -50,19 +35,22 @@ ENV PATH=$PATH:/usr/local/node/bin
RUN npm install --global yarn

# Install python and related items
RUN apt-get install -y python3 && \
apt-get install -y python3-setuptools
RUN apt-get install -y --no-install-recommends python3 python3-setuptools

# Install .NET
RUN wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
RUN source /etc/os-release && \
curl "https://packages.microsoft.com/config/${ID}/${VERSION_ID}/packages-microsoft-prod.deb" --output packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb

RUN apt-get update && \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0
apt-get install -y --no-install-recommends apt-transport-https dotnet-sdk-6.0

ENV DOTNET_CLI_TELEMETRY_OPTOUT=1

# Install Pulumi
RUN curl -fsSL https://get.pulumi.com | sh
ENV PATH=$PATH:/root/.pulumi/bin

RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PROVIDER_PATH := provider
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version

JAVA_GEN := pulumi-java-gen
JAVA_GEN_VERSION := v0.9.1
JAVA_GEN_VERSION := v0.9.8
TFGEN := pulumi-tfgen-time
PROVIDER := pulumi-resource-time
VERSION := $(shell pulumictl get version)
Expand Down Expand Up @@ -51,15 +51,14 @@ tfgen:: install_plugins
provider:: tfgen install_plugins # build the provider binary
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER})

build_sdks:: install_plugins provider build_nodejs build_python build_go build_dotnet build_java # build all the sdks
build_sdks:: install_plugins provider build_nodejs build_python build_go build_dotnet # build all the sdks

build_nodejs:: VERSION := $(shell pulumictl get version --language javascript)
build_nodejs:: install_plugins tfgen # build the node sdk
$(WORKING_DIR)/bin/$(TFGEN) nodejs --overlays provider/overlays/nodejs --out sdk/nodejs/
cd sdk/nodejs/ && \
yarn install && \
yarn run tsc && \
cp -R scripts/ bin && \
cp ../../README.md ../../LICENSE package.json yarn.lock ./bin/ && \
sed -i.bak -e "s/\$${VERSION}/$(VERSION)/g" ./bin/package.json

Expand All @@ -84,6 +83,8 @@ build_dotnet:: install_plugins tfgen # build the dotnet sdk

build_go:: install_plugins tfgen # build the go sdk
$(WORKING_DIR)/bin/$(TFGEN) go --overlays provider/overlays/go --out sdk/go/
cd sdk/go/ && \
go mod tidy

build_java:: PACKAGE_VERSION := $(shell pulumictl get version --language generic)
build_java:: $(WORKING_DIR)/bin/$(JAVA_GEN)
Expand All @@ -108,12 +109,18 @@ help::
expand -t20

clean::
rm -rf sdk/{dotnet,nodejs,go,python,java}
rm -rf sdk/{dotnet,nodejs,go,python,java} sdk/go.sum

install_plugins::
.PHONY: fmt
fmt::
@echo "Fixing source code with gofmt..."
find . -name '*.go' | grep -v vendor | xargs gofmt -s -w

install_plugins:: validate_go_version
[ -x $(shell which pulumi) ] || curl -fsSL https://get.pulumi.com | sh
pulumi plugin install resource random 4.3.1
pulumi plugin install resource random
pulumi plugin install resource aws
pulumi plugin install resource null

install_dotnet_sdk::
mkdir -p $(WORKING_DIR)/nuget
Expand Down
Loading

0 comments on commit 089d730

Please sign in to comment.