Skip to content

Commit

Permalink
chore: minor changes to sync-crds
Browse files Browse the repository at this point in the history
  • Loading branch information
limwa committed Jul 17, 2024
1 parent fe0d8ae commit 2e6bcdf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
1 change: 0 additions & 1 deletion services/pulumi/.npmrc

This file was deleted.

2 changes: 2 additions & 0 deletions services/pulumi/niployments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"lint:fix": "eslint --fix .",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write .",
"build": "tsc",
"build:watch": "tsc --watch",
"check": "pnpm run lint && pnpm run prettier"
},
"devDependencies": {
Expand Down
26 changes: 20 additions & 6 deletions services/pulumi/sync-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function ensure_yq {

ensure_installed helm
ensure_installed crd2pulumi
ensure_installed pnpm
ensure_yq

function download_crds_from_helm {
Expand Down Expand Up @@ -141,18 +142,31 @@ function patch_crds_package() {

function build_crds_package() {
local crds_package=$1
pnpm install -C "$crds_package" --use-stderr
pnpm run -C "$crds_package" build
pnpm install --use-stderr
pnpm run -C "$crds_package" build > /dev/null
}

rm -rf crds/

SPEC_FILE="crds.yaml"
CRDS_PROJECT_DIR="crds/nodejs/"

# 1. Add helm repositories
echo
add_repositories "$SPEC_FILE"
crd_paths="$(download_crds "$SPEC_FILE" "crds/.tmp/")"

# 2. Download CRDs from sources
echo
crd_paths="$(download_crds "$SPEC_FILE" "$(dirname "$CRDS_PROJECT_DIR")/.tmp/")"

# 3. Generate Pulumi CRDs package
echo
crd2pulumi -n ${crd_paths[@]}
patch_crds_package "crds/nodejs/"
build_crds_package "crds/nodejs/"

echo "CRDs synced successfully"
# 4. Patch and build Pulumi CRDs package
echo
patch_crds_package "$CRDS_PROJECT_DIR"
build_crds_package "$CRDS_PROJECT_DIR"

echo
echo "CRDs synced successfully."

0 comments on commit 2e6bcdf

Please sign in to comment.