Skip to content

Commit

Permalink
Replace provider-ci with package-ci
Browse files Browse the repository at this point in the history
This commit deletes the provider CI folder and replaces it with
package-ci, applying #446, updating the Makefile to conform to the same interface.

Two shared TypeScript files are moved to native-provider-ci:
* provider-ci/src/shared-workflows.ts
* provider-ci/src/action-versions.ts
  • Loading branch information
AaronFriel committed Jun 8, 2023
1 parent 1cb869d commit 5718fcc
Show file tree
Hide file tree
Showing 71 changed files with 39 additions and 11,411 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pulumi providers use [GitHub Actions](https://docs.github.com/en/actions) for CI

This repository has the following components:

- The `provider-ci` directory contains code to generate [GitHub Actions workflow files](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions) for Pulumi providers, as well as the generated output for each provider (retained for the purpose of convenient output diffing).
- The `provider-ci` and `native-provider-ci` directories contain code to generate [GitHub Actions workflow files](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions) for Pulumi providers, as well as the generated output for each provider (retained for the purpose of convenient output diffing).
- The `infra/providers/` directory contains a Pulumi program which uses the [Pulumi GitHub provider](https://www.pulumi.com/registry/packages/github/) to ensure consistent [branch protections](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches) across our provider repositories.

For an overview of how Pulumi programs work, see [the Pulumi docs](https://www.pulumi.com/docs/).
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion native-provider-ci/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "fs";
import * as path from "path";
import * as yaml from "yaml";
import z from "zod";
import * as shared from "../../provider-ci/src/shared-workflows";
import * as shared from "./shared-workflows";
import * as wf from "./workflows";
import * as goreleaser from "./goreleaser";
import { providersDir } from "../cmd/generate-providers";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion native-provider-ci/src/steps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as action from "../../provider-ci/src/action-versions";
import * as action from "./action-versions";
import { NormalJob } from "./github-workflow";

export type Step = Required<NormalJob>["steps"][0];
Expand Down
1 change: 0 additions & 1 deletion package-ci/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions package-ci/scripts/config.yaml

This file was deleted.

56 changes: 0 additions & 56 deletions package-ci/scripts/test.sh

This file was deleted.

20 changes: 0 additions & 20 deletions provider-ci/.eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions provider-ci/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/
57 changes: 25 additions & 32 deletions provider-ci/Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
NAME ?= all
PROVIDERS := $(patsubst %/, %, $(wildcard providers/*/))

all: ensure clean test format providers examples
all: ensure clean test format providers

gen: clean providers examples
gen: clean providers

node_modules:: package.json yarn.lock
yarn install
@touch node_modules
# Go build caching is fast enough to use that instead of Make to avoid rebuilds.
bin/package-ci:
go build -o bin/package-ci

config-schema.json:: node_modules cmd/generate-config-schema.ts src/*.ts
yarn gen-config-schema

schema:: config-schema.json

ensure:: node_modules config-schema.json
ensure:: bin/package-ci

clean:
rm -rf providers/*/repo
rm -rf platform/examples/repo

test:
yarn run lint
test:
golangci-lint run

format:
yarn run format

ifneq ($(NAME),all)
provider:: node_modules
echo $(NAME)
yarn run gen-providers -- --name $(NAME) --debug
else
providers:: node_modules
yarn run gen-providers
go fmt ./...

providers/%/repo: bin/package-ci
@echo Generating $*
@./bin/package-ci generate \
--name pulumi/pulumi-$* \
--out ./providers/$*/repo \
--template bridged-provider \
--config ./providers/$*/config.yaml

providers: $(addsuffix /repo, $(PROVIDERS))
ifeq ($(NAME), all)
provider: providers
else
provider: provider/$(NAME)/repo
endif

# Generate the GitHub Actions for the examples repo
# It will generate the files to a platform directory and then examples directory
examples:: node_modules
yarn run gen-examples

discovery:: node_modules
yarn run discovery
yarn run format

.PHONY: all ensure clean test format providers examples discovery providers/ec/repo
.PHONY: all gen ensure clean test format provider providers provider/%/repo bin/package-ci
7 changes: 0 additions & 7 deletions provider-ci/cmd/generate-config-schema.ts

This file was deleted.

51 changes: 0 additions & 51 deletions provider-ci/cmd/generate-examples.ts

This file was deleted.

89 changes: 0 additions & 89 deletions provider-ci/cmd/generate-providers.ts

This file was deleted.

24 changes: 8 additions & 16 deletions package-ci/cmd/generate.go → provider-ci/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ var generateCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
err := pkg.GeneratePackage(pkg.GenerateOpts{
RepositoryName: generateOpts.RepositoryName,
OutDir: generateOpts.OutDir,
TemplateName: generateOpts.TemplateName,
ConfigPath: generateOpts.ConfigPath,
OutDir: generateOpts.OutDir,
TemplateName: generateOpts.TemplateName,
ConfigPath: generateOpts.ConfigPath,
})
return err
},
Expand All @@ -29,22 +29,14 @@ func init() {
rootCmd.AddCommand(generateCmd)

generateCmd.Flags().StringVarP(&generateOpts.RepositoryName, "name", "n", "", "repository name to generate, e.g.: pulumi/pulumi-aws")
generateCmd.MarkFlagRequired("name")
_ = generateCmd.MarkFlagRequired("name")

generateCmd.Flags().StringVarP(&generateOpts.OutDir, "out", "o", ".", "directory to generate files to")
generateCmd.MarkFlagRequired("out")

/*
type GenerateOpts struct {
PackageName string // e.g.: pulumi-aws
OutDir string
TemplateName string // path inside templates, e.g.: bridged-provider
ConfigPath string // .yaml file containing template config
}
*/
_ = generateCmd.MarkFlagRequired("out")

generateCmd.Flags().StringVarP(&generateOpts.TemplateName, "template", "t", "", "template name to use, e.g.: bridged-provider")
generateCmd.MarkFlagRequired("template")
_ = generateCmd.MarkFlagRequired("template")

generateCmd.Flags().StringVarP(&generateOpts.ConfigPath, "config", "c", "", "config file to use, e.g.: config.yaml")
generateCmd.MarkFlagRequired("config")
_ = generateCmd.MarkFlagRequired("config")
}
Loading

0 comments on commit 5718fcc

Please sign in to comment.