Skip to content

Commit

Permalink
chore(ci): generate examples with the pulumi installed by Make (#154)
Browse files Browse the repository at this point in the history
The tasks in the Makefile generally use a locally-installed copy of
`pulumi` instead of using whatever may be installed on the current
`$PATH`. The locally-installed copy is installed at `.pulumi/bin/pulumi`
within the working directory.

While investigating issues with the release job in #152, I found that
the example generation failed on my machine when using the `pulumi`
command, but worked properly when using `.pulumi/bin/pulumi`. This may
not solve the issues we're seeing with uncommitted changes in the
release job, but nonetheless seems like a good thing to do.

The `install_equinix_plugin` task is also updated to declare its
dependency on the locally-installed copy of `pulumi`.
  • Loading branch information
cprivitere authored Aug 20, 2024
2 parents dac04d6 + edb99ca commit 0fa07a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ help:
clean:
rm -rf sdk/{dotnet,nodejs,go,python,java}

install_equinix_plugin: only_provider uninstall_equinix_plugin
install_equinix_plugin: only_provider uninstall_equinix_plugin .pulumi/bin/pulumi
.pulumi/bin/pulumi plugin install resource equinix $(shell pulumictl get version --language generic) --file $(WORKING_DIR)/bin/$(PROVIDER)

uninstall_equinix_plugin:
uninstall_equinix_plugin: .pulumi/bin/pulumi
.pulumi/bin/pulumi plugin rm resource equinix -a -y

install_plugins: .pulumi/bin/pulumi
Expand Down
14 changes: 7 additions & 7 deletions scripts/generate_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ generate_pulumi_yaml() {

# Generate Pulumi template
echo -e "\033[0;34m CONVERTING $normalized_path"
pulumi convert --cwd "$resource_dir" --from terraform --language yaml --out $resource_dir --generate-only "${tf_files[0]}"
.pulumi/bin/pulumi convert --cwd "$resource_dir" --from terraform --language yaml --out $resource_dir --generate-only "${tf_files[0]}"
sed -i.bak $'1i\\\n# WARNING: This is an autogenerated file - manual changes will be overwritten if not made via ./scripts/generate_examples.sh\n' "$resource_dir/Pulumi.yaml"
rm "$tf_destination_file" "$resource_dir"/*.bak

Expand Down Expand Up @@ -180,7 +180,7 @@ generate_pulumi_yaml() {

# Execute the Terraform to YAML conversion
echo -e "\033[0;34m CONVERTING $normalized_path"
pulumi convert --cwd "$resource_dir" --from terraform --language yaml --out $resource_dir --generate-only $tf_file
.pulumi/bin/pulumi convert --cwd "$resource_dir" --from terraform --language yaml --out $resource_dir --generate-only $tf_file
sed -i.bak $'1i\\\n# WARNING: This is an autogenerated file - manual changes will be overwritten if not made via ./scripts/generate_examples.sh\n' "$resource_dir/Pulumi.yaml"
rm "$tf_destination_file" "$resource_dir"/*.bak

Expand Down Expand Up @@ -220,11 +220,11 @@ generate_examples_and_docs() {
OUTPUT_FILE="${OUTPUT_DIR}/${NORMALIZED_NAME}.examples.md"

# Convert Pulumi configurations to all languages
pulumi convert --cwd "$PULUMI_DIR" --language python --out python --generate-only || true
pulumi convert --cwd "$PULUMI_DIR" --language typescript --out typescript --generate-only || true
pulumi convert --cwd "$PULUMI_DIR" --language java --out java --generate-only || true
pulumi convert --cwd "$PULUMI_DIR" --language go --out go || true
pulumi convert --cwd "$PULUMI_DIR" --language csharp --out csharp --generate-only || true
.pulumi/bin/pulumi convert --cwd "$PULUMI_DIR" --language python --out python --generate-only || true
.pulumi/bin/pulumi convert --cwd "$PULUMI_DIR" --language typescript --out typescript --generate-only || true
.pulumi/bin/pulumi convert --cwd "$PULUMI_DIR" --language java --out java --generate-only || true
.pulumi/bin/pulumi convert --cwd "$PULUMI_DIR" --language go --out go || true
.pulumi/bin/pulumi convert --cwd "$PULUMI_DIR" --language csharp --out csharp --generate-only || true

# Fix version constraints
## csharp
Expand Down

0 comments on commit 0fa07a4

Please sign in to comment.