Skip to content

Commit

Permalink
More generated workflows & related files from pulumi/ci-mgmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ringods committed Oct 2, 2024
1 parent 687dedc commit 4046577
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 114 deletions.
1 change: 1 addition & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
template: external-bridged-provider
provider: acme
organization: pulumiverse
major-version: 0
Expand Down
78 changes: 12 additions & 66 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,66 +1,12 @@
ARG UBUNTU_VERSION=latest
FROM ubuntu:${UBUNTU_VERSION}

# 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
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

# 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

ENV PATH=$PATH:$GOPATH/bin

# Install pulumictl
ARG PULUMICTL_VERSION=v0.0.32
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

# 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} && \
mv /usr/local/${NODEJS_PKG} /usr/local/node

ENV PATH=$PATH:/usr/local/node/bin

# Install yarn
RUN npm install --global yarn

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

# https://stackoverflow.com/questions/73753672/a-fatal-error-occurred-the-folder-usr-share-dotnet-host-fxr-does-not-exist
RUN apt-get remove dotnet* && \
apt-get remove aspnetcore* && \
apt-get remove netstandard&

RUN apt-get update && \
apt-get install dotnet-sdk-6.0 -y

# Install Pulumi
RUN curl -fsSL https://get.pulumi.com | sh
ENV PATH=$PATH:/root/.pulumi/bin
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
22 changes: 15 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.3/containers/hugo
{
"name": "TFProvider",
"build": {
"dockerfile": "Dockerfile"
}
{
"name": "Devbox Remote Container",
"build": {
"dockerfile": "./Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"jetpack-io.devbox"
]
}
},
"remoteUser": "devbox"
}
39 changes: 36 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,41 @@ jobs:
uses: ./.github/workflows/license.yml
secrets: inherit

publish:
name: publish
needs:
- prerequisites
- build_provider
- test
- license_check
uses: ./.github/workflows/publish.yml
secrets: inherit
with:
version: ${{ needs.prerequisites.outputs.version }}
isPrerelease: true
skipGoSdk: true

tag_release_if_labeled_needs_release:
name: Tag release if labeled as needs-release
needs: publish
runs-on: ubuntu-latest
steps:
- name: check if this commit needs release
if: ${{ env.RELEASE_BOT_ENDPOINT != '' }}
uses: pulumi/action-release-by-pr-label@main
with:
command: "release-if-needed"
repo: ${{ github.repository }}
commit: ${{ github.sha }}
slack_channel: ${{ secrets.RELEASE_OPS_SLACK_CHANNEL }}
env:
RELEASE_BOT_ENDPOINT: ${{ secrets.RELEASE_BOT_ENDPOINT }}
RELEASE_BOT_KEY: ${{ secrets.RELEASE_BOT_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
name: test
needs:
needs:
- prerequisites
- build_sdk
permissions:
Expand All @@ -108,8 +140,9 @@ jobs:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Download bin
uses: ./.github/actions/download-bin
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Add NuGet source
if: matrix.language == 'dotnet'
run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
Expand All @@ -129,7 +162,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
run: cd examples && go test -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4
strategy:
fail-fast: false
matrix:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ jobs:
go/**
!*.tar.gz
clean_up_release_labels:
name: Clean up release labels
# Only run for non-prerelease, if the publish_go_sdk job was successful or skipped
if: inputs.isPrerelease == false

needs: publish_sdk
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Clean up release labels
uses: pulumi/action-release-by-pr-label@main
with:
command: "clean-up-release-labels"
repo: ${{ github.repository }}
commit: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

verify_release:
name: verify_release
needs: publish_sdk
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,17 @@ jobs:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Download bin
uses: ./.github/actions/download-bin
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Add NuGet source
if: matrix.language == 'dotnet'
run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
if: matrix.language == 'python'
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
Expand All @@ -108,7 +111,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
run: cd examples && go test -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 .
strategy:
fail-fast: false
matrix:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/verify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
description: "Enable the MacOS runner in addition to Linux and Windows. Defaults to 'false'."
required: false
type: boolean
skipGoSdk:
description: "Skip the Go SDK verification. Defaults to 'false'. Enable this when verifying a pre-release for which we don't publish the Go SDK (for PRs and the default branch)."
required: false
type: boolean
default: false
workflow_call:
inputs:
providerVersion:
Expand Down Expand Up @@ -68,4 +73,4 @@ jobs:
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumicli, go, node, dotnet, python, java
tools: pulumicli, dotnet, go, nodejs, python
8 changes: 5 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ linters:
- govet
- ineffassign
- lll
- megacheck
- gosimple
- staticcheck
- misspell
- nakedret
- revive
- unconvert
- unused
enable-all: false
run:
skip-files:
issues:
exclude-files:
- schema.go
- pulumiManifest.go
run:
timeout: 20m
linters-settings:
gci:
Expand Down
28 changes: 0 additions & 28 deletions .goreleaser.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ install_plugins: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
install_plugins: .pulumi/bin/pulumi

lint_provider: provider
cd provider && golangci-lint run -c ../.golangci.yml
cd provider && golangci-lint run --path-prefix provider -c ../.golangci.yml

# `lint_provider.fix` is a utility target meant to be run manually
# that will run the linter and fix errors when possible.
lint_provider.fix:
cd provider && golangci-lint run -c ../.golangci.yml --fix
cd provider && golangci-lint run --path-prefix provider -c ../.golangci.yml --fix

# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-acme/schema.json` is valid and up to date.
Expand Down Expand Up @@ -174,11 +174,11 @@ bin/pulumi-java-gen: .pulumi-java-gen.version
# - Run make ci-mgmt to apply the change locally.
#
ci-mgmt: .ci-mgmt.yaml
rm -f .github/workflows/*.yml # Copied from update-workflows.yml
find .github/workflows/*.yml -type f ! -name "$(PACK)*.yml" -delete
go run github.com/pulumi/ci-mgmt/provider-ci@master generate \
--name $(ORG)/pulumi-$(PACK) \
--out . \
--template bridged-provider \
--template external-bridged-provider \
--config $<

# Because some codegen depends on the version of the CLI used, we install a local CLI
Expand Down
22 changes: 22 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"packages": [
"yarn@latest",
"pulumictl@latest",
"[email protected].",
"nodejs@20.",
"[email protected]",
"[email protected].",
"[email protected]",
"curl@8"
],
"shell": {
"init_hook": [
"export PATH=\"$(pwd)/bin/:$PATH\""
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
1 change: 1 addition & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 4046577

Please sign in to comment.