diff --git a/.github/workflows/upgrade-provider.yml b/.github/workflows/upgrade-provider.yml index 5b7e6451..3aa09d1c 100644 --- a/.github/workflows/upgrade-provider.yml +++ b/.github/workflows/upgrade-provider.yml @@ -11,6 +11,12 @@ on: env: GH_TOKEN: ${{ secrets.EQUINIX_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Allow missing or extra mappings during TF provider + # upgrades. This allows automation to do its job so + # that human contributions can be narrowly focused on + # adding or removing resource mappings + PULUMI_SKIP_MISSING_MAPPING_ERROR: true + PULUMI_SKIP_EXTRA_MAPPING_ERROR: true jobs: upgrade_provider: name: upgrade-provider diff --git a/scripts/generate_examples.sh b/scripts/generate_examples.sh index aaac32d1..f82088fb 100755 --- a/scripts/generate_examples.sh +++ b/scripts/generate_examples.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -ex # List of terraform examples to exclude EXCLUDE_TF_EXAMPLES=( @@ -114,7 +114,7 @@ generate_pulumi_yaml() { # Generate Pulumi template echo -e "\033[0;34m CONVERTING $normalized_path" >&2 - .pulumi/bin/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]}" || continue 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 @@ -166,7 +166,7 @@ generate_pulumi_yaml() { # Execute the Terraform to YAML conversion echo -e "\033[0;34m CONVERTING $normalized_path" >&2 - .pulumi/bin/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 || continue 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 @@ -286,38 +286,39 @@ generate_examples_and_docs() { .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 - for file in "$PULUMI_DIR/csharp"/*.csproj; do - echo $file - sed -i.bak "s|$VERSION|(, 1.0.0)|g" "$file" - done - rm "$PULUMI_DIR"/csharp/*.csproj.bak - - ## java - sed -i.bak "s|$VERSION|(,1.0)|g" $PULUMI_DIR/java/pom.xml - rm "$PULUMI_DIR"/java/pom.xml.bak - ## python - sed -i.bak "s|$VERSION|<1.0.0|g" $PULUMI_DIR/python/requirements.txt - rm "$PULUMI_DIR"/python/requirements.txt.bak - ## typescript - sed -i.bak "s|$VERSION|<1.0.0|g" $PULUMI_DIR/typescript/package.json - rm "$PULUMI_DIR"/typescript/package.json.bak - ## go - sed -i.bak "s|github.com/equinix/pulumi-equinix/sdk [^ ]*|github.com/equinix/pulumi-equinix/sdk $GOLANG_VERSION|g" "$PULUMI_DIR/go/go.mod" - rm "$PULUMI_DIR"/go/go.sum "$PULUMI_DIR"/go/go.mod.bak - - # Read each source file - TS_SRC=$(cat "$PULUMI_DIR/typescript/index.ts") - PY_SRC=$(cat "$PULUMI_DIR/python/__main__.py") - GO_SRC=$(cat "$PULUMI_DIR/go/main.go") - CS_SRC=$(cat "$PULUMI_DIR/csharp/Program.cs") - JAVA_SRC=$(cat "$PULUMI_DIR/java/src/main/java/generated_program/App.java") - # Skip first 3 lines of Pulumi.yaml from the specified directory - YAML_SRC=$(tail -n +4 "$PULUMI_DIR/Pulumi.yaml") - - # Generate the markdown in the desired format - OUTPUT=$(cat </dev/null)" ]; then + # Fix version constraints + ## csharp + for file in "$PULUMI_DIR/csharp"/*.csproj; do + echo $file + sed -i.bak "s|$VERSION|(, 1.0.0)|g" "$file" + done + rm "$PULUMI_DIR"/csharp/*.csproj.bak + + ## java + sed -i.bak "s|$VERSION|(,1.0)|g" $PULUMI_DIR/java/pom.xml + rm "$PULUMI_DIR"/java/pom.xml.bak + ## python + sed -i.bak "s|$VERSION|<1.0.0|g" $PULUMI_DIR/python/requirements.txt + rm "$PULUMI_DIR"/python/requirements.txt.bak + ## typescript + sed -i.bak "s|$VERSION|<1.0.0|g" $PULUMI_DIR/typescript/package.json + rm "$PULUMI_DIR"/typescript/package.json.bak + ## go + sed -i.bak "s|github.com/equinix/pulumi-equinix/sdk [^ ]*|github.com/equinix/pulumi-equinix/sdk $GOLANG_VERSION|g" "$PULUMI_DIR/go/go.mod" + rm "$PULUMI_DIR"/go/go.sum "$PULUMI_DIR"/go/go.mod.bak + + # Read each source file + TS_SRC=$(cat "$PULUMI_DIR/typescript/index.ts") + PY_SRC=$(cat "$PULUMI_DIR/python/__main__.py") + GO_SRC=$(cat "$PULUMI_DIR/go/main.go") + CS_SRC=$(cat "$PULUMI_DIR/csharp/Program.cs") + JAVA_SRC=$(cat "$PULUMI_DIR/java/src/main/java/generated_program/App.java") + # Skip first 3 lines of Pulumi.yaml from the specified directory + YAML_SRC=$(tail -n +4 "$PULUMI_DIR/Pulumi.yaml") + + # Generate the markdown in the desired format + OUTPUT=$(cat < "$OUTPUT_FILE" + # Write out to the generated output file in docs directory + echo "$OUTPUT" > "$OUTPUT_FILE" - echo "Output file generated: $OUTPUT_FILE" >&2 + echo "Output file generated: $OUTPUT_FILE" >&2 + fi done }