-
Notifications
You must be signed in to change notification settings - Fork 2
CDI-180: Implement Code Generation for PingFederate Resource Export #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
15abe57
Use code generation for pingfederate_authentication_api_application r…
erikostien-pingidentity 82127c7
Use code generation for pingfederate_authentication_api_settings reso…
erikostien-pingidentity 7c2d4b9
Update pingfederate_authentication_policies_fragment, pingfederate_au…
erikostien-pingidentity e2573de
Update pingfederate_authentication_policy_contract to use code gen
erikostien-pingidentity 3af1599
Update pingfederate_authentication_selector to use code gen
erikostien-pingidentity e4dce0c
Update pingfederate_captcha_provider_settings to use code gen
erikostien-pingidentity 3a9fec0
Update pingfederate_captcha_provider to use code gen
erikostien-pingidentity 380ba68
Update pingfederate_certificate_ca to use code gen
erikostien-pingidentity 7fc8cad
Update pingfederate_certificates_revocation_ocsp_certificate to use c…
erikostien-pingidentity 5abfa5c
Update pingfederate_certificates_revocation_settings to use code gen
erikostien-pingidentity 24391be
Update pingfederate_cluster_settings to use code gen
erikostien-pingidentity f38f32f
Update pingfederate_configuration_encryption_keys_rotate to use code gen
erikostien-pingidentity b3fea4a
Update pingfederate_data_store to use code gen
erikostien-pingidentity fcea5fc
Code Generate All PingFederate Resource Export Logic and Testing
erikostien-pingidentity 6190bba
Update all unit tests for PingFederate export
erikostien-pingidentity c10612c
First steps of testable resources
erikostien-pingidentity 3c5ef7f
Merge branch 'main' into PDI-2063
erikostien-pingidentity 7b5d99a
WIP independent developer resource export testing
erikostien-pingidentity dc975b8
WIP
erikostien-pingidentity 9845ac5
Merge branch 'main' into PDI-2063
erikostien-pingidentity d411b15
WIP
erikostien-pingidentity d8474d7
Lint fixes
erikostien-pingidentity 0bdd673
Lint fixes
erikostien-pingidentity 9ad1d52
WIP
erikostien-pingidentity 7e93381
WIP
erikostien-pingidentity 7889c04
Update Deps
erikostien-pingidentity 3c2d5bd
WIP
erikostien-pingidentity 07f8878
Add integration tests back
erikostien-pingidentity c353c4f
Don't change goreleaser
erikostien-pingidentity 2da6961
Do not replace patrickcping/pingone-go-sdk-v2/management in go.mod
erikostien-pingidentity 369c59e
Update github actions env vars
erikostien-pingidentity 6112bc9
PR review changes
erikostien-pingidentity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,177 @@ | ||
| SHELL := /bin/bash | ||
|
|
||
| .PHONY: install fmt vet test devchecknotest devcheck importfmtlint | ||
| .PHONY: install fmt vet test devchecknotest devcheck importfmtlint golangcilint starttestcontainer removetestcontainer spincontainer openlocalwebapi openapp | ||
|
|
||
| default: install | ||
|
|
||
| install: | ||
| go mod tidy | ||
| go install . | ||
| @echo -n "Running 'go mod tidy' to ensure all dependencies are up to date..." | ||
| @if go mod tidy; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| @echo -n "Running 'go install' to install pingcli..." | ||
| @if go install .; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| fmt: | ||
| go fmt ./... | ||
| @echo -n "Running 'go fmt' to format the code..." | ||
| @if go fmt ./...; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| vet: | ||
| go vet ./... | ||
| @echo -n "Running 'go vet' to check for potential issues..." | ||
| @if go vet ./...; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| test: --test-cmd --test-internal-commands --test-internal-configuration --test-internal-connector --test-internal-customtypes --test-internal-input --test-internal-profiles | ||
|
|
||
| --test-cmd: | ||
| @echo "Running tests for cmd..." | ||
| @go test -count=1 ./cmd/... | ||
|
|
||
| --test-internal-commands: | ||
| @echo "Running tests for internal/commands..." | ||
| @go test -count=1 ./internal/commands/... | ||
|
|
||
| --test-internal-configuration: | ||
| @echo "Running tests for internal/configuration..." | ||
| @go test -count=1 ./internal/configuration/... | ||
|
|
||
| --test-internal-connector: | ||
| @echo "Running tests for internal/connector..." | ||
|
|
||
| @# Test each connector package separately to avoid configuration collision | ||
| @go test -count=1 ./internal/connector | ||
|
|
||
| @# Test the resources within each connector first | ||
| @go test -count=1 ./internal/connector/pingfederate/resources | ||
| @go test -count=1 ./internal/connector/pingone/.../resources | ||
|
|
||
| test: | ||
| go test -parallel=4 -count=1 ./... | ||
| @# Test the connectors itegration terraform plan tests | ||
| @go test -count=1 ./internal/connector/pingfederate | ||
| @go test -count=1 ./internal/connector/pingone/*/ | ||
|
|
||
| --test-internal-customtypes: | ||
| @echo "Running tests for internal/customtypes..." | ||
| @go test -count=1 ./internal/customtypes/... | ||
|
|
||
| --test-internal-input: | ||
| @echo "Running tests for internal/input..." | ||
| @go test -count=1 ./internal/input/... | ||
|
|
||
| --test-internal-profiles: | ||
| @echo "Running tests for internal/profiles..." | ||
| @go test -count=1 ./internal/profiles/... | ||
|
|
||
| devchecknotest: install importfmtlint fmt vet golangcilint | ||
|
|
||
| devcheck: devchecknotest spincontainer test removetestcontainer | ||
|
|
||
| importfmtlint: | ||
| impi --local . --scheme stdThirdPartyLocal ./... | ||
| @echo -n "Running 'impi' to format import ordering..." | ||
| @if impi --local . --scheme stdThirdPartyLocal ./...; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| golangcilint: | ||
| golangci-lint run --timeout 5m ./... | ||
| @echo -n "Running 'golangci-lint' to check for code quality issues..." | ||
| @# Clear the cache for every run, so that the linter outputs the same results as the GH Actions workflow | ||
| @if golangci-lint cache clear && golangci-lint run --timeout 5m ./...; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| starttestcontainer: --checkneededpfenvvars --checkdocker --dockerrunpf --waitforpfhealthy | ||
|
|
||
| starttestcontainer: | ||
| docker run --name pingfederate_terraform_provider_container \ | ||
| --checkneededpfenvvars: | ||
| @echo -n "Checking for required environment variables to run PingFederate container..." | ||
| @test -n "$$PING_IDENTITY_DEVOPS_USER" || { echo " FAILED"; echo "PING_IDENTITY_DEVOPS_USER environment variable is not set.\n\nNot Registered? Register for the DevOps Program at https://devops.pingidentity.com/how-to/devopsRegistration/."; exit 1; } | ||
| @test -n "$$PING_IDENTITY_DEVOPS_KEY" || { echo " FAILED"; echo "PING_IDENTITY_DEVOPS_KEY environment variable is not set.\n\nNot Registered? Register for the DevOps Program at https://devops.pingidentity.com/how-to/devopsRegistration/."; exit 1; } | ||
| @test "YES" = "$$PING_IDENTITY_ACCEPT_EULA" || { echo " FAILED"; echo "You must accept the EULA to use the PingFederate container. Set PING_IDENTITY_ACCEPT_EULA=YES to continue."; exit 1; } | ||
| @echo " SUCCESS" | ||
|
|
||
| --checkdocker: | ||
| @echo -n "Checking if Docker is running..." | ||
| @docker info > /dev/null 2>&1 || { echo " FAILED"; echo "Docker is not running. Please start Docker and try again."; exit 1; } | ||
| @echo " SUCCESS" | ||
|
|
||
| --dockerrunpf: | ||
| @echo -n "Starting the PingFederate container..." | ||
| @docker run --name pingcli_test_pingfederate_container \ | ||
| -d -p 9031:9031 \ | ||
| -p 9999:9999 \ | ||
| --env-file "${HOME}/.pingidentity/config" \ | ||
| -v $$(pwd)/server-profiles/shared-profile:/opt/in \ | ||
| -v $$(pwd)/server-profiles/12.2/data.json:/opt/in/instance/bulk-config/data.json \ | ||
| pingidentity/pingfederate:12.2.0-latest | ||
| # Wait for the instance to become ready | ||
| sleep 1 | ||
| duration=0 | ||
| while (( duration < 240 )) && ! docker logs pingfederate_terraform_provider_container 2>&1 | grep -q "Removing Imported Bulk File\|CONTAINER FAILURE"; \ | ||
| do \ | ||
| duration=$$((duration+1)); \ | ||
| --env PING_IDENTITY_DEVOPS_USER="$${PING_IDENTITY_DEVOPS_USER}" \ | ||
| --env PING_IDENTITY_DEVOPS_KEY="$${PING_IDENTITY_DEVOPS_KEY}" \ | ||
| --env PING_IDENTITY_ACCEPT_EULA="$${PING_IDENTITY_ACCEPT_EULA}" \ | ||
| --env CREATE_INITIAL_ADMIN_USER="true" \ | ||
| -v $$(pwd)/internal/testing/pingfederate_container_files/deploy:/opt/in/instance/server/default/deploy \ | ||
| pingidentity/pingfederate:latest > /dev/null 2>&1 || { echo " FAILED"; echo "Failed to start the PingFederate container. Please check your Docker setup."; exit 1; } | ||
| @echo " SUCCESS" | ||
|
|
||
| --waitforpfhealthy: | ||
| @echo -n "Waiting for the PingFederate container to become healthy..." | ||
| @timeout=240; \ | ||
| while test $$timeout -gt 0; do \ | ||
| status=$$(docker inspect --format='{{json .State.Health.Status}}' pingcli_test_pingfederate_container 2>/dev/null || echo ""); \ | ||
| if test "$$status" = '"healthy"'; then \ | ||
| echo " SUCCESS"; \ | ||
| exit 0; \ | ||
| fi; \ | ||
| sleep 1; \ | ||
| done | ||
| # Fail if the container didn't become ready in time | ||
| docker logs pingfederate_terraform_provider_container 2>&1 | grep -q "Removing Imported Bulk File" || \ | ||
| { echo "PingFederate container did not become ready in time or contains errors. Logs:"; docker logs pingfederate_terraform_provider_container; exit 1; } | ||
| timeout=$$((timeout - 1)); \ | ||
| done; \ | ||
| echo " FAILED"; \ | ||
| echo "PingFederate container did not become healthy within the timeout period."; \ | ||
| echo "Current status: $$status"; \ | ||
| docker logs pingcli_test_pingfederate_container || echo "No logs available."; \ | ||
| exit 1 | ||
|
|
||
| removetestcontainer: | ||
| docker rm -f pingfederate_terraform_provider_container | ||
| removetestcontainer: --checkdocker | ||
| @echo -n "Stopping and removing the PingFederate container..." | ||
| @if docker rm -f pingcli_test_pingfederate_container > /dev/null 2>&1; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| spincontainer: removetestcontainer starttestcontainer | ||
|
|
||
| openlocalwebapi: | ||
| open "https://localhost:9999/pf-admin-api/api-docs/#/" | ||
| @echo -n "Opening the PingFederate Admin API documentation in the default web browser..." | ||
| @if open "https://localhost:9999/pf-admin-api/api-docs/#/"; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| openapp: | ||
| open "https://localhost:9999/pingfederate/app" | ||
| @echo -n "Opening the PingFederate Admin Console in the default web browser..." | ||
| @if open "https://localhost:9999/pingfederate/app"; then \ | ||
| echo " SUCCESS"; \ | ||
| else \ | ||
| echo " FAILED"; \ | ||
| exit 1; \ | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.