From e1825d0daf415631c59fbfaa2052784b9f89b760 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Mon, 10 Jul 2017 13:39:51 -0700 Subject: [PATCH] Extremely 'minimal' support for bosh deployment manifest editing --- .../boot/java/BootJavaLanguageServer.java | 4 +- .../boot/BootPropertiesLanguageServer.java | 4 +- .../bosh/BoshDeploymentManifestSchema.java | 86 + .../ide/vscode/bosh/BoshLanguageServer.java | 84 + .../ide/vscode/{concourse => bosh}/Main.java | 8 +- .../ide/vscode/concourse/ASTTypeCache.java | 131 - .../concourse/ConcourseDefinitionFinder.java | 111 - .../ConcourseDocumentSymbolHandler.java | 95 - .../concourse/ConcourseLanguageServer.java | 179 - .../ide/vscode/concourse/ConcourseModel.java | 460 -- .../concourse/ConcourseValueParsers.java | 110 - .../vscode/concourse/PipelineYmlSchema.java | 724 --- .../concourse/PipelineYmlSchemaProblems.java | 20 - .../concourse/ResourceTypeRegistry.java | 93 - .../concourse/util/StaleFallbackCache.java | 135 - .../desc/AggregateStep/aggregate.html | 19 - .../desc/BoshDeploymentManifest/name.md | 1 + .../src/main/resources/desc/Command/args.md | 1 - .../src/main/resources/desc/Command/dir.md | 1 - .../src/main/resources/desc/Command/path.md | 1 - .../src/main/resources/desc/Command/user.md | 1 - .../src/main/resources/desc/DoStep/do.md | 14 - .../desc/DockerImageGetParams/rootfs.md | 1 - .../desc/DockerImageGetParams/save.md | 1 - .../DockerImageGetParams/skip_download.md | 2 - .../desc/DockerImagePutParams/build.md | 1 - .../desc/DockerImagePutParams/build_args.md | 10 - .../DockerImagePutParams/build_args_file.md | 8 - .../desc/DockerImagePutParams/cache.md | 10 - .../desc/DockerImagePutParams/cache_tag.md | 5 - .../desc/DockerImagePutParams/dockerfile.md | 2 - .../desc/DockerImagePutParams/import_file.md | 1 - .../desc/DockerImagePutParams/load.md | 2 - .../desc/DockerImagePutParams/load_base.md | 3 - .../desc/DockerImagePutParams/load_file.md | 2 - .../DockerImagePutParams/load_repository.md | 1 - .../desc/DockerImagePutParams/load_tag.md | 1 - .../DockerImagePutParams/pull_repository.md | 2 - .../desc/DockerImagePutParams/pull_tag.md | 2 - .../desc/DockerImagePutParams/tag.md | 2 - .../DockerImagePutParams/tag_as_latest.md | 2 - .../desc/DockerImagePutParams/tag_prefix.md | 3 - .../DockerImageSource/aws_access_key_id.md | 2 - .../aws_secret_access_key.md | 2 - .../desc/DockerImageSource/ca_certs.md | 25 - .../desc/DockerImageSource/client_certs.md | 27 - .../DockerImageSource/insecure_registries.md | 3 - .../desc/DockerImageSource/password.md | 1 - .../desc/DockerImageSource/registry_mirror.md | 1 - .../desc/DockerImageSource/repository.md | 2 - .../resources/desc/DockerImageSource/tag.md | 1 - .../desc/DockerImageSource/username.md | 1 - .../src/main/resources/desc/GetStep/get.md | 21 - .../main/resources/desc/GetStep/params.html | 3 - .../main/resources/desc/GetStep/passed.html | 15 - .../main/resources/desc/GetStep/resource.html | 2 - .../main/resources/desc/GetStep/trigger.html | 4 - .../main/resources/desc/GetStep/version.html | 11 - .../main/resources/desc/GitGetParams/depth.md | 3 - .../desc/GitGetParams/disable_git_lfs.md | 1 - .../resources/desc/GitGetParams/submodules.md | 3 - .../resources/desc/GitPutParams/annotate.md | 5 - .../main/resources/desc/GitPutParams/force.md | 2 - .../resources/desc/GitPutParams/only_tag.md | 1 - .../resources/desc/GitPutParams/rebase.md | 2 - .../resources/desc/GitPutParams/repository.md | 1 - .../main/resources/desc/GitPutParams/tag.md | 2 - .../resources/desc/GitPutParams/tag_prefix.md | 3 - .../resources/desc/GitSemverSource/branch.md | 1 - .../resources/desc/GitSemverSource/file.md | 1 - .../desc/GitSemverSource/git_user.md | 2 - .../desc/GitSemverSource/password.md | 1 - .../desc/GitSemverSource/private_key.md | 1 - .../resources/desc/GitSemverSource/uri.md | 1 - .../desc/GitSemverSource/username.md | 3 - .../main/resources/desc/GitSource/branch.md | 3 - .../GitSource/commit_verification_key_ids.md | 9 - .../GitSource/commit_verification_keys.md | 7 - .../desc/GitSource/disable_ci_skip.md | 2 - .../resources/desc/GitSource/git_config.md | 7 - .../resources/desc/GitSource/gpg_keyserver.md | 2 - .../resources/desc/GitSource/ignore_paths.md | 10 - .../main/resources/desc/GitSource/password.md | 3 - .../main/resources/desc/GitSource/paths.md | 2 - .../resources/desc/GitSource/private_key.md | 12 - .../desc/GitSource/skip_ssl_verification.md | 2 - .../resources/desc/GitSource/tag_filter.md | 4 - .../src/main/resources/desc/GitSource/uri.md | 1 - .../main/resources/desc/GitSource/username.md | 3 - .../src/main/resources/desc/Group/jobs.md | 1 - .../src/main/resources/desc/Group/name.md | 1 - .../main/resources/desc/Group/resources.md | 1 - .../desc/Job/build_logs_to_retain.html | 10 - .../desc/Job/disable_manual_trigger.html | 3 - .../src/main/resources/desc/Job/ensure.md | 1 - .../main/resources/desc/Job/interruptible.md | 1 - .../resources/desc/Job/max_in_flight.html | 3 - .../src/main/resources/desc/Job/name.html | 2 - .../src/main/resources/desc/Job/on_failure.md | 1 - .../src/main/resources/desc/Job/on_success.md | 1 - .../src/main/resources/desc/Job/plan.html | 60 - .../src/main/resources/desc/Job/public.html | 5 - .../src/main/resources/desc/Job/serial.html | 2 - .../resources/desc/Job/serial_groups.html | 12 - .../main/resources/desc/Pipeline/groups.md | 21 - .../main/resources/desc/Pipeline/jobs.html | 16 - .../desc/Pipeline/resource_types.html | 52 - .../resources/desc/Pipeline/resources.html | 14 - .../resources/desc/PoolPutParams/acquire.md | 3 - .../main/resources/desc/PoolPutParams/add.md | 4 - .../desc/PoolPutParams/add_claimed.md | 1 - .../resources/desc/PoolPutParams/claim.md | 3 - .../resources/desc/PoolPutParams/release.md | 8 - .../resources/desc/PoolPutParams/remove.md | 4 - .../main/resources/desc/PoolSource/branch.md | 1 - .../resources/desc/PoolSource/password.md | 1 - .../main/resources/desc/PoolSource/pool.md | 1 - .../resources/desc/PoolSource/private_key.md | 10 - .../resources/desc/PoolSource/retry_delay.md | 3 - .../src/main/resources/desc/PoolSource/uri.md | 1 - .../resources/desc/PoolSource/username.md | 2 - .../main/resources/desc/PutStep/get_params.md | 1 - .../src/main/resources/desc/PutStep/params.md | 3 - .../src/main/resources/desc/PutStep/put.md | 37 - .../main/resources/desc/PutStep/resource.md | 3 - .../resources/desc/Resource/check_every.md | 1 - .../src/main/resources/desc/Resource/name.md | 1 - .../main/resources/desc/Resource/source.md | 7 - .../src/main/resources/desc/Resource/type.md | 3 - .../resources/desc/Resource/webhook_token.md | 7 - .../main/resources/desc/ResourceType/name.md | 1 - .../resources/desc/ResourceType/source.md | 3 - .../main/resources/desc/ResourceType/type.md | 1 - .../main/resources/desc/S3PutParams/acl.md | 2 - .../desc/S3PutParams/content_type.md | 2 - .../main/resources/desc/S3PutParams/file.md | 5 - .../desc/S3SemverSource/access_key_id.md | 2 - .../resources/desc/S3SemverSource/bucket.md | 1 - .../desc/S3SemverSource/disable_ssl.md | 1 - .../resources/desc/S3SemverSource/endpoint.md | 1 - .../main/resources/desc/S3SemverSource/key.md | 2 - .../desc/S3SemverSource/region_name.md | 1 - .../desc/S3SemverSource/secret_access_key.md | 2 - .../resources/desc/S3Source/access_key_id.md | 1 - .../main/resources/desc/S3Source/bucket.md | 1 - .../resources/desc/S3Source/cloudfront_url.md | 6 - .../resources/desc/S3Source/disable_ssl.md | 2 - .../main/resources/desc/S3Source/endpoint.md | 1 - .../main/resources/desc/S3Source/private.md | 2 - .../main/resources/desc/S3Source/regexp.md | 4 - .../resources/desc/S3Source/region_name.md | 1 - .../desc/S3Source/secret_access_key.md | 1 - .../desc/S3Source/server_side_encryption.md | 1 - .../resources/desc/S3Source/sse_kms_key_id.md | 2 - .../resources/desc/S3Source/use_v2_signing.md | 1 - .../resources/desc/S3Source/versioned_file.md | 4 - .../resources/desc/SemverGetParams/bump.md | 7 - .../resources/desc/SemverGetParams/pre.md | 8 - .../resources/desc/SemverPutParams/file.md | 1 - .../resources/desc/SemverSource/driver.md | 2 - .../desc/SemverSource/initial_version.md | 2 - .../src/main/resources/desc/Step/attempts.md | 19 - .../src/main/resources/desc/Step/ensure.md | 22 - .../main/resources/desc/Step/on_failure.md | 15 - .../main/resources/desc/Step/on_success.md | 26 - .../src/main/resources/desc/Step/tags.md | 9 - .../src/main/resources/desc/Step/timeout.md | 17 - .../desc/SwiftSemverSource/openstack.md | 14 - .../main/resources/desc/TaskConfig/image.md | 7 - .../desc/TaskConfig/image_resource.md | 22 - .../main/resources/desc/TaskConfig/inputs.md | 3 - .../main/resources/desc/TaskConfig/outputs.md | 35 - .../main/resources/desc/TaskConfig/params.md | 3 - .../resources/desc/TaskConfig/platform.md | 3 - .../resources/desc/TaskConfig/rootfs_uri.md | 7 - .../src/main/resources/desc/TaskConfig/run.md | 3 - .../src/main/resources/desc/TaskInput/name.md | 1 - .../src/main/resources/desc/TaskInput/path.md | 1 - .../main/resources/desc/TaskOutput/name.md | 1 - .../main/resources/desc/TaskOutput/path.md | 4 - .../main/resources/desc/TaskStep/config.md | 3 - .../src/main/resources/desc/TaskStep/file.md | 13 - .../src/main/resources/desc/TaskStep/image.md | 33 - .../resources/desc/TaskStep/input_mapping.md | 14 - .../resources/desc/TaskStep/output_mapping.md | 16 - .../main/resources/desc/TaskStep/params.md | 14 - .../resources/desc/TaskStep/privileged.html | 8 - .../src/main/resources/desc/TaskStep/task.md | 30 - .../main/resources/desc/TimeSource/days.md | 6 - .../resources/desc/TimeSource/interval.md | 2 - .../resources/desc/TimeSource/location.md | 7 - .../main/resources/desc/TimeSource/start.md | 11 - .../main/resources/desc/TimeSource/stop.md | 11 - .../src/main/resources/desc/TryStep/try.md | 17 - .../ide/vscode/concourse/BoshEditorTest.java | 61 + ...rTest.java => BoshLanguageServerTest.java} | 11 +- .../vscode/concourse/ConcourseEditorTest.java | 3928 ----------------- .../vscode/concourse/DurationParserTest.java | 48 - .../vscode/concourse/TimeOfDayParserTest.java | 93 - .../VscodeCompletionEngineAdapter.java | 2 +- .../vscode/commons}/util/CollectorUtil.java | 2 +- .../concourse/ConcourseLanguageServer.java | 2 +- .../ide/vscode/concourse/ConcourseModel.java | 2 +- .../vscode/concourse/util/CollectorUtil.java | 67 - vscode-extensions/vscode-bosh/lib/Main.ts | 7 +- .../vscode-bosh/scripts/preinstall.sh | 2 +- 206 files changed, 252 insertions(+), 7317 deletions(-) create mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java create mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshLanguageServer.java rename headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/{concourse => bosh}/Main.java (71%) delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ASTTypeCache.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDefinitionFinder.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDocumentSymbolHandler.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseValueParsers.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchemaProblems.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ResourceTypeRegistry.java delete mode 100644 headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/StaleFallbackCache.java delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/AggregateStep/aggregate.html create mode 100644 headless-services/bosh-language-server/src/main/resources/desc/BoshDeploymentManifest/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Command/args.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Command/dir.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Command/path.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Command/user.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DoStep/do.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/rootfs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/save.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/skip_download.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args_file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache_tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/dockerfile.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/import_file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_base.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_repository.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_repository.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_as_latest.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_prefix.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_access_key_id.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_secret_access_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/ca_certs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/client_certs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/insecure_registries.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/password.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/registry_mirror.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/repository.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/username.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/get.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/params.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/passed.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/resource.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/trigger.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GetStep/version.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/depth.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/disable_git_lfs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/submodules.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/annotate.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/force.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/only_tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/rebase.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/repository.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag_prefix.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/branch.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/git_user.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/password.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/private_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/uri.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/username.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/branch.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_key_ids.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_keys.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/disable_ci_skip.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/git_config.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/gpg_keyserver.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/ignore_paths.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/password.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/paths.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/private_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/skip_ssl_verification.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/tag_filter.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/uri.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/GitSource/username.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Group/jobs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Group/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Group/resources.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/build_logs_to_retain.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/disable_manual_trigger.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/ensure.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/interruptible.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/max_in_flight.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/name.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/on_failure.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/on_success.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/plan.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/public.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/serial.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Job/serial_groups.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Pipeline/groups.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Pipeline/jobs.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resource_types.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resources.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/acquire.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add_claimed.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/claim.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/release.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/remove.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/branch.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/password.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/pool.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/private_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/retry_delay.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/uri.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PoolSource/username.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PutStep/get_params.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PutStep/params.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PutStep/put.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/PutStep/resource.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Resource/check_every.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Resource/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Resource/source.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Resource/type.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Resource/webhook_token.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/ResourceType/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/ResourceType/source.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/ResourceType/type.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/acl.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/content_type.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/access_key_id.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/bucket.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/disable_ssl.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/endpoint.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/region_name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/secret_access_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/access_key_id.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/bucket.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/cloudfront_url.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/disable_ssl.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/endpoint.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/private.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/regexp.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/region_name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/secret_access_key.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/server_side_encryption.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/sse_kms_key_id.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/use_v2_signing.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/S3Source/versioned_file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/bump.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/pre.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SemverPutParams/file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SemverSource/driver.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SemverSource/initial_version.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/attempts.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/ensure.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/on_failure.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/on_success.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/tags.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/Step/timeout.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/SwiftSemverSource/openstack.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image_resource.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/inputs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/outputs.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/params.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/platform.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/rootfs_uri.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/run.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskInput/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskInput/path.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/name.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/path.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/config.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/file.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/image.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/input_mapping.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/output_mapping.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/params.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/privileged.html delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TaskStep/task.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TimeSource/days.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TimeSource/interval.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TimeSource/location.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TimeSource/start.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TimeSource/stop.md delete mode 100644 headless-services/bosh-language-server/src/main/resources/desc/TryStep/try.md create mode 100644 headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java rename headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/{ConcourseLanguageServerTest.java => BoshLanguageServerTest.java} (81%) delete mode 100644 headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java delete mode 100644 headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/DurationParserTest.java delete mode 100644 headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/TimeOfDayParserTest.java rename headless-services/{bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse => commons/commons-util/src/main/java/org/springframework/ide/vscode/commons}/util/CollectorUtil.java (97%) delete mode 100644 headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java diff --git a/headless-services/boot-java-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java b/headless-services/boot-java-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java index 2458d83fb..280b74474 100644 --- a/headless-services/boot-java-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java +++ b/headless-services/boot-java-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java @@ -59,7 +59,7 @@ public class BootJavaLanguageServer extends SimpleLanguageServer { ICompletionEngine bootCompletionEngine = new BootJavaCompletionEngine(javaProjectFinder, indexProvider); completionEngine = new VscodeCompletionEngineAdapter(this, bootCompletionEngine); - completionEngine.setMaxCompletionsNumber(100); + completionEngine.setMaxCompletions(100); documents.onCompletion(completionEngine::getCompletions); documents.onCompletionResolve(completionEngine::resolveCompletion); @@ -71,7 +71,7 @@ public class BootJavaLanguageServer extends SimpleLanguageServer { } public void setMaxCompletionsNumber(int number) { - completionEngine.setMaxCompletionsNumber(number); + completionEngine.setMaxCompletions(number); } } diff --git a/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java b/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java index 58966974a..637b241e5 100644 --- a/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java +++ b/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java @@ -113,7 +113,7 @@ public class BootPropertiesLanguageServer extends SimpleLanguageServer { ICompletionEngine propertiesCompletionEngine = getCompletionEngine(); completionEngine = new VscodeCompletionEngineAdapter(this, propertiesCompletionEngine); - completionEngine.setMaxCompletionsNumber(100); + completionEngine.setMaxCompletions(100); documents.onCompletion(completionEngine::getCompletions); documents.onCompletionResolve(completionEngine::resolveCompletion); @@ -156,7 +156,7 @@ public class BootPropertiesLanguageServer extends SimpleLanguageServer { } public void setMaxCompletionsNumber(int number) { - completionEngine.setMaxCompletionsNumber(number); + completionEngine.setMaxCompletions(number); } public void setHoverType(HoverType type) { diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java new file mode 100644 index 000000000..3ad4d94c6 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2016 Pivotal, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.bosh; + +import org.springframework.ide.vscode.commons.util.Renderable; +import org.springframework.ide.vscode.commons.util.Renderables; +import org.springframework.ide.vscode.commons.util.ValueParsers; +import org.springframework.ide.vscode.commons.yaml.schema.YType; +import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory; +import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType; +import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YAtomicType; +import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YTypedPropertyImpl; +import org.springframework.ide.vscode.commons.yaml.schema.YTypeUtil; +import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema; + +/** + * @author Kris De Volder + */ +public class BoshDeploymentManifestSchema implements YamlSchema { + + private final AbstractType TOPLEVEL_TYPE; + private final YTypeUtil TYPE_UTIL; + + public final YTypeFactory f = new YTypeFactory(); + public final YType t_string = f.yatomic("String"); + public final YType t_ne_string = f.yatomic("String") + .parseWith(ValueParsers.NE_STRING); + + public final YType t_strings = f.yseq(t_string); + + public final YAtomicType t_boolean = f.yenum("boolean", "true", "false"); + public final YType t_any = f.yany("Object"); + public final YType t_params = f.ymap(t_string, t_any); + public final YType t_string_params = f.ymap(t_string, t_string); + public final YType t_pos_integer = f.yatomic("Positive Integer") + .parseWith(ValueParsers.POS_INTEGER); + public final YType t_strictly_pos_integer = f.yatomic("Strictly Positive Integer") + .parseWith(ValueParsers.integerAtLeast(1)); + + public BoshDeploymentManifestSchema() { + TYPE_UTIL = f.TYPE_UTIL; + + TOPLEVEL_TYPE = f.ybean("BoshDeploymentManifest"); + addProp(TOPLEVEL_TYPE, "name", t_ne_string); + } + + @Override + public YType getTopLevelType() { + return TOPLEVEL_TYPE; + } + + @Override + public YTypeUtil getTypeUtil() { + return TYPE_UTIL; + } + + private YTypedPropertyImpl prop(AbstractType beanType, String name, YType type) { + YTypedPropertyImpl prop = f.yprop(name, type); + prop.setDescriptionProvider(descriptionFor(beanType, name)); + return prop; + } + + public static Renderable descriptionFor(YType owner, String propName) { + String typeName = owner.toString(); + return Renderables.fromClasspath(BoshDeploymentManifestSchema.class, "/desc/"+typeName+"/"+propName); + } + + private YTypedPropertyImpl addProp(AbstractType bean, String name, YType type) { + return addProp(bean, bean, name, type); + } + + private YTypedPropertyImpl addProp(AbstractType superType, AbstractType bean, String name, YType type) { + YTypedPropertyImpl p = prop(superType, name, type); + bean.addProperty(p); + return p; + } + +} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshLanguageServer.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshLanguageServer.java new file mode 100644 index 000000000..8f92aeed4 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshLanguageServer.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2016, 2017 Pivotal, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.bosh; + +import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter; +import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter.LazyCompletionResolver; +import org.springframework.ide.vscode.commons.languageserver.hover.HoverInfoProvider; +import org.springframework.ide.vscode.commons.languageserver.hover.VscodeHoverEngine; +import org.springframework.ide.vscode.commons.languageserver.hover.VscodeHoverEngineAdapter; +import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine; +import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; +import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService; +import org.springframework.ide.vscode.commons.util.text.LanguageId; +import org.springframework.ide.vscode.commons.util.text.TextDocument; +import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider; +import org.springframework.ide.vscode.commons.yaml.ast.YamlParser; +import org.springframework.ide.vscode.commons.yaml.completion.SchemaBasedYamlAssistContextProvider; +import org.springframework.ide.vscode.commons.yaml.completion.YamlAssistContextProvider; +import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngine; +import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngineOptions; +import org.springframework.ide.vscode.commons.yaml.hover.YamlHoverInfoProvider; +import org.springframework.ide.vscode.commons.yaml.quickfix.YamlQuickfixes; +import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaBasedReconcileEngine; +import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema; +import org.springframework.ide.vscode.commons.yaml.structure.YamlStructureProvider; +import org.yaml.snakeyaml.Yaml; + +public class BoshLanguageServer extends SimpleLanguageServer { + + private Yaml yaml = new Yaml(); + private final LazyCompletionResolver completionResolver = new LazyCompletionResolver(); //Set to null to disable lazy resolving + private final VscodeCompletionEngineAdapter completionEngine; + + public BoshLanguageServer() { + super("vscode-bosh"); + YamlASTProvider parser = new YamlParser(yaml); + SimpleTextDocumentService documents = getTextDocumentService(); + YamlSchema schema = new BoshDeploymentManifestSchema(); + + YamlStructureProvider structureProvider = YamlStructureProvider.DEFAULT; + YamlAssistContextProvider contextProvider = new SchemaBasedYamlAssistContextProvider(schema); + YamlCompletionEngine yamlCompletionEngine = new YamlCompletionEngine(structureProvider, contextProvider, YamlCompletionEngineOptions.DEFAULT); + completionEngine = new VscodeCompletionEngineAdapter(this, yamlCompletionEngine); + completionEngine.setLazyCompletionResolver(completionResolver); + HoverInfoProvider infoProvider = new YamlHoverInfoProvider(parser, structureProvider, contextProvider); + VscodeHoverEngine hoverEngine = new VscodeHoverEngineAdapter(this, infoProvider); + YamlQuickfixes quickfixes = new YamlQuickfixes(getQuickfixRegistry(), getTextDocumentService(), structureProvider); + IReconcileEngine engine = new YamlSchemaBasedReconcileEngine(parser, schema, quickfixes); + + documents.onDidChangeContent(params -> { + validateOnDocumentChange(engine, params.getDocument()); + }); + documents.onCompletion(completionEngine::getCompletions); + documents.onCompletionResolve(completionEngine::resolveCompletion); + documents.onHover(hoverEngine ::getHover); + } + + private void validateOnDocumentChange(IReconcileEngine engine, TextDocument doc) { + if (LanguageId.BOSH_DEPLOYMENT.equals(doc.getLanguageId())) { + validateWith(doc.getId(), engine); + } else { + validateWith(doc.getId(), IReconcileEngine.NULL); + } + } + + @Override + public boolean hasLazyCompletionResolver() { + return completionResolver!=null; + } + + public BoshLanguageServer setMaxCompletions(int maxCompletions) { + completionEngine.setMaxCompletions(maxCompletions); + return this; + } + +} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/Main.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/Main.java similarity index 71% rename from headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/Main.java rename to headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/Main.java index ae7c30be6..ecdbf2c3c 100644 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/Main.java +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/Main.java @@ -9,7 +9,7 @@ * Pivotal, Inc. - initial API and implementation *******************************************************************************/ -package org.springframework.ide.vscode.concourse; +package org.springframework.ide.vscode.bosh; import java.io.IOException; @@ -17,9 +17,7 @@ import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp; import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngineOptions; public class Main { - private static final YamlCompletionEngineOptions OPTIONS = YamlCompletionEngineOptions.DEFAULT; - - public static void main(String[] args) throws IOException, InterruptedException { - LaunguageServerApp.start(() -> new ConcourseLanguageServer(OPTIONS)); + public static void main(String[] args) throws IOException, InterruptedException { + LaunguageServerApp.start(() -> new BoshLanguageServer()); } } diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ASTTypeCache.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ASTTypeCache.java deleted file mode 100644 index 2768dc50f..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ASTTypeCache.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.springframework.ide.vscode.commons.util.Assert; -import org.springframework.ide.vscode.commons.yaml.ast.YamlFileAST; -import org.springframework.ide.vscode.commons.yaml.reconcile.ITypeCollector; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.yaml.snakeyaml.nodes.Node; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; - -/** - * An implementation of {@link ITypeCollector} which keeps track of the - * types of 'interesting' nodes in the ast. - * - * @author Kris De Volder - */ -public class ASTTypeCache implements ITypeCollector { - - public interface NodeTypes { - Collection getNodes(YType type); - Map getTypes(); - } - - /** - * Wraps around a {@link ImmutableMap} and lazy builds the inverse - * map as needed. - */ - private static class NodeTypesImpl implements NodeTypes { - - private ImmutableMap node2type; - private Multimap type2node = null; //lazy initialized when used. - - public NodeTypesImpl(ImmutableMap node2type) { - this.node2type = node2type; - } - - @Override - public synchronized Collection getNodes(YType type) { - if (type2node==null) { - ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); - for (Entry e : node2type.entrySet()) { - builder.put(e.getValue(), e.getKey()); - } - type2node = builder.build(); - } - return type2node.get(type); - } - - @Override - public Map getTypes() { - return node2type; - } - } - - /** - * Set upon commencing a reconciler session. - */ - private YamlFileAST currentAst = null; - - /** - * Collects types for the current session. - */ - private ImmutableMap.Builder currentTypes = null; - - private final Set interestingTypes = new HashSet<>(); - private final Map typeIndex = new HashMap<>(); - - @Override - public void beginCollecting(YamlFileAST ast) { - Assert.isNull("A session is already active. Concurrency isn't supported by ITypeCollector protocol", currentTypes); - this.currentAst = ast; - this.currentTypes = ImmutableMap.builder(); - } - - @Override - public synchronized void endCollecting(YamlFileAST ast) { - Assert.isLegal(currentAst==ast); - String uri = ast.getDocument().getUri(); - typeIndex.put(uri, new NodeTypesImpl(currentTypes.build())); - this.currentAst = null; - this.currentTypes = null; - } - - @Override - public void accept(Node node, YType type) { - if (interestingTypes.contains(type)) { - currentTypes.put(node, type); - } - } - - public synchronized YType getType(YamlFileAST ast, Node node) { - NodeTypes types = typeIndex.get(ast.getDocument().getUri()); - if (types!=null) { - return types.getTypes().get(node); - } - return null; - } - - /** - * Declares a given YType as 'interesting'. This means that nodes of this type will be - * added to the index. - */ - public void addInterestingType(YType type) { - this.interestingTypes.add(type); - } - - public synchronized NodeTypes getNodeTypes(String uri) { - return typeIndex.get(uri); - } - - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDefinitionFinder.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDefinitionFinder.java deleted file mode 100644 index 77133bc36..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDefinitionFinder.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import org.eclipse.lsp4j.Location; -import org.eclipse.lsp4j.TextDocumentPositionParams; -import org.springframework.ide.vscode.commons.languageserver.definition.SimpleDefinitionFinder; -import org.springframework.ide.vscode.commons.util.BadLocationException; -import org.springframework.ide.vscode.commons.util.Log; -import org.springframework.ide.vscode.commons.util.text.TextDocument; -import org.springframework.ide.vscode.commons.yaml.ast.NodeUtil; -import org.springframework.ide.vscode.commons.yaml.ast.YamlFileAST; -import org.springframework.ide.vscode.commons.yaml.path.YamlPath; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.yaml.snakeyaml.nodes.Node; - -import reactor.core.publisher.Flux; - -public class ConcourseDefinitionFinder extends SimpleDefinitionFinder { - - @FunctionalInterface - private interface Handler { - Flux handle(Node refNode, TextDocument doc, YamlFileAST ast); - } - - private final ConcourseModel models; - private ASTTypeCache astTypes; - private Map handlers = new HashMap<>(); - - public ConcourseDefinitionFinder(ConcourseLanguageServer server, ConcourseModel models, PipelineYmlSchema schema) { - super(server); - this.models = models; - this.astTypes = models.getAstTypeCache(); - findByPath(schema.t_resource_name, ConcourseModel.RESOURCE_NAMES_PATH); - findByPath(schema.t_maybe_resource_name, ConcourseModel.RESOURCE_NAMES_PATH); - findByPath(schema.t_job_name, ConcourseModel.JOB_NAMES_PATH); - findByPath(schema.t_resource_type_name, ConcourseModel.RESOURCE_TYPE_NAMES_PATH); - } - - /** - * Add a handler that finds the definitions for a target node within the same document - * by following a {@link YamlPath} to find candidate nodes. - * - * @param refType the type inferred by the reconciler for the target node. - * @param definitionsPath Path that points to all nodes within the same file corresponding - * to definitions of nodes of the given type. - */ - private void findByPath(YType refType, YamlPath definitionsPath) { - astTypes.addInterestingType(refType); - Handler handler = (Node refNode, TextDocument doc, YamlFileAST ast) -> { - String name = NodeUtil.asScalar(refNode); - if (name!=null) { - return Flux.fromStream(definitionsPath.traverseAmbiguously(ast)) - .filter((node) -> name.equals(NodeUtil.asScalar(node))) - .map((node) -> toLocation(doc, node)) - .filter(Optional::isPresent) - .map(Optional::get); - } - return Flux.empty(); - }; - handlers.put(refType, handler); - } - - @Override - protected Flux findDefinitions(TextDocumentPositionParams params) { - try { - TextDocument doc = server.getTextDocumentService().get(params); - if (doc!=null) { - YamlFileAST ast = models.getSafeAst(doc, false); - if (ast!=null) { - Node refNode = ast.findNode(doc.toOffset(params.getPosition())); - if (refNode!=null) { - YType type = astTypes.getType(ast, refNode); - if (type!=null) { - Handler handler = handlers.get(type); - if (handler!=null) { - return handler.handle(refNode, doc, ast); - } - } - } - } - } - } catch (Exception e) { - Log.log(e); - } - return Flux.empty(); - } - - Optional toLocation(TextDocument doc, Node node) { - int start = node.getStartMark().getIndex(); - int end = node.getEndMark().getIndex(); - try { - return Optional.of(new Location(doc.getUri(), doc.toRange(start, end-start))); - } catch (BadLocationException e) { - Log.log(e); - return Optional.empty(); - } - } -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDocumentSymbolHandler.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDocumentSymbolHandler.java deleted file mode 100644 index 773b03b0c..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseDocumentSymbolHandler.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.Collection; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.eclipse.lsp4j.DocumentSymbolParams; -import org.eclipse.lsp4j.Location; -import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.SymbolKind; -import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion; -import org.springframework.ide.vscode.commons.languageserver.util.DocumentSymbolHandler; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService; -import org.springframework.ide.vscode.commons.util.Assert; -import org.springframework.ide.vscode.commons.util.BadLocationException; -import org.springframework.ide.vscode.commons.util.Log; -import org.springframework.ide.vscode.commons.util.text.TextDocument; -import org.springframework.ide.vscode.commons.yaml.ast.NodeUtil; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.yaml.snakeyaml.nodes.Node; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList.Builder; -import com.google.common.collect.ImmutableSet; - -/** - * Finds symbols in a concourse document. This relies on type information cached - * during reconcile and stored in the {@link ConcourseModel}. Therefore, - * this handler only works if invoked after a reconcile. - * - * @author Kris De Volder - */ -public class ConcourseDocumentSymbolHandler implements DocumentSymbolHandler { - - private ASTTypeCache astTypeCache; - private Set definitionTypes; - private SimpleTextDocumentService documents; - - public ConcourseDocumentSymbolHandler(SimpleTextDocumentService documents, ASTTypeCache astTypeCache, Collection definitionTypes) { - Assert.isTrue(!definitionTypes.isEmpty()); // If there's no interesting types then you are better of using DocumentSymbolHandler.NO_SYMBOLS - this.documents = documents; - this.astTypeCache = astTypeCache; - this.definitionTypes = ImmutableSet.copyOf(definitionTypes); - for (YType yType : definitionTypes) { - astTypeCache.addInterestingType(yType); - } - } - - @Override - public List handle(DocumentSymbolParams params) { - Builder builder = ImmutableList.builder(); - TextDocument doc = documents.getDocument(params.getTextDocument().getUri()); - for (Entry entry : astTypeCache.getNodeTypes(params.getTextDocument().getUri()).getTypes().entrySet()) { - if (definitionTypes.contains(entry.getValue())) { - try { - builder.add(createSymbol(doc, entry.getKey(), entry.getValue())); - } catch (Exception e) { - Log.log(e); - } - } - } - return builder.build(); - } - - protected SymbolInformation createSymbol(TextDocument doc, Node node, YType type) throws BadLocationException { - DocumentRegion region = NodeUtil.region(doc, node); - Location location = new Location(doc.getUri(), doc.toRange(region.getStart(), region.getLength())); - SymbolInformation symbol = new SymbolInformation(); - symbol.setName(region.toString()); - symbol.setKind(symbolKind(type)); - symbol.setLocation(location); - symbol.setContainerName(containerName(type)); - return symbol; - } - - protected String containerName(YType type) { - return type.toString().replaceAll("(\\s)*[Nn]ame", ""); - } - - protected SymbolKind symbolKind(YType type) { - return SymbolKind.String; //TODO: try to return something different for different types of symbols - } - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java deleted file mode 100644 index 3e4c9e621..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.DiagnosticSeverity; -import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter; -import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter.LazyCompletionResolver; -import org.springframework.ide.vscode.commons.languageserver.hover.HoverInfoProvider; -import org.springframework.ide.vscode.commons.languageserver.hover.VscodeHoverEngineAdapter; -import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine; -import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType; -import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblem; -import org.springframework.ide.vscode.commons.languageserver.util.DocumentSymbolHandler; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService; -import org.springframework.ide.vscode.commons.util.CollectionUtil; -import org.springframework.ide.vscode.commons.util.text.LanguageId; -import org.springframework.ide.vscode.commons.util.text.TextDocument; -import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider; -import org.springframework.ide.vscode.commons.yaml.completion.SchemaBasedYamlAssistContextProvider; -import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngine; -import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngineOptions; -import org.springframework.ide.vscode.commons.yaml.hover.YamlHoverInfoProvider; -import org.springframework.ide.vscode.commons.yaml.quickfix.YamlQuickfixes; -import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaBasedReconcileEngine; -import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaProblems; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema; -import org.springframework.ide.vscode.commons.yaml.structure.YamlStructureProvider; - -import com.google.common.collect.ImmutableList; - -public class ConcourseLanguageServer extends SimpleLanguageServer { - - private final YamlCompletionEngineOptions COMPLETION_OPTIONS; - YamlStructureProvider structureProvider = YamlStructureProvider.DEFAULT; - SimpleTextDocumentService documents = getTextDocumentService(); - ConcourseModel models = new ConcourseModel(this); - YamlASTProvider currentAsts = models.getAstProvider(false); - private SchemaSpecificPieces forPipelines; - private SchemaSpecificPieces forTasks; - private final YamlQuickfixes yamlQuickfixes; - private final LazyCompletionResolver completionResolver = new LazyCompletionResolver(); //Set this to null to disable lazy completion resolving - - private class SchemaSpecificPieces { - - final VscodeCompletionEngineAdapter completionEngine; - final VscodeHoverEngineAdapter hoverEngine; - final YamlSchemaBasedReconcileEngine reconcileEngine; - final DocumentSymbolHandler symbolHandler; - - SchemaSpecificPieces(YamlSchema schema, List definitionTypes) { - SchemaBasedYamlAssistContextProvider contextProvider = new SchemaBasedYamlAssistContextProvider(schema); - YamlCompletionEngine yamlCompletionEngine = new YamlCompletionEngine(structureProvider, contextProvider, COMPLETION_OPTIONS); - this.completionEngine = new VscodeCompletionEngineAdapter(ConcourseLanguageServer.this, yamlCompletionEngine); - this.completionEngine.setLazyCompletionResolver(completionResolver); - - HoverInfoProvider infoProvider = new YamlHoverInfoProvider(currentAsts, structureProvider, contextProvider); - this.hoverEngine = new VscodeHoverEngineAdapter(ConcourseLanguageServer.this, infoProvider); - - this.reconcileEngine = new YamlSchemaBasedReconcileEngine(currentAsts, schema, yamlQuickfixes); - reconcileEngine.setTypeCollector(models.getAstTypeCache()); - - this.symbolHandler = CollectionUtil.hasElements(definitionTypes) - ? new ConcourseDocumentSymbolHandler(documents, models.getAstTypeCache(), definitionTypes) - : DocumentSymbolHandler.NO_SYMBOLS; - } - - public void setMaxCompletions(int max) { - completionEngine.setMaxCompletionsNumber(max); - } - } - - @Override - public boolean hasLazyCompletionResolver() { - return completionResolver!=null; - } - - public ConcourseLanguageServer(YamlCompletionEngineOptions completionOptions) { - super("vscode-concourse"); - this.COMPLETION_OPTIONS = completionOptions; - PipelineYmlSchema pipelineSchema = new PipelineYmlSchema(models); - this.yamlQuickfixes = new YamlQuickfixes(getQuickfixRegistry(), documents, structureProvider); - - this.forPipelines = new SchemaSpecificPieces(pipelineSchema, pipelineSchema.getDefinitionTypes()); - this.forTasks = new SchemaSpecificPieces(pipelineSchema.getTaskSchema(), null); - ConcourseDefinitionFinder definitionFinder = new ConcourseDefinitionFinder(this, models, pipelineSchema); - -// SimpleWorkspaceService workspace = getWorkspaceService(); - documents.onDidChangeContent(params -> { - TextDocument doc = params.getDocument(); - if (LanguageId.CONCOURSE_PIPELINE.equals(doc.getLanguageId())) { - validateWith(doc.getId(), forPipelines.reconcileEngine); - } else if (LanguageId.CONCOURSE_TASK.equals(doc.getLanguageId())) { - validateWith(doc.getId(), forTasks.reconcileEngine); - } else { - validateWith(doc.getId(), IReconcileEngine.NULL); - } - }); - -// workspace.onDidChangeConfiguraton(settings -> { -// System.out.println("Config changed: "+params); -// Integer val = settings.getInt("languageServerExample", "maxNumberOfProblems"); -// if (val!=null) { -// maxProblems = ((Number) val).intValue(); -// for (TextDocument doc : documents.getAll()) { -// validateDocument(documents, doc); -// } -// } -// }); - - documents.onCompletion(params -> { - TextDocument doc = documents.get(params); - if (doc!=null) { - if (LanguageId.CONCOURSE_PIPELINE.equals(doc.getLanguageId())) { - return forPipelines.completionEngine.getCompletions(params); - } else if (LanguageId.CONCOURSE_TASK.equals(doc.getLanguageId())) { - return forTasks.completionEngine.getCompletions(params); - } - } - return CompletableFuture.completedFuture(new CompletionList(false, ImmutableList.of())); - }); - documents.onCompletionResolve(item -> { - completionResolver.resolveNow(item); - return CompletableFuture.completedFuture(item); - }); - documents.onHover(params -> { - TextDocument doc = documents.get(params); - if (doc!=null) { - if (LanguageId.CONCOURSE_PIPELINE.equals(doc.getLanguageId())) { - return forPipelines.hoverEngine.getHover(params); - } else if (LanguageId.CONCOURSE_TASK.equals(doc.getLanguageId())) { - return forTasks.hoverEngine.getHover(params); - } - } - return SimpleTextDocumentService.NO_HOVER; - }); - documents.onDefinition(definitionFinder); - documents.onDocumentSymbol((params) -> { - DocumentSymbolHandler handler = DocumentSymbolHandler.NO_SYMBOLS; - TextDocument doc = documents.getDocument(params.getTextDocument().getUri()); - if (doc!=null) { - if (LanguageId.CONCOURSE_PIPELINE.equals(doc.getLanguageId())) { - handler = forPipelines.symbolHandler; - } else if (LanguageId.CONCOURSE_TASK.equals(doc.getLanguageId())) { - handler = forTasks.symbolHandler; - } - } - return handler.handle(params); - }); - } - - @Override - protected DiagnosticSeverity getDiagnosticSeverity(ReconcileProblem problem) { - ProblemType type = problem.getType(); - if (YamlSchemaProblems.PROPERTY_CONSTRAINT.contains(type)) { - return DiagnosticSeverity.Warning; - } - return super.getDiagnosticSeverity(problem); - } - public SimpleLanguageServer setMaxCompletions(int max) { - forPipelines.setMaxCompletions(max); - forTasks.setMaxCompletions(max); - return this; - } - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java deleted file mode 100644 index 84448ff71..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java +++ /dev/null @@ -1,460 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import static org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.anyChild; -import static org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.keyAt; -import static org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.valueAt; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; -import org.springframework.ide.vscode.commons.languageserver.util.SnippetBuilder; -import org.springframework.ide.vscode.commons.util.Assert; -import org.springframework.ide.vscode.commons.util.Log; -import org.springframework.ide.vscode.commons.util.StringUtil; -import org.springframework.ide.vscode.commons.util.text.IDocument; -import org.springframework.ide.vscode.commons.yaml.ast.NodeUtil; -import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider; -import org.springframework.ide.vscode.commons.yaml.ast.YamlFileAST; -import org.springframework.ide.vscode.commons.yaml.ast.YamlParser; -import org.springframework.ide.vscode.commons.yaml.path.ASTRootCursor; -import org.springframework.ide.vscode.commons.yaml.path.NodeCursor; -import org.springframework.ide.vscode.commons.yaml.path.YamlPath; -import org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment; -import org.springframework.ide.vscode.commons.yaml.path.YamlTraversal; -import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaProblems; -import org.springframework.ide.vscode.commons.yaml.schema.BasicYValueHint; -import org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanUnionType; -import org.springframework.ide.vscode.commons.yaml.schema.constraints.Constraint; -import org.springframework.ide.vscode.commons.yaml.schema.YTypedProperty; -import org.springframework.ide.vscode.commons.yaml.schema.YValueHint; -import org.springframework.ide.vscode.commons.yaml.util.Streams; -import org.springframework.ide.vscode.concourse.ASTTypeCache.NodeTypes; -import org.springframework.ide.vscode.concourse.util.CollectorUtil; -import org.springframework.ide.vscode.concourse.util.StaleFallbackCache; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.error.YAMLException; -import org.yaml.snakeyaml.nodes.MappingNode; -import org.yaml.snakeyaml.nodes.Node; - -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMultiset; -import com.google.common.collect.ImmutableMultiset.Builder; -import com.google.common.collect.Multiset; - -/** - * ConcourseModels is responsible for extracting various bits of information - * out of .yml documents and caching them for use by various tools (reconcile engine - * and completion engine). - */ -public class ConcourseModel { - - /** - * Verification of a 'isUsed' contraint. Basically this consults the ast-type cache, (which should be - * fully populated at the end reconciling) to see if the nodes of any nodes of a given type (representing - * a 'use' of something, contain the value of the current node (which is supposed to be a definition of - * that same type of something). - */ - public Constraint isUsed(YType refType, String entityTypeName) { - getAstTypeCache().addInterestingType(refType); //ensure the type is tracked in the type-cache - return new Constraint() { - @Override - public void verify(DynamicSchemaContext dc, Node parent, Node node, YType type, IProblemCollector problems) { - String defName = NodeUtil.asScalar(node); - if (StringUtil.hasText(defName)) { //Avoid silly 'not used' errors for empty names (will have an other error already). - NodeTypes nodeTypes = getAstTypeCache().getNodeTypes(dc.getDocument().getUri()); - if (nodeTypes!=null) { - Optional reference = nodeTypes.getNodes(refType).stream() - .filter(refNode -> defName.equals(NodeUtil.asScalar(refNode))) - .findAny(); - if (!reference.isPresent()) { - problems.accept(YamlSchemaProblems.problem(PipelineYmlSchemaProblems.UNUSED_RESOURCE, "Unused '"+entityTypeName+"'", node)); - } - } - } - } - }; - } - - /** - * Verification of contraint: a job used in the 'passed' attribute of a step - * must interact with the resource in question. - */ - public final void passedJobHasInteractionWithResource(DynamicSchemaContext dc, Node parent, Node node, YType type, IProblemCollector problems) { - YamlPath path = dc.getPath(); - // Expecting a path like this: YamlPath([0], .jobs, [1], .plan, [0], .passed, [0]) - path = path.dropLast(); - if (YamlPathSegment.valueAt("passed").equals(path.getLastSegment())) { - String jobName = NodeUtil.asScalar(node); - JobModel job = getJob(dc.getDocument(), jobName); - if (job!=null) { - //Only check if the job exists. Otherwise the extra checks will show 'redundant' errors (e.g. - // complaining that 'some-job' doesn't ineract with a resource (because the resource doesn't exist). - YamlFileAST root = this.getSafeAst(dc.getDocument()); - if (root!=null) { - Node stepNode = path.dropLast().traverseToNode(root); - if (stepNode!=null) { - StepModel step = newStep(stepNode); - String resourceName = step.getResourceName(); - if (resourceName!=null && getResource(dc.getDocument(), resourceName)!=null) { - Set interactions = job.getInteractedResources(); - if (interactions!=null && !interactions.contains(resourceName)) { - problems.accept(YamlSchemaProblems.schemaProblem("Job '"+jobName+"' does not interact with resource '"+resourceName+"'", node)); - } - } - } - } - } - } - } - - /** - * Get the job with given name. If there is no such job, or if there is more than one, this will return null. - */ - private JobModel getJob(IDocument doc, String jobName) { - return Streams.getSingle( - getFromAst(doc, ast -> - JOBS_PATH.traverseAmbiguously(ast) - .filter(node -> jobName.equals(NodeUtil.getScalarProperty(node, "name"))) - .map(JobModel::new) - ) - ); - } - - public StepModel newStep(Node _node) { - MappingNode node = (MappingNode) _node; - Set keys = NodeUtil.getScalarKeys(node); - for (Entry primary : stepType.typesByPrimary().entrySet()) { - String stepType = primary.getKey(); - if (keys.contains(primary.getKey())) { - return new StepModel(stepType, node); - } - } - throw new IllegalArgumentException("Node does not look like step node: "+node); - } - - private static final YamlTraversal JobModel_GET_PUT_STEP_PATH = new YamlPath() - .then(valueAt("plan")) - .then(anyChild().repeatAtLeast(1)) - .has(keyAt("get").or(keyAt("put"))); - - /** - * Wraps around a Node in the AST that represents a 'job' and - * provides methods for accessing information from the node. - */ - public class JobModel { - - private Node node; - - JobModel(Node node) { - this.node = node; - } - - public Set getInteractedResources() { - return JobModel_GET_PUT_STEP_PATH - .traverseAmbiguously(node) - .map(node -> newStep(node)) - .flatMap(step -> Streams.fromNullable(step.getResourceName())) - .collect(Collectors.toSet()); - } - - } - - /** - * Wraps around a Node in the AST that represents a 'step' and - * provides methods for accessing information from the node. - */ - public static class StepModel { - - private final String stepType; - private final MappingNode step; - - public StepModel(String stepType, MappingNode step) { - this.stepType = stepType; - this.step = step; - } - - public Node getResourceNameNode() { - Assert.isLegal("put".equals(stepType) || "get".equals(stepType)); - Node node = NodeUtil.getProperty(step, "resource"); - return node!=null ? node : NodeUtil.getProperty(step, stepType); - } - - public String getResourceName() { - return NodeUtil.asScalar(getResourceNameNode()); - } - } - - public static class ResourceModel { - - private final Node resource; - - public ResourceModel(Node resource) { - this.resource = resource; - } - - public String getType() { - return NodeUtil.getScalarProperty(resource, "type"); - } - - public boolean hasSourceProperty(String propName) { - YamlPath path = new YamlPath(YamlPathSegment.valueAt("source"), YamlPathSegment.keyAt(propName)); - return path.traverseAmbiguously(resource).findFirst().isPresent(); - } - - } - - public static final YamlPath JOBS_PATH = new YamlPath( - anyChild(), - valueAt("jobs"), - anyChild() - ); - - public static final YamlPath JOB_NAMES_PATH = new YamlPath( - anyChild(), - valueAt("jobs"), - anyChild(), - valueAt("name") - ); - - public static final YamlPath RESOURCE_TYPE_NAMES_PATH = new YamlPath( - anyChild(), - valueAt("resource_types"), - anyChild(), - valueAt("name") - ); - - public static final YamlPath RESOURCES_PATH = new YamlPath( - anyChild(), // skip over the root node which contains multiple doces - valueAt("resources"), - anyChild() - ); - - public static final YamlPath RESOURCE_NAMES_PATH = RESOURCES_PATH.append( - valueAt("name") - ); - - private final YamlParser parser; - private final StaleFallbackCache asts = new StaleFallbackCache<>(); - - private final ASTTypeCache astTypes = new ASTTypeCache(); - - private ResourceTypeRegistry resourceTypes; - - private final Supplier snippetBuilderFactory; - - private YBeanUnionType stepType; - - public ConcourseModel(SimpleLanguageServer languageServer) { - Yaml yaml = new Yaml(); - this.parser = new YamlParser(yaml); - this.snippetBuilderFactory = languageServer::createSnippetBuilder; - } - - /** - * Returns the resource names that are defined by given IDocument. If the contents - * of IDocument is not currently parseable then this may return stale information - * retained from a previous successful parse. - *

- * It may also return null if its not currently possible to obtain the list of resource - * names (e.g. because there hasn't been a successful parse yet and current document contents - * can not be parsed). - */ - public Multiset getResourceNames(DynamicSchemaContext dc) { - return getStringsFromAst(dc.getDocument(), RESOURCE_NAMES_PATH); - } - - /** - * Get the resource type tag associated with a given resourceName in the given document. - *

- * If the content of IDocument is not currently parseable then this may return stale information - * retained from a previous successful parse. - *

- * It may also return null if its not currently possible to obtain type of the resource. E.g - * because there is no such resource, the resource has no valid type tag, or the document - * was never successfully parsed. - */ - public String getResourceType(IDocument doc, String resourceName) { - ResourceModel resource = getResource(doc, resourceName); - if (resource!=null) { - return resource.getType(); - } - return null; - } - - public ResourceModel getResource(IDocument doc, String resourceName) { - return getFromAst(doc, (ast) -> { - Node resource = RESOURCES_PATH.traverseAmbiguously(new ASTRootCursor(ast)) - .map((cursor) -> ((NodeCursor)cursor).getNode()) - .filter((resourceNode) -> resourceName.equals(NodeUtil.getScalarProperty(resourceNode, "name"))) - .findFirst().orElse(null); - if (resource!=null) { - return new ResourceModel(resource); - } - return null; - }); - - } - - /** - * Returns the job names that are defined by given IDocument. If the contents - * of IDocument is not currently parseable then this may return stale information - * retained from a previous successful parse. - *

- * It may also return null if its not currently possible to obtain the list of resource - * names (e.g. because there hasn't been a successful parse yet and current document contents - * can not be parsed). - */ - public Multiset getJobNames(DynamicSchemaContext dc) { - return getStringsFromAst(dc.getDocument(), JOB_NAMES_PATH); - } - - private Multiset getStringsFromAst(IDocument doc, YamlPath path) { - return getFromAst(doc, (ast) -> { - return path - .traverseAmbiguously(ast) - .map(NodeUtil::asScalar) - .filter((string) -> string!=null) - .collect(CollectorUtil.toMultiset()); - }); - } - - public Multiset getResourceTypeNames(DynamicSchemaContext dc) { - Collection hints = getResourceTypeNameHints(dc); - if (hints!=null) { - return ImmutableMultiset.copyOf(YTypeFactory.values(hints)); - } - return null; - } - - public Collection getResourceTypeNameHints(DynamicSchemaContext dc) { - IDocument doc = dc.getDocument(); - Multiset userDefined = getStringsFromAst(doc, RESOURCE_TYPE_NAMES_PATH); - if (userDefined!=null) { - Builder builder = ImmutableMultiset.builder(); - builder.addAll(YTypeFactory.hints(userDefined)); - builder.addAll( - Arrays.stream(PipelineYmlSchema.BUILT_IN_RESOURCE_TYPES) - .map(h -> addExtraInsertion(h, dc)) - .collect(Collectors.toList()) - ); - return builder.build(); - } - return null; - } - - public Node getParentPropertyNode(String propName, DynamicSchemaContext dc) { - YamlPath path = dc.getPath(); - if (path!=null) { - YamlFileAST root = this.getSafeAst(dc.getDocument()); - if (root!=null) { - return path.dropLast().append(YamlPathSegment.valueAt(propName)).traverseToNode(root); - } - } - return null; - } - - private YValueHint addExtraInsertion(YValueHint h, DynamicSchemaContext dc) { - return new BasicYValueHint(h.getValue(), h.getLabel()).setExtraInsertion(() -> { - String resourceTypeName = h.getValue(); - AbstractType sourceType = (AbstractType) resourceTypes.getSourceType(resourceTypeName); - if (sourceType!=null && getParentPropertyNode("source", dc)==null) { //don't auto insert what's already there! - List requiredProps = sourceType.getProperties().stream().filter(p -> p.isRequired()).collect(Collectors.toList()); - if (!requiredProps.isEmpty()) { - SnippetBuilder snippet = snippetBuilderFactory.get(); - snippet.text("\nsource:"); - for (YTypedProperty p : requiredProps) { - snippet.text("\n "+p.getName()+": "); - snippet.placeHolder(); - } - return snippet.toString(); - } - } - return null; - }); - } - - - private T getFromAst(IDocument doc, Function astFunction) { - try { - if (doc!=null) { - String uri = doc.getUri(); - if (uri!=null) { - YamlFileAST ast = getAst(doc, true); - return astFunction.apply(ast); - } - } - } catch (YAMLException e) { - // ignore: found garbage in the doc. Can't compute stuff and that's to be expected. - } catch (Exception e) { - Log.log(e); - } - return null; - } - - public YamlFileAST getSafeAst(IDocument doc) { - return getSafeAst(doc, true); - } - - public YamlFileAST getAst(IDocument doc, boolean allowStaleAst) throws Exception { - return getAstProvider(allowStaleAst).getAST(doc); - } - - public YamlASTProvider getAstProvider(boolean allowStaleAsts) { - return (IDocument doc) -> { - String uri = doc.getUri(); - if (uri!=null) { - return asts.get(uri, doc.getVersion(), allowStaleAsts, () -> { - return parser.getAST(doc); - }); - } - return null; - }; - } - - public YamlFileAST getSafeAst(IDocument doc, boolean allowStaleAst) { - if (doc!=null) { - try { - return getAst(doc, allowStaleAst); - } catch (Exception e) { - //ignored - } - } - return null; - } - - public ASTTypeCache getAstTypeCache() { - return astTypes; - } - - public void setResourceTypeRegistry(ResourceTypeRegistry resourceTypes) { - this.resourceTypes = resourceTypes; - } - - public void setStepType(YBeanUnionType step) { - Assert.isNull("stepType already set", this.stepType); - this.stepType = step; - } - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseValueParsers.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseValueParsers.java deleted file mode 100644 index c7b012e85..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseValueParsers.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.function.Function; - -import org.springframework.ide.vscode.commons.util.RegexpParser; -import org.springframework.ide.vscode.commons.util.StringUtil; -import org.springframework.ide.vscode.commons.util.ValueParseException; -import org.springframework.ide.vscode.commons.util.ValueParser; -import org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext; -import org.springframework.ide.vscode.commons.yaml.schema.SchemaContextAware; - -import com.google.common.collect.Multiset; - -/** - * Methods and constants to create/get parsers for some atomic types - * used in manifest yml schema. - * - * @author Kris De Volder - */ -public class ConcourseValueParsers { - -// public static final SchemaContextAware resourceTypeName(ConcourseModel models) { -// return (dc) -> { -// return new EnumValueParser("ResourceType Name", models.getResourceTypeNames(dc.getDocument())) { -// @Override -// protected String createErrorMessage(String value, Collection validValues) { -// return "The '"+value+"' Resource Type does not exist. Existing resource types: "+validValues; -// } -// }; -// }; -// }; - - public static final SchemaContextAware resourceNameDef(ConcourseModel models) { - return acceptOnlyUniqueNames(models::getResourceNames, "resource name"); - } - - public static final SchemaContextAware jobNameDef(ConcourseModel models) { - return acceptOnlyUniqueNames(models::getJobNames, "job name"); - } - - public static SchemaContextAware resourceTypeNameDef(ConcourseModel models) { - return acceptOnlyUniqueNames(models::getResourceTypeNames, "resource-type name"); - } - - public static SchemaContextAware acceptOnlyUniqueNames( - Function> getDefinedNameCounts, - String typeName - ) { - return acceptOnlyUniqueNames(getDefinedNameCounts, typeName, false); - } - - public static SchemaContextAware acceptOnlyUniqueNames( - Function> getDefinedNameCounts, - String typeName, - boolean allowEmptyName - ) { - return (dc) -> { - return (String input) -> { - if (!allowEmptyName && !StringUtil.hasText(input)) { - throw new ValueParseException("'"+typeName +"' should not be blank"); - } - Multiset resourceNames = getDefinedNameCounts.apply(dc); - if (resourceNames.count(input)<=1) { - //okay - return input; - } - throw new ValueParseException("Duplicate "+typeName+" '"+input+"'"); - }; - }; - }; - - public static ValueParser DURATION = new RegexpParser( - "^(([0-9]+(.[0-9]+)?)(ns|us|µs|ms|s|h|m))+$", - "Duration", - " A duration string is a sequence of decimal numbers, each with " - + "optional fraction and a unit suffix, such as '300ms', '1.5h' or" - + " '2h45m'. Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', " - + "'m', 'h'." - ); - - public static final ValueParser TIME_OF_DAY = new RegexpParser( - createTimeRegexp(), - "Time", - "Supported time formats are: 3:04 PM, 3PM, 3 PM, 15:04, and 1504. " - + "Deprecation: an offset may be appended, e.g. +0700 or -0400, but " - + "you should use location instead." - ); - - private static String createTimeRegexp() { - String hours = "([0-2]?[0-9])"; - String minutes = "([0-6][0-9])"; - String time = hours+"((:"+minutes+")|"+minutes+")?"; - String pm = "(\\s?[AP]M)?"; - String zone = "(\\s(\\+|\\-)[0-9][0-9][0-9][0-9])?"; - - return time + pm + zone; - } - - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java deleted file mode 100644 index dda75bda2..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java +++ /dev/null @@ -1,724 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.time.ZoneId; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.stream.Collectors; - -import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector; -import org.springframework.ide.vscode.commons.util.MimeTypes; -import org.springframework.ide.vscode.commons.util.Renderable; -import org.springframework.ide.vscode.commons.util.Renderables; -import org.springframework.ide.vscode.commons.util.ValueParseException; -import org.springframework.ide.vscode.commons.util.ValueParser; -import org.springframework.ide.vscode.commons.util.ValueParsers; -import org.springframework.ide.vscode.commons.util.text.LanguageId; -import org.springframework.ide.vscode.commons.yaml.ast.NodeUtil; -import org.springframework.ide.vscode.commons.yaml.ast.YamlFileAST; -import org.springframework.ide.vscode.commons.yaml.path.YamlPath; -import org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment; -import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaProblems; -import org.springframework.ide.vscode.commons.yaml.schema.BasicYValueHint; -import org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext; -import org.springframework.ide.vscode.commons.yaml.schema.SchemaContextAware; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YAtomicType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanUnionType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YTypedPropertyImpl; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeUtil; -import org.springframework.ide.vscode.commons.yaml.schema.YTypedProperty; -import org.springframework.ide.vscode.commons.yaml.schema.YValueHint; -import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema; -import org.springframework.ide.vscode.commons.yaml.schema.constraints.Constraints; -import org.springframework.ide.vscode.concourse.ConcourseModel.ResourceModel; -import org.springframework.ide.vscode.concourse.ConcourseModel.StepModel; -import org.yaml.snakeyaml.nodes.MappingNode; -import org.yaml.snakeyaml.nodes.Node; - -import com.google.common.collect.ImmutableList; - -/** - * @author Kris De Volder - */ -public class PipelineYmlSchema implements YamlSchema { - - //TODO: the infos for composing this should probably be integrated somehow in the ResourceTypeRegistry so - // we only have a list of built-in resource types in a single place. - public static final YValueHint[] BUILT_IN_RESOURCE_TYPES = { - hint("git", "The 'git' resource can pull and push to git repositories."), - hint("hg", "The 'hg' resource can pull and push to Mercurial repositories."), - hint("time", "The 'time' resource can start jobs on a schedule or timestamp outputs."), - hint("s3", "The 's3' resource can fetch from and upload to S3 buckets."), - hint("archive", "The 'archive' resource can fetch and extract .tar.gz archives."), - hint("semver", "The 'semver' resource can set or bump version numbers."), - hint("github-release", "The 'github-release' resource can fetch and publish versioned GitHub resources."), - hint("docker-image", "The 'docker-image' resource can fetch, build, and push Docker images."), - hint("tracker", "The 'tracker' resource can deliver stories and bugs on Pivotal Tracker."), - hint("pool", "The 'pool' resource allows you to configure how to serialize use of an external system. " - + "This lets you prevent test interference or overwork on shared systems."), - hint("cf", "The cf resource can deploy an application to Cloud Foundry."), - hint("bosh-io-release", "The bosh-io-release resource can track and fetch new BOSH releases from bosh.io."), - hint("bosh-io-stemcell", "The bosh-io-stemcell resource can track and fetch new BOSH stemcells from bosh.io."), - hint("bosh-deployment", "The bosh-deployment resource can deploy BOSH stemcells and releases."), - hint("vagrant-cloud", "The vagrant-cloud resource can fetch and publish Vagrant boxes to Atlas.") - }; - - private final AbstractType TOPLEVEL_TYPE; - private final YTypeUtil TYPE_UTIL; - - public final YTypeFactory f = new YTypeFactory(); - public final YType t_string = f.yatomic("String"); - public final YType t_ne_string = f.yatomic("String") - .parseWith(ValueParsers.NE_STRING); - - public final YType t_strings = f.yseq(t_string); - public final YType t_pair = f.ybean("NameValuePair", - f.yprop("name", t_string), - f.yprop("value", t_string) - ); - public final YType t_pair_list = f.yseq(t_pair); - - public final YAtomicType t_boolean = f.yenum("boolean", "true", "false"); - public final YType t_any = f.yany("Object"); - public final YType t_params = f.ymap(t_string, t_any); - public final YType t_string_params = f.ymap(t_string, t_string); - public final YType t_pos_integer = f.yatomic("Positive Integer") - .parseWith(ValueParsers.POS_INTEGER); - public final YType t_strictly_pos_integer = f.yatomic("Strictly Positive Integer") - .parseWith(ValueParsers.integerAtLeast(1)); - - public final AbstractType t_resource_name; - public final YAtomicType t_maybe_resource_name; - public final AbstractType t_job_name; - public final YAtomicType t_resource_type_name; - public final YType t_mime_type = f.yatomic("MimeType") - .parseWith(ValueParsers.NE_STRING) - .addHints(MimeTypes.getKnownMimeTypes()); - - public final YType t_duration = f.yatomic("Duration") - .parseWith(ConcourseValueParsers.DURATION); - public final YType t_time_of_day = f.yatomic("TimeOfDay") - .parseWith(ConcourseValueParsers.TIME_OF_DAY); - public final YType t_location = f.yatomic("Location") - //Note: we could have used f.yenum here too. But it saves memory if we don't keep the large set of ValueHints in memory. - // That's why we attach custom hint provider and parser here that do essentially the same thing. - .addHintProvider(() -> { - return ZoneId.getAvailableZoneIds().stream() - .map(BasicYValueHint::new) - .collect(Collectors.toList()); - }) - .parseWith(ValueParser.of((zoneId) -> { - if (!ZoneId.getAvailableZoneIds().contains(zoneId)) { - throw new ValueParseException("Unknown 'Location'. See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"); - } - return zoneId; - })); - - public final AbstractType task; - - private final ResourceTypeRegistry resourceTypes = new ResourceTypeRegistry(); - - private final ConcourseModel models; - - public final YType t_semver = f.yatomic("Semver") - .parseWith(ValueParsers.NE_STRING); //TODO: use real semver parser. - - public final YType t_s3_region = f.yenum("S3Region", - //See: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html - "us-west-1", "us-west-2", - "ca-central-1", "EU", "eu-west-1", - "eu-west-2", "eu-central-1", - "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", - "sa-east-1", - "us-east-2" - ); - - public final YType t_day = f.yenum("Day", - //See https://github.com/concourse/time-resource#source-configuration - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" - ); - - private List definitionTypes = new ArrayList<>(); - - - public PipelineYmlSchema(ConcourseModel models) { - this.models = models; - models.setResourceTypeRegistry(resourceTypes); - TYPE_UTIL = f.TYPE_UTIL; - - // define schema types - TOPLEVEL_TYPE = f.ybean("Pipeline"); - - YAtomicType t_version = f.yatomic("Version"); - t_version.addHints("latest", "every"); - - t_resource_type_name = f.yenumFromHints("ResourceType Name", - (parseString, validValues) -> { - return "The '"+parseString+"' Resource Type does not exist. Existing types: "+validValues; - }, - (DynamicSchemaContext dc) -> { - return models.getResourceTypeNameHints(dc); - } - ); - - t_resource_name = f.yenum("Resource Name", - (parseString, validValues) -> { - return "The '"+parseString+"' resource does not exist. Existing resources: "+validValues; - }, - (DynamicSchemaContext dc) -> { - return (models.getResourceNames(dc)); - } - ); - t_maybe_resource_name = f.yatomic("ResourceName | TaskOutput"); - t_maybe_resource_name.addHintProvider((DynamicSchemaContext dc) -> { - //Putting the Callable into a local variable is strange, but the compiler doesn't like it if - // we return it directly. Too much complexity for Java type-inference? - Callable> callable = () -> YTypeFactory.hints(models.getResourceNames(dc)); - return callable; - }); - t_maybe_resource_name.parseWith(ValueParsers.NE_STRING); - - t_job_name = f.yenum("Job Name", - (parseString, validValues) -> { - return "The '"+parseString+"' Job does not exist. Existing jobs: "+validValues; - }, - (DynamicSchemaContext dc) -> { - return models.getJobNames(dc); - } - ).require(models::passedJobHasInteractionWithResource); - - YAtomicType t_resource_name_def = f.yatomic("Resource Name"); - t_resource_name_def.parseWith(ConcourseValueParsers.resourceNameDef(models)); - t_resource_name_def.require(models.isUsed(t_resource_name, "Resource")); - YAtomicType jobNameDef = f.yatomic("Job Name"); - jobNameDef.parseWith(ConcourseValueParsers.jobNameDef(models)); - YAtomicType resourceTypeNameDef = f.yatomic("ResourceType Name"); - resourceTypeNameDef.parseWith(ConcourseValueParsers.resourceTypeNameDef(models)); - - YType resourceSource = f.contextAware("ResourceSource", (dc) -> - resourceTypes.getSourceType(getResourceTypeTag(models, dc)) - ); - - AbstractType t_resource = f.ybean("Resource"); - addProp(t_resource, "name", t_resource_name_def).isPrimary(true); - addProp(t_resource, "type", t_resource_type_name).isRequired(true); - addProp(t_resource, "source", resourceSource); - addProp(t_resource, "check_every", t_duration); - addProp(t_resource, "webhook_token", t_ne_string); - - AbstractType t_image_resource = f.ybean("ImageResource"); - for (YTypedProperty p : t_resource.getProperties()) { - if (!"name".equals(p.getName())) { - t_image_resource.addProperty(p); - } - } - - YAtomicType t_platform = f.yenum("Platform", "windows", "linux", "darwin"); - t_platform.parseWith(ValueParsers.NE_STRING); //no errors because in theory platform are just strings. - - AbstractType t_input = f.ybean("TaskInput"); - addProp(t_input, "name", t_ne_string).isPrimary(true); - addProp(t_input, "path", t_ne_string); - - AbstractType t_output = f.ybean("TaskOutput"); - addProp(t_output, "name", t_ne_string).isPrimary(true); - addProp(t_output, "path", t_ne_string); - - AbstractType t_command = f.ybean("Command"); - addProp(t_command, "path", t_ne_string).isRequired(true); - addProp(t_command, "args", t_strings); - addProp(t_command, "dir", t_ne_string); - addProp(t_command, "user", t_string); - - task = f.ybean("TaskConfig"); - addProp(task, "platform", t_platform).isRequired(true); - addProp(task, "image_resource", t_image_resource); - addProp(task, "rootfs_uri", t_ne_string); - addProp(task, "image", t_ne_string).isDeprecated("The 'image' property in 'TaskConfig' is renamed to 'rootfs_uri' in Concourse 3.0"); - addProp(task, "inputs", f.yseq(t_input)); - addProp(task, "outputs", f.yseq(t_output)); - addProp(task, "run", t_command).isRequired(true); - addProp(task, "params", t_string_params); - task.require(Constraints.schemaContextAware((DynamicSchemaContext dc) -> { - LanguageId languageId = dc.getDocument().getLanguageId(); - if (LanguageId.CONCOURSE_PIPELINE.equals(languageId)) { - Node parentImageDef = models.getParentPropertyNode("image", dc); - if (parentImageDef==null) { - return Constraints.requireOneOf("image_resource", "rootfs_uri", "image"); - } else { - return Constraints.deprecated((name) -> - "Deprecated: This attribute in the task config will be ignored! "+ - "The 'image' attribute on the task itself takes precedence.", - "image_resource", "rootfs_uri", "image" - ); - } - } else { - return Constraints.requireAtMostOneOf("image_resource", "rootfs_uri", "image"); - } - })); - - AbstractType t_put_get_name = f.contextAware("Name", (dc) -> { - if (models.getParentPropertyNode("resource", dc)!=null) { - return null; - } else { - return t_resource_name; - } - }) - .treatAsAtomic() - .parseWith(ValueParsers.NE_STRING); - - YBeanType getStep = f.ybean("GetStep"); - addProp(getStep, "get", t_put_get_name); - addProp(getStep, "resource", t_resource_name); - addProp(getStep, "version", t_version); - addProp(getStep, "passed", f.yseq(t_job_name)); - addProp(getStep, "params", f.contextAware("GetParams", (dc) -> - resourceTypes.getInParamsType(getResourceType("get", models, dc)) - )); - addProp(getStep, "trigger", t_boolean); - - YBeanType putStep = f.ybean("PutStep"); - addProp(putStep, "put", t_put_get_name); - addProp(putStep, "resource", t_resource_name); - addProp(putStep, "params", f.contextAware("PutParams", (dc) -> - resourceTypes.getOutParamsType(getResourceType("put", models, dc)) - )); - addProp(putStep, "get_params", f.contextAware("GetParams", (dc) -> - resourceTypes.getInParamsType(getResourceType("put", models, dc)) - )); - putStep.require((DynamicSchemaContext dc, Node parent, Node _map, YType type, IProblemCollector problems) -> { - if (_map instanceof MappingNode) { - MappingNode map = (MappingNode) _map; - StepModel step = models.newStep(map); - String resourceName = step.getResourceName(); - if (resourceName!=null) { - ResourceModel resource = models.getResource(dc.getDocument(), resourceName); - if (resource!=null) { - if ("git".equals(resource.getType()) && !resource.hasSourceProperty("branch")) { - problems.accept(YamlSchemaProblems.schemaProblem( - "Resource of type 'git' is used in a 'put' step, so it should define 'branch' attribute in its 'source', but it doesn't.", - step.getResourceNameNode() - )); - } - } - } - } - }); - YBeanType taskStep = f.ybean("TaskStep"); - addProp(taskStep, "task", t_ne_string); - addProp(taskStep, "file", t_string); - addProp(taskStep, "config", task); - addProp(taskStep, "privileged", t_boolean); - addProp(taskStep, "params", t_params); - addProp(taskStep, "image", t_resource_name); - addProp(taskStep, "input_mapping", f.ymap(t_ne_string, t_maybe_resource_name)); - addProp(taskStep, "output_mapping", t_string_params); - taskStep.requireOneOf("config", "file"); - - YBeanType aggregateStep = f.ybean("AggregateStep"); - YBeanType doStep = f.ybean("DoStep"); - YBeanType tryStep = f.ybean("TryStep"); - - YBeanType[] stepTypes = { - getStep, - putStep, - taskStep, - aggregateStep, - doStep, - tryStep - }; - YBeanUnionType step = f.yunion("Step", stepTypes); - addProp(aggregateStep, "aggregate", f.yseq(step)); - addProp(doStep, "do", f.yseq(step)); - addProp(tryStep, "try", step); - - // shared properties applicable for any subtype of Step: - for (AbstractType subStep : stepTypes) { - addProp(step, subStep, "on_success", step); - addProp(step, subStep, "on_failure", step); - addProp(step, subStep, "ensure", step); - addProp(step, subStep, "attempts", t_strictly_pos_integer); - addProp(step, subStep, "tags", t_strings); - addProp(step, subStep, "timeout", t_duration); - } - models.setStepType(step); - - AbstractType job = f.ybean("Job"); - addProp(job, "name", jobNameDef).isPrimary(true); - addProp(job, "plan", f.yseq(step)).isRequired(true); - addProp(job, "serial", t_boolean); - addProp(job, "build_logs_to_retain", t_pos_integer); - addProp(job, "serial_groups", t_strings); - addProp(job, "max_in_flight", t_pos_integer); - addProp(job, "public", t_boolean); - addProp(job, "disable_manual_trigger", t_boolean); - addProp(job, "interruptible", t_boolean); - addProp(job, "ensure", step); - addProp(job, "on_failure", step); - addProp(job, "on_success", step); - - AbstractType resourceType = f.ybean("ResourceType"); - addProp(resourceType, "name", resourceTypeNameDef).isPrimary(true); - addProp(resourceType, "type", t_resource_type_name).isRequired(true); - addProp(resourceType, "source", resourceSource); - - AbstractType group = f.ybean("Group"); - addProp(group, "name", t_ne_string).isPrimary(true); - addProp(group, "resources", f.yseq(t_resource_name)); - addProp(group, "jobs", f.yseq(t_job_name)); - - addProp(TOPLEVEL_TYPE, "resources", f.yseq(t_resource)); - addProp(TOPLEVEL_TYPE, "jobs", f.yseq(job)); - addProp(TOPLEVEL_TYPE, "resource_types", f.yseq(resourceType)); - addProp(TOPLEVEL_TYPE, "groups", f.yseq(group)); - - definitionTypes = ImmutableList.of( - jobNameDef, - resourceTypeNameDef, - t_resource_name_def - ); - - initializeDefaultResourceTypes(); - } - - private static YValueHint hint(String value, String description) { - return YTypeFactory.hint(value, value + " - " + description); - } - - private void initializeDefaultResourceTypes() { - // git : - { - AbstractType source = f.ybean("GitSource"); - addProp(source, "uri", t_ne_string).isPrimary(true); - addProp(source, "branch", t_ne_string); //It's more complicated than that! Its only required in 'put' step. So we'll check this as a contrain in put steps! - addProp(source, "private_key", t_ne_string); - addProp(source, "username", t_ne_string); - addProp(source, "password", t_string); - addProp(source, "paths", t_strings); - addProp(source, "ignore_paths", t_strings); - addProp(source, "skip_ssl_verification", t_boolean); - addProp(source, "tag_filter", t_string); - addProp(source, "git_config", t_pair_list); - addProp(source, "disable_ci_skip", t_boolean); - addProp(source, "commit_verification_keys", t_strings); - addProp(source, "commit_verification_key_ids", t_strings); - addProp(source, "gpg_keyserver", t_string); - - AbstractType get = f.ybean("GitGetParams"); - addProp(get, "depth", t_pos_integer); - addProp(get, "submodules", f.yany("GitSubmodules").addHints("all", "none")); - addProp(get, "disable_git_lfs", t_boolean); - addProp(get, "fetch", t_strings); //Warning: t_strings is just a guess. This property is undocumented. The example I've seen seem to use list of git branch/tag names. - - AbstractType put = f.ybean("GitPutParams"); - addProp(put, "repository", t_ne_string).isPrimary(true); - addProp(put, "rebase", t_boolean); - addProp(put, "tag", t_ne_string); - addProp(put, "only_tag", t_boolean); - addProp(put, "tag_prefix", t_string); - addProp(put, "force", t_boolean); - addProp(put, "annotate", t_ne_string); - - resourceTypes.def("git", source, get, put); - } - //docker-image: - { - AbstractType source = f.ybean("DockerImageSource"); - addProp(source, "repository", t_ne_string).isPrimary(true); - addProp(source, "tag", t_ne_string); - addProp(source, "username", t_ne_string); - addProp(source, "password", t_ne_string); - addProp(source, "aws_access_key_id", t_ne_string); - addProp(source, "aws_secret_access_key", t_ne_string); - addProp(source, "insecure_registries", t_strings); - addProp(source, "registry_mirror", t_ne_string); - addProp(source, "ca_certs", f.yseq(f.ybean("CaCertsEntry", - f.yprop("domain", t_ne_string), - f.yprop("cert", t_ne_string) - ))); - addProp(source, "client_certs", f.yseq(f.ybean("ClientCertsEntry", - f.yprop("domain", t_ne_string), - f.yprop("key", t_ne_string), - f.yprop("cert", t_ne_string) - ))); - - AbstractType get = f.ybean("DockerImageGetParams"); - addProp(get, "save", t_boolean); - addProp(get, "rootfs", t_boolean); - addProp(get, "skip_download", t_boolean); - - AbstractType put = f.ybean("DockerImagePutParams"); - addProp(put, "build", t_ne_string); - addProp(put, "load", t_ne_string); - addProp(put, "dockerfile", t_ne_string); - addProp(put, "cache", t_boolean); - addProp(put, "cache_tag", t_ne_string); - addProp(put, "load_base", t_ne_string); - addProp(put, "load_file", t_ne_string); - addProp(put, "load_repository", t_ne_string); - addProp(put, "load_tag", t_ne_string); - addProp(put, "import_file", t_ne_string); - addProp(put, "pull_repository", t_ne_string).isDeprecated(true); - addProp(put, "pull_tag", t_ne_string).isDeprecated(true); - addProp(put, "tag", t_ne_string); - addProp(put, "tag_prefix", t_ne_string); - addProp(put, "tag_as_latest", t_boolean); - addProp(put, "build_args", t_string_params); - addProp(put, "build_args_file", t_ne_string); - - resourceTypes.def("docker-image", source, get, put); - } - //s3 - { - YType t_canned_acl = f.yenum("S3CannedAcl", - //See http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl - "private", "public-read", "public-read-write", "aws-exec-read", - "authenticated-read", "bucket-owner-read", "bucket-owner-full-control", - "log-delivery-write" - ); - - AbstractType source = f.ybean("S3Source"); - addProp(source, "bucket", t_ne_string).isPrimary(true); - addProp(source, "access_key_id", t_ne_string); - addProp(source, "secret_access_key", t_ne_string); - addProp(source, "region_name", t_s3_region); - addProp(source, "private", t_boolean); - addProp(source, "cloudfront_url", t_ne_string); - addProp(source, "endpoint", t_ne_string); - addProp(source, "disable_ssl", t_boolean); - addProp(source, "server_side_encryption", t_ne_string); - addProp(source, "sse_kms_key_id", t_ne_string); - addProp(source, "use_v2_signing", t_boolean); - addProp(source, "regexp", t_ne_string); - addProp(source, "versioned_file", t_ne_string); - source.requireOneOf("regexp", "versioned_file"); - - AbstractType get = f.ybean("S3GetParams"); - //Note: S3GetParams intentionally has no properties since no params are expected according to the docs. - - AbstractType put = f.ybean("S3PutParams"); - addProp(put, "file", t_ne_string).isPrimary(true); - addProp(put, "acl", t_canned_acl); - addProp(put, "content_type", t_mime_type); - - resourceTypes.def("s3", source, get, put); - } - //pool - { - AbstractType source = f.ybean("PoolSource"); - addProp(source, "uri", t_ne_string).isRequired(true); - addProp(source, "branch", t_ne_string).isRequired(true); - addProp(source, "pool", t_ne_string).isRequired(true); - addProp(source, "private_key", t_ne_string); - addProp(source, "username", t_ne_string); - addProp(source, "password", t_string); - addProp(source, "retry_delay", t_duration); - - AbstractType get = f.ybean("PoolGetParams"); - //get params deliberately left empty - - AbstractType put = f.ybean("PoolPutParams"); - addProp(put, "acquire", t_boolean); - addProp(put, "claim", t_ne_string); - addProp(put, "release", t_ne_string); - addProp(put, "add", t_ne_string); - addProp(put, "add_claimed", t_ne_string); - addProp(put, "remove", t_ne_string); - put.requireOneOf(put.getPropertyNames()); - - resourceTypes.def("pool", source, get, put); - } - //semver - { - AbstractType git_source = f.ybean("GitSemverSource"); - addProp(git_source, "uri", t_ne_string).isPrimary(true); - addProp(git_source, "branch", t_ne_string).isRequired(true); - addProp(git_source, "file", t_ne_string).isRequired(true); - addProp(git_source, "private_key", t_ne_string); - addProp(git_source, "username", t_ne_string); - addProp(git_source, "password", t_ne_string); - addProp(git_source, "git_user", t_ne_string); - - AbstractType s3_source = f.ybean("S3SemverSource"); - addProp(s3_source, "bucket", t_ne_string).isPrimary(true); - addProp(s3_source, "key", t_ne_string).isRequired(true); - addProp(s3_source, "access_key_id", t_ne_string).isRequired(true); - addProp(s3_source, "secret_access_key", t_ne_string).isRequired(true); - addProp(s3_source, "region_name", t_s3_region); - addProp(s3_source, "endpoint", t_ne_string); - addProp(s3_source, "disable_ssl", t_boolean); - - AbstractType swift_source = f.ybean("SwiftSemverSource"); - addProp(swift_source, "openstack", t_any).isPrimary(true); - - AbstractType[] driverSpecificSources = { - git_source, s3_source, swift_source - }; - - AbstractType source = f.contextAware("SemverSource", (dc) -> { - switch (getSemverDriverName(dc)) { - case "git": - return git_source; - case "s3": - return s3_source; - case "swift": - return swift_source; - default: - return null; - } - }).treatAsBean(); - addProp(source, "initial_version", t_semver); - addProp(source, "driver", f.yenum("SemverDriver", "git", "s3", "swift")).isPrimary(true, false); - for (AbstractType s : driverSpecificSources) { - for (YTypedProperty p : source.getProperties()) { - s.addProperty(p); - } - } - - AbstractType get = f.ybean("SemverGetParams"); - addProp(get, "bump", f.yenum("SemverBump", "major", "minor", "patch", "final")); - addProp(get, "pre", t_ne_string); - - AbstractType put = f.ybean("SemverPutParams"); - for (YTypedProperty p : get.getProperties()) { - put.addProperty(p); - } - addProp(put, "file", t_ne_string); - - resourceTypes.def("semver", source, get, put); - } - //time: - { - AbstractType source = f.ybean("TimeSource"); - addProp(source, "interval", t_duration); - addProp(source, "location", t_location); - addProp(source, "start", t_time_of_day); - addProp(source, "stop", t_time_of_day); - addProp(source, "days", f.yseq(t_day)); - - AbstractType get = f.ybean("TimeGetParams"); - //get params deliberately left empty - - AbstractType put = f.ybean("TimePutParams"); - //put params deliberately left empty - - resourceTypes.def("time", source, get, put); - - } - } - - private String getSemverDriverName(DynamicSchemaContext dc) { - String driver = getSiblingPropertyValue(dc, "driver"); - return driver!=null ? driver : "s3"; - } - - private Node getResourceNameNode(String resourceNameProp, DynamicSchemaContext dc) { - Node resourceName = models.getParentPropertyNode("resource", dc); - if (resourceName==null) { - resourceName = models.getParentPropertyNode(resourceNameProp, dc); - } - return resourceName; - } - - private String getResourceName(String resourceNameProp, DynamicSchemaContext dc) { - Node resourceName = getResourceNameNode(resourceNameProp, dc); - return NodeUtil.asScalar(resourceName); - } - - private String getResourceType(String resourceNameProp, ConcourseModel models, DynamicSchemaContext dc) { - String resourceName = getResourceName(resourceNameProp, dc); - if (resourceName!=null) { - return models.getResourceType(dc.getDocument(), resourceName); - } - return null; - } - - private String getResourceTypeTag(ConcourseModel models, DynamicSchemaContext dc) { - return getParentPropertyValue("type", models, dc); - } - - private String getParentPropertyValue(String propName, ConcourseModel models, DynamicSchemaContext dc) { - return NodeUtil.asScalar(models.getParentPropertyNode(propName, dc)); - } - - private String getSiblingPropertyValue(DynamicSchemaContext dc, String propName) { - YamlPath path = dc.getPath(); - if (path!=null) { - YamlFileAST root = models.getSafeAst(dc.getDocument()); - if (root!=null) { - return NodeUtil.asScalar(path.append(YamlPathSegment.valueAt(propName)).traverseToNode(root)); - } - } - return null; - } - - private YTypedPropertyImpl prop(AbstractType beanType, String name, YType type) { - YTypedPropertyImpl prop = f.yprop(name, type); - prop.setDescriptionProvider(descriptionFor(beanType, name)); - return prop; - } - - private YTypedPropertyImpl addProp(AbstractType superType, AbstractType bean, String name, YType type) { - YTypedPropertyImpl p = prop(superType, name, type); - bean.addProperty(p); - return p; - } - - private YTypedPropertyImpl addProp(AbstractType bean, String name, YType type) { - return addProp(bean, bean, name, type); - } - - public static Renderable descriptionFor(YType owner, String propName) { - String typeName = owner.toString(); - return Renderables.fromClasspath(PipelineYmlSchema.class, "/desc/"+typeName+"/"+propName); - } - - @Override - public AbstractType getTopLevelType() { - return TOPLEVEL_TYPE; - } - - @Override - public YTypeUtil getTypeUtil() { - return TYPE_UTIL; - } - - public YamlSchema getTaskSchema() { - return new YamlSchema() { - - @Override - public YTypeUtil getTypeUtil() { - return TYPE_UTIL; - } - - @Override - public YType getTopLevelType() { - return task; - } - - @Override - public String toString() { - return "TaskYamlSchema"; - } - }; - } - - public List getDefinitionTypes() { - return definitionTypes; - } -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchemaProblems.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchemaProblems.java deleted file mode 100644 index f4e3569dc..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchemaProblems.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity; -import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType; - -import static org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaProblems.*; - -public class PipelineYmlSchemaProblems { - protected static final ProblemType UNUSED_RESOURCE = problemType("PipelineYamlUnusedResource", ProblemSeverity.ERROR); -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ResourceTypeRegistry.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ResourceTypeRegistry.java deleted file mode 100644 index 84ca62795..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/ResourceTypeRegistry.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.ide.vscode.commons.util.Assert; -import org.springframework.ide.vscode.commons.yaml.schema.YType; -import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType; - -/** - * Keeps track of known resource types. - * - * @author Kris De Volder - */ -public class ResourceTypeRegistry { - - private static class ResourceTypeInfo { - private final AbstractType source; - private final AbstractType in; - private final AbstractType out; - - public ResourceTypeInfo(AbstractType source, AbstractType in, AbstractType out) { - super(); - this.source = source; - this.in = in; - this.out = out; - } - - public AbstractType getSource() { - return source; - } - - public AbstractType getIn() { - return in; - } - - public AbstractType getOut() { - return out; - } - } - - private Map resourceTypes = new HashMap<>(); - - - public ResourceTypeRegistry() { - } - - public void def(String resourceTypeName, AbstractType source, AbstractType in, AbstractType out) { - Assert.isLegal(!resourceTypes.containsKey(resourceTypeName), "Multiple definitions for '"+resourceTypeName+"'"); - resourceTypes.put(resourceTypeName, new ResourceTypeInfo(source, in, out)); - } - - public YType getSourceType(String typeTag) { - if (typeTag!=null) { - ResourceTypeInfo v = resourceTypes.get(typeTag); - if (v!=null) { - return v.getSource(); - } - } - return null; - } - - public YType getInParamsType(String typeTag) { - if (typeTag!=null) { - ResourceTypeInfo v = resourceTypes.get(typeTag); - if (v!=null) { - return v.getIn(); - } - } - return null; - } - - public YType getOutParamsType(String typeTag) { - if (typeTag!=null) { - ResourceTypeInfo v = resourceTypes.get(typeTag); - if (v!=null) { - return v.getOut(); - } - } - return null; - } - -} diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/StaleFallbackCache.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/StaleFallbackCache.java deleted file mode 100644 index 069c636ee..000000000 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/StaleFallbackCache.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse.util; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.springframework.ide.vscode.commons.util.Assert; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; - -/** - * A simple cache implementation that provides an option for lookups to fallback - * to a 'stale' cache entry when computing a current one fails. - */ -public class StaleFallbackCache{ - - private static class Versioned { - int version; - T it; - public Versioned(int version, T it) { - super(); - this.version = version; - this.it = it; - } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((it == null) ? 0 : it.hashCode()); - result = prime * result + version; - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Versioned other = (Versioned) obj; - if (it == null) { - if (other.it != null) - return false; - } else if (!it.equals(other.it)) - return false; - if (version != other.version) - return false; - return true; - } - @Override - public String toString() { - return "Versioned [version=" + version + ", it=" + it + "]"; - } - } - - Map staleEntries = new HashMap<>(); - Cache>> latestEntries = CacheBuilder.newBuilder().build(); - - public synchronized V get(K key, int version, boolean allowStaleEntries, Callable valueLoader) throws Exception { - Versioned> latest = latestEntries.get(key, () -> new Versioned<>(version, load(valueLoader))); - if (latest.version!=version) { - latestEntries.invalidate(key); - keepStaleBackup(key, latest); - latest = latestEntries.get(key, () -> new Versioned<>(version, load(valueLoader))); - } - if (!allowStaleEntries) { - return future_get(version, latest); - } else { - if (latest.it.isCompletedExceptionally()) { - V staleValue = staleEntries.get(key); - if (staleValue!=null) { - return staleValue; - } - } - return future_get(latest.it); - } - } - - /** - * Called when a stale entry is found in the 'latest' map. This method is - * responsible for determining if the entry should be kept as a staleBackup, - * and store it. - */ - private void keepStaleBackup(K key, Versioned> latest) { - try { - staleEntries.put(key, latest.it.get()); - } catch (InterruptedException | ExecutionException e) { - //ignore: This means its a 'bad' entry and so we don't want to keep it - // as a 'stale backup'. - } - } - - private V future_get(int wantedVersion, Versioned> versioned) throws Exception { - Assert.isLegal(wantedVersion==versioned.version); - return future_get(versioned.it); - } - - private V future_get(CompletableFuture f) throws Exception { - try { - return f.get(); - } catch (InterruptedException e) { - throw e; - } catch (ExecutionException e) { - throw ExceptionUtil.exception(e.getCause()); - } - } - - private CompletableFuture load(Callable valueLoader) { - CompletableFuture future = new CompletableFuture(); - try { - V value = valueLoader.call(); - Assert.isNotNull(value); - future.complete(value); - } catch (Throwable e) { - future.completeExceptionally(e); - } - return future; - } - -} diff --git a/headless-services/bosh-language-server/src/main/resources/desc/AggregateStep/aggregate.html b/headless-services/bosh-language-server/src/main/resources/desc/AggregateStep/aggregate.html deleted file mode 100644 index ce79386e5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/AggregateStep/aggregate.html +++ /dev/null @@ -1,19 +0,0 @@ -

Performs the given steps in parallel.

If any sub-steps in an aggregate result in an error, the aggregate step as a -whole is considered to have errored.

Similarly, when aggregating task steps, if any -fail, the aggregate step will fail. This is useful for build matrixes:

plan:
-- get: some-repo
-- aggregate:
-  - task: unit-windows
-    file: some-repo/ci/windows.yml
-  - task: unit-linux
-    file: some-repo/ci/linux.yml
-  - task: unit-darwin
-    file: some-repo/ci/darwin.yml

The aggregate step is also useful for performing arbitrary steps in -parallel, for the sake of speeding up the build. It is often used to fetch -all dependent resources together:

plan:
-- aggregate:
-  - get: component-a
-  - get: component-b
-  - get: integration-suite
-- task: integration
-  file: integration-suite/task.yml
\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/BoshDeploymentManifest/name.md b/headless-services/bosh-language-server/src/main/resources/desc/BoshDeploymentManifest/name.md new file mode 100644 index 000000000..a6fe2bbf9 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/desc/BoshDeploymentManifest/name.md @@ -0,0 +1 @@ +*Required*. The name of the deployment. A single Director can manage multiple deployments and distinguishes them by name. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Command/args.md b/headless-services/bosh-language-server/src/main/resources/desc/Command/args.md deleted file mode 100644 index f85023400..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Command/args.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Arguments to pass to the command. Note that when executed with `fly`, any arguments passed to `fly` are appended to this array. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Command/dir.md b/headless-services/bosh-language-server/src/main/resources/desc/Command/dir.md deleted file mode 100644 index 4bba020e5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Command/dir.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A directory, relative to the initial working directory, to set as the working directory when running the script. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Command/path.md b/headless-services/bosh-language-server/src/main/resources/desc/Command/path.md deleted file mode 100644 index c78f746cd..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Command/path.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The command to execute, relative to the task's working directory. For a script living in a resource's repo, you must specify the full path to the resource, i.e. `my-resource/scripts/test`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Command/user.md b/headless-services/bosh-language-server/src/main/resources/desc/Command/user.md deleted file mode 100644 index f33af8a90..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Command/user.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Explicitly set the user to run as. If not specified, this defaults to the user configured by the task's image. If not specified there, it's up to the Garden backend, and may be e.g. `root` on Linux. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DoStep/do.md b/headless-services/bosh-language-server/src/main/resources/desc/DoStep/do.md deleted file mode 100644 index 8d8d7247e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DoStep/do.md +++ /dev/null @@ -1,14 +0,0 @@ -Run steps in series. - - do: [step] - -Simply performs the given steps serially, with the same semantics as if they were at the top level step listing. - -This can be used to perform multiple steps serially in the branch of an `aggregate` step: - - plan: - - aggregate: - - task: unit - - do: - - get: something-else - - task: something-else-unit \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/rootfs.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/rootfs.md deleted file mode 100644 index f812e427c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/rootfs.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Place a `.tar` file of the image in the destination. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/save.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/save.md deleted file mode 100644 index bcf7fe797..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/save.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Place a `docker save`d image in the destination. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/skip_download.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/skip_download.md deleted file mode 100644 index a1b7ed4b7..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageGetParams/skip_download.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Skip `docker pull` of image. Artifacts based -on the image will not be present. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build.md deleted file mode 100644 index ef4eabe34..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The path of a directory containing a `Dockerfile` to build. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args.md deleted file mode 100644 index 71f7bf1bc..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args.md +++ /dev/null @@ -1,10 +0,0 @@ -*Optional.* A map of Docker build arguments. - -Example: - -```yaml -build_args: - do_thing: true - how_many_things: 2 - email: me@yopmail.com -``` \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args_file.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args_file.md deleted file mode 100644 index 239fe5a2a..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/build_args_file.md +++ /dev/null @@ -1,8 +0,0 @@ -Optional.* Path to a JSON file containing Docker build -arguments. - -Example file contents: - -```yaml -{ "email": "me@yopmail.com", "how_many_things": 1, "do_thing": false } -``` diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache.md deleted file mode 100644 index 8544d7d44..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache.md +++ /dev/null @@ -1,10 +0,0 @@ -*Optional.* Default `false`. When the `build` parameter is set, -first pull `image:tag` from the Docker registry (so as to use cached -intermediate images when building). This will cause the resource to fail -if it is set to `true` and the image does not exist yet. -Note: Since docker 1.10 docker images [do not contain all necessary metadata to -restore the build cache](https://github.com/docker/docker/issues/20316). -Additional metadata needs to be saved and re-applied after a docker pull to have -subsequent builds skip identical intermediate layers. This additional -metadata is stored as a very small separate image (`image:${cache_tag}-buildcache`) -in the repository of this resource. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache_tag.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache_tag.md deleted file mode 100644 index b11bbd395..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/cache_tag.md +++ /dev/null @@ -1,5 +0,0 @@ -*Optional.* Default `tag`. The specific tag to pull before -building when `cache` parameter is set. Instead of pulling the same tag -that's going to be built, this allows picking a different tag like -`latest` or the previous version. This will cause the resource to fail -if it is set to a tag that does not exist yet. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/dockerfile.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/dockerfile.md deleted file mode 100644 index 0996e62e7..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/dockerfile.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The path of the `Dockerfile` in the directory if -it's not at the root of the directory. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/import_file.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/import_file.md deleted file mode 100644 index 1370ba817..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/import_file.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A path to a file to `docker import` and then push. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load.md deleted file mode 100644 index 6324d79c4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The path of a directory containing an image that was -fetched using this same resource with `save: true`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_base.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_base.md deleted file mode 100644 index b91eff174..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_base.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* A path to a directory containing an image to `docker load` -before running `docker build`. The directory must have `image`, -`image-id`, `repository`, and `tag` present, i.e. the tree produced by `/in`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_file.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_file.md deleted file mode 100644 index 67dd9a5f5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_file.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* A path to a file to `docker load` and then push. -Requires `load_repository`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_repository.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_repository.md deleted file mode 100644 index 4986b8982..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_repository.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The repository of the image loaded from `load_file`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_tag.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_tag.md deleted file mode 100644 index 6d5917920..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/load_tag.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Default `latest`. The tag of image loaded from `load_file`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_repository.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_repository.md deleted file mode 100644 index b8c4c4776..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_repository.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* **DEPRECATED. Use `get` and `load` instead.** A -path to a repository to pull down, and then push to this resource. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_tag.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_tag.md deleted file mode 100644 index ffd469b37..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/pull_tag.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* **DEPRECATED. Use `get` and `load` instead.** Default -`latest`. The tag of the repository to pull down via `pull_repository`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag.md deleted file mode 100644 index 6a46f0cd4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The value should be a path to a file containing the name -of the tag. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_as_latest.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_as_latest.md deleted file mode 100644 index fbf8d18cf..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_as_latest.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Default `false`. If true, the pushed image will -be tagged as `latest` in addition to whatever other tag was specified. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_prefix.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_prefix.md deleted file mode 100644 index 3fd747124..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImagePutParams/tag_prefix.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* If specified, the tag read from the file will be -prepended with this string. This is useful for adding `v` in front of version -numbers. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_access_key_id.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_access_key_id.md deleted file mode 100644 index cb6086bd1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_access_key_id.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* AWS access key to use for acquiring ECR -credentials. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_secret_access_key.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_secret_access_key.md deleted file mode 100644 index 00813dec6..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/aws_secret_access_key.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* AWS secret key to use for acquiring ECR -credentials. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/ca_certs.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/ca_certs.md deleted file mode 100644 index 2345ae69f..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/ca_certs.md +++ /dev/null @@ -1,25 +0,0 @@ -*Optional.* An array of objects with the following format: - -```yaml -ca_certs: -- domain: example.com:443 - cert: | - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- -- domain: 10.244.6.2:443 - cert: | - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- -``` - -Each entry specifies the x509 CA certificate for the trusted docker registry -residing at the specified domain. This is used to validate the certificate of -the docker registry when the registry's certificate is signed by a custom -authority (or itself). - -The domain should match the first component of `repository`, including the -port. If the registry specified in `repository` does not use a custom cert, -adding `ca_certs` will break the check script. This option is overridden by -entries in `insecure_registries` with the same address or a matching CIDR. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/client_certs.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/client_certs.md deleted file mode 100644 index 2fc026793..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/client_certs.md +++ /dev/null @@ -1,27 +0,0 @@ -*Optional.* An array of objects with the following format: - -```yaml -client_certs: -- domain: example.com:443 - cert: | - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- - key: | - -----BEGIN RSA PRIVATE KEY----- - ... - -----END RSA PRIVATE KEY----- -- domain: 10.244.6.2:443 - cert: | - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- - key: | - -----BEGIN RSA PRIVATE KEY----- - ... - -----END RSA PRIVATE KEY----- -``` - -Each entry specifies the x509 certificate and key to use for authenticating -against the docker registry residing at the specified domain. The domain -should match the first component of `repository`, including the port. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/insecure_registries.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/insecure_registries.md deleted file mode 100644 index a8224ddc5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/insecure_registries.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* An array of CIDRs or `host:port` addresses -to whitelist for insecure access (either `http` or unverified `https`). -This option overrides any entries in `ca_certs` with the same address. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/password.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/password.md deleted file mode 100644 index 379efeb90..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/password.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The password to use when authenticating. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/registry_mirror.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/registry_mirror.md deleted file mode 100644 index 01e59e6f1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/registry_mirror.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A URL pointing to a docker registry mirror service. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/repository.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/repository.md deleted file mode 100644 index c27a71499..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/repository.md +++ /dev/null @@ -1,2 +0,0 @@ -*Required.* The name of the repository, e.g. -`concourse/docker-image-resource`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/tag.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/tag.md deleted file mode 100644 index 26580a132..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/tag.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The tag to track. Defaults to `latest`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/username.md b/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/username.md deleted file mode 100644 index cf075df25..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/DockerImageSource/username.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The username to authenticate with when pushing. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/get.md b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/get.md deleted file mode 100644 index e8edb17eb..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/get.md +++ /dev/null @@ -1,21 +0,0 @@ -Fetches a resource, making it available to subsequent steps via the given name. - -For example, the following plan fetches a version number via the `semver` resource, bumps it to the next release candidate, and `put`s it back. - -``` -plan: -- get: version - params: - bump: minor - rc: true -- put: version - params: - version: version/number -``` - -``` -get: string -``` - -*Required.* The logical name of the resource being fetched. This name satisfies logical inputs to a [Task](https://concourse.ci/concepts.html#tasks), and may be referenced within the plan itself (e.g. in the `file` attribute of a `task` step). - diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/params.html b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/params.html deleted file mode 100644 index 2f1f1c177..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/params.html +++ /dev/null @@ -1,3 +0,0 @@ -

Optional. A map of arbitrary configuration to forward to the -resource. Refer to the resource type's documentation to see what it -supports.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/passed.html b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/passed.html deleted file mode 100644 index bc8bc8bad..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/passed.html +++ /dev/null @@ -1,15 +0,0 @@ -

Optional. When specified, only the versions of the resource that -made it through the given list of jobs will be considered when triggering -and fetching.

Note that if multiple gets are configured with passed -constraints, all of the mentioned jobs are correlated. That is, with the -following set of inputs:

plan:
-- get: a
-  passed: [a-unit, integration]
-- get: b
-  passed: [b-unit, integration]
-- get: x
-  passed: [integration]

This means "give me the versions of a, b, and x that -have passed the same build of integration, with the same -version of a passing a-unit and the same version of -b passing b-unit."

This is crucial to being able to implement safe "fan-in" semantics as -things progress through a pipeline.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/resource.html b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/resource.html deleted file mode 100644 index 68d05e7d4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/resource.html +++ /dev/null @@ -1,2 +0,0 @@ -

Optional. Defaults to name. The resource to fetch, as -configured in resources.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/trigger.html b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/trigger.html deleted file mode 100644 index 87bc54c0b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/trigger.html +++ /dev/null @@ -1,4 +0,0 @@ -

Optional. Default false. Set to true to auto-trigger -new builds of the plan's job whenever this step has new versions available, -as specified by the resource and any passed constraints.

Otherwise, if no get steps set this to true, the job can only -be manually triggered.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/version.html b/headless-services/bosh-language-server/src/main/resources/desc/GetStep/version.html deleted file mode 100644 index 6020386a9..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GetStep/version.html +++ /dev/null @@ -1,11 +0,0 @@ -

Optional. Defaults to latest. The version of the resource to -fetch.

If set to latest, scheduling will just find the latest available -version of a resource and use it, allowing versions to be skipped. This is -usually what you want, e.g. if someone pushes 100 git commits.

If set to every, builds will walk through all available versions of -the resource. Note that if passed is also configured, it will only -step through the versions satisfying the constraints.

If set to a specific version (e.g. {ref: abcdef123}), only that -version will be used. Note that the version must be available and detected by -the resource, otherwise the input will never be satisfied. You may want to -use check-resource to force detection of resource versions, -if you need to use an older one that was never detected (as all newly -configured resources start from the latest version).

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/depth.md b/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/depth.md deleted file mode 100644 index 8852e81a9..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/depth.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* If a positive integer is given, *shallow* clone the -repository using the `--depth` option. Using this flag voids your warranty. -Some things will stop working unless we have the entire history. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/disable_git_lfs.md b/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/disable_git_lfs.md deleted file mode 100644 index 283869244..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/disable_git_lfs.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* If `true`, will not fetch Git LFS files. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/submodules.md b/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/submodules.md deleted file mode 100644 index 6c40d6a9b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitGetParams/submodules.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* If `none`, submodules will not be fetched. If specified as -a list of paths, only the given paths will be fetched. If not specified, -or if `all` is explicitly specified, all submodules are fetched. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/annotate.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/annotate.md deleted file mode 100644 index 0e9c7ef40..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/annotate.md +++ /dev/null @@ -1,5 +0,0 @@ -*Optional.* If specified the tag will be an -[annotated](https://git-scm.com/book/en/v2/Git-Basics-Tagging#Annotated-Tags) -tag rather than a -[lightweight](https://git-scm.com/book/en/v2/Git-Basics-Tagging#Lightweight-Tags) -tag. The value should be a path to a file containing the annotation message. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/force.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/force.md deleted file mode 100644 index e4a4af8a0..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/force.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* When set to 'true' this will force the branch to be -pushed regardless of the upstream state. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/only_tag.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/only_tag.md deleted file mode 100644 index 93e82f426..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/only_tag.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* When set to 'true' push only the tags of a repo. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/rebase.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/rebase.md deleted file mode 100644 index 14a019fe3..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/rebase.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* If pushing fails with non-fast-forward, continuously -attempt rebasing and pushing. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/repository.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/repository.md deleted file mode 100644 index 898005d5b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/repository.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The path of the repository to push to the source. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag.md deleted file mode 100644 index 0e7b837b5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* If this is set then HEAD will be tagged. The value should be -a path to a file containing the name of the tag. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag_prefix.md b/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag_prefix.md deleted file mode 100644 index 9bb7c5f3c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitPutParams/tag_prefix.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* If specified, the tag read from the file will be -prepended with this string. This is useful for adding `v` in front of -version numbers. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/branch.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/branch.md deleted file mode 100644 index d27d625bb..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/branch.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The branch the file lives on. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/file.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/file.md deleted file mode 100644 index 18bf4ab73..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/file.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the file in the repository. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/git_user.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/git_user.md deleted file mode 100644 index 546c806b1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/git_user.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The git identity to use when pushing to the -repository support RFC 5322 address of the form "Gogh Fir \" or "foo@example.com". \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/password.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/password.md deleted file mode 100644 index e48119630..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/password.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Password for HTTP(S) auth when pulling/pushing. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/private_key.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/private_key.md deleted file mode 100644 index ac2a43083..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/private_key.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The SSH private key to use when pulling from/pushing to to the repository. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/uri.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/uri.md deleted file mode 100644 index 553b9e6ce..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/uri.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The repository URL. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/username.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/username.md deleted file mode 100644 index 3272745f5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSemverSource/username.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* Username for HTTP(S) auth when pulling/pushing. -This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth) -and auth is required. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/branch.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/branch.md deleted file mode 100644 index 5725f0537..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/branch.md +++ /dev/null @@ -1,3 +0,0 @@ -The branch to track. This is *optional* if the resource is -only used in `get` steps (default value in this case is `master`). -However, it is *required* when used in a `put` step. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_key_ids.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_key_ids.md deleted file mode 100644 index 08a57f180..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_key_ids.md +++ /dev/null @@ -1,9 +0,0 @@ -*Optional.* Array of GPG public key ids that -the resource will check against to verify the commit (details below). The -corresponding keys will be fetched from the key server specified in -`gpg_keyserver`. The ids can be short id, long id or fingerprint. - -If `commit_verification_keys` or `commit_verification_key_ids` is specified in -the source configuration, it will additionally verify that the resulting commit -has been GPG signed by one of the specified keys. It will error if this is not -the case. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_keys.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_keys.md deleted file mode 100644 index 905888e0c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/commit_verification_keys.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* Array of GPG public keys that the -resource will check against to verify the commit. - -If `commit_verification_keys` or `commit_verification_key_ids` is specified in -the source configuration, it will additionally verify that the resulting commit -has been GPG signed by one of the specified keys. It will error if this is not -the case. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/disable_ci_skip.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/disable_ci_skip.md deleted file mode 100644 index 0b24f2efa..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/disable_ci_skip.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Allows for commits that have been labeled with `[ci skip]` or `[skip ci]` -previously to be discovered by the resource. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/git_config.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/git_config.md deleted file mode 100644 index 604851a39..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/git_config.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* If specified as (list of pairs `name` and `value`) -it will configure git global options, setting each name with each value. - -This can be useful to set options like `credential.helper` or similar. - -See the [`git-config(1)` manual page](https://www.kernel.org/pub/software/scm/git/docs/git-config.html) -for more information and documentation of existing git options. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/gpg_keyserver.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/gpg_keyserver.md deleted file mode 100644 index ea28fe083..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/gpg_keyserver.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* GPG keyserver to download the public keys from. -Defaults to `hkp:///keys.gnupg.net/`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/ignore_paths.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/ignore_paths.md deleted file mode 100644 index 7b829339a..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/ignore_paths.md +++ /dev/null @@ -1,10 +0,0 @@ -*Optional.* A list of glob patterns. The inverse of `paths`; changes -to the specified files are ignored. - -Note that if you want to push commits that change these files via a `put`, -the commit will still be "detected", as [`check` and `put` both introduce -versions](https://concourse.ci/pipeline-mechanics.html#collecting-versions). -To avoid this you should define a second resource that you use for commits -that change files that you don't want to feed back into your pipeline - think -of one as read-only (with `ignore_paths`) and one as write-only (which -shouldn't need it). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/password.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/password.md deleted file mode 100644 index 5bdec2ca5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/password.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* Password for HTTP(S) auth when pulling/pushing. - -Note: You can also use pipeline templating to hide this password in source control. (For more information: https://concourse.ci/fly-set-pipeline.html) diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/paths.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/paths.md deleted file mode 100644 index bad6585c9..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/paths.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* If specified (as a list of glob patterns), only changes -to the specified files will yield new versions from `check`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/private_key.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/private_key.md deleted file mode 100644 index 509214543..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/private_key.md +++ /dev/null @@ -1,12 +0,0 @@ -*Optional.* Private key to use when pulling/pushing. - -Example: - - private_key: | - -----BEGIN RSA PRIVATE KEY----- - MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W - - DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l - -----END RSA PRIVATE KEY----- - -Note: You can also use pipeline templating to hide this private key in source control. (For more information: https://concourse.ci/fly-set-pipeline.html) \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/skip_ssl_verification.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/skip_ssl_verification.md deleted file mode 100644 index a0164dd20..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/skip_ssl_verification.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Skips git ssl verification by exporting -`GIT_SSL_NO_VERIFY=true`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/tag_filter.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/tag_filter.md deleted file mode 100644 index bc17098c1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/tag_filter.md +++ /dev/null @@ -1,4 +0,0 @@ -`tag_filter`: *Optional.* If specified, the resource will only detect commits -that have a tag matching the specified expression. Patterns are -[glob(7)](http://man7.org/linux/man-pages/man7/glob.7.html) compatible (as -in, bash compatible). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/uri.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/uri.md deleted file mode 100644 index 967245f59..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/uri.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The location of the repository. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/username.md b/headless-services/bosh-language-server/src/main/resources/desc/GitSource/username.md deleted file mode 100644 index 3272745f5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/GitSource/username.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* Username for HTTP(S) auth when pulling/pushing. -This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth) -and auth is required. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Group/jobs.md b/headless-services/bosh-language-server/src/main/resources/desc/Group/jobs.md deleted file mode 100644 index 4b6d86fa1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Group/jobs.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A list of jobs that should appear in this group. A job may appear in multiple groups. Neighbours of jobs in the current group will also appear on the same page in order to give context of the location of the group in the pipeline. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Group/name.md b/headless-services/bosh-language-server/src/main/resources/desc/Group/name.md deleted file mode 100644 index b30efbf64..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Group/name.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the group. This should be short and simple as it will be used as the tab name for navigation. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Group/resources.md b/headless-services/bosh-language-server/src/main/resources/desc/Group/resources.md deleted file mode 100644 index 654156983..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Group/resources.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A list of resources that should appear in this group. Resources that are inputs or outputs of jobs in the group are automatically added; they do not have to be explicitly listed here. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/build_logs_to_retain.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/build_logs_to_retain.html deleted file mode 100644 index 2f2a2bdfd..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/build_logs_to_retain.html +++ /dev/null @@ -1,10 +0,0 @@ -

Optional. If configured, only the last specified number of builds -will have their build logs persisted. This is useful if you have a job that -runs periodically but after some amount of time the logs aren't worth keeping -around.

Example:

jobs:
-- name: smoke-tests
-  build_logs_to_retain: 100
-  plan:
-  - get: 10m
-  - task: smoke-tests
-    # ...
\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/disable_manual_trigger.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/disable_manual_trigger.html deleted file mode 100644 index 1ff175fc4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/disable_manual_trigger.html +++ /dev/null @@ -1,3 +0,0 @@ -

Optional. Default false. If set to true, manual -triggering of the job (via the web UI or trigger-job) will be -disabled.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/ensure.md b/headless-services/bosh-language-server/src/main/resources/desc/Job/ensure.md deleted file mode 100644 index ec1422364..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/ensure.md +++ /dev/null @@ -1 +0,0 @@ -*Optional*. Step to execute regardless of whether the job succeeds, fails, or errors. Equivalent to the `ensure` step attribute. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/interruptible.md b/headless-services/bosh-language-server/src/main/resources/desc/Job/interruptible.md deleted file mode 100644 index c3656f993..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/interruptible.md +++ /dev/null @@ -1 +0,0 @@ -*Optional*. *Default* false. Normally, when a worker is shutting down it will wait for builds with containers running on that worker to finish before exiting. If this value is set to `true`, the worker will not wait on the builds of this job. You may want this if e.g. you have a self-deploying Concourse or long-running-but-low-importance jobs. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/max_in_flight.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/max_in_flight.html deleted file mode 100644 index 4f3c9b2ff..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/max_in_flight.html +++ /dev/null @@ -1,3 +0,0 @@ -

Optional. If set, specifies a maximum number of builds to run at a -time. If serial or serial_groups are set, they take precedence -and force this value to be 1.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/name.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/name.html deleted file mode 100644 index d28cecdb4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/name.html +++ /dev/null @@ -1,2 +0,0 @@ -

Required. The name of the job. This should be short; it will show up -in URLs.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/on_failure.md b/headless-services/bosh-language-server/src/main/resources/desc/Job/on_failure.md deleted file mode 100644 index 406c6f08e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/on_failure.md +++ /dev/null @@ -1 +0,0 @@ -*Optional*. Step to execute when the job fails. Equivalent to the `on_failure` step attribute. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/on_success.md b/headless-services/bosh-language-server/src/main/resources/desc/Job/on_success.md deleted file mode 100644 index c02d807ea..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/on_success.md +++ /dev/null @@ -1 +0,0 @@ -*Optional*. Step to execute when the job succeeds. Equivalent to the `on_success` step attribute. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/plan.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/plan.html deleted file mode 100644 index 515d2aee3..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/plan.html +++ /dev/null @@ -1,60 +0,0 @@ -

Each Job has a single build plan. When a build of a job is -created, the plan determines what happens.

A build plan is a sequence of steps to execute. These steps may fetch -down or update Resources, or execute -Tasks.

A new build of the job is scheduled whenever get steps with -trigger: true have new versions available.

To visualize the job in the pipeline, resources that appear as get -steps are drawn as inputs, and resources that appear in put steps -appear as outputs.

A simple unit test job may look something like:

name: banana-unit
-plan:
-- get: banana
-  trigger: true
-- task: unit
-  file: banana/task.yml

This job says: get the banana resource, -and run a task step called unit, using -the configuration from the task.yml file fetched from the banana -step.

When new versions of banana are detected, a new build of -banana-unit will be scheduled, because we've set trigger: true.

Jobs can depend on resources that are produced by or pass through upstream -jobs, by configuring passed: [job-a, job-b] on the -get step.

Putting these pieces together, if we were to propagate banana from -the above example into an integration suite with another apple -component (pretending we also defined its apple-unit job), the -configuration for the integration job may look something like:

name: fruit-basket-integration
-plan:
-- aggregate:
-  - get: banana
-    trigger: true
-    passed: [banana-unit]
-  - get: apple
-    trigger: true
-    passed: [apple-unit]
-  - get: integration-suite
-    trigger: true
-- task: integration
-  file: integration-suite/task.yml

Note the use of the aggregate step to -collect multiple inputs at once.

With this example we've configured a tiny pipeline that will automatically -run unit tests for two components, and continuously run integration tests -against whichever versions pass both unit tests.

This can be further chained into later "stages" of your pipeline; for -example, you may want to continuously deliver an artifact built from -whichever components pass fruit-basket-integration.

To push artifacts, you would use a put step -that targets the destination resource. For example:

name: deliver-food
-plan:
-- aggregate:
-  - get: banana
-    trigger: true
-    passed: [fruit-basket-integration]
-  - get: apple
-    trigger: true
-    passed: [fruit-basket-integration]
-  - get: baggy
-    trigger: true
-- task: shrink-wrap
-  file: baggy/shrink-wrap.yml
-- put: bagged-food
-  params:
-    bag: shrink-wrap/bagged.tgz

This presumes that there's a bagged-food -resource defined, which understands that the -bag parameter points to a file to ship up to the resource's location.

Note that both banana and apple list the same job as an -upstream dependency. This guarantees that deliver-food will only -trigger when a version of both of these dependencies pass through the same -build of the integration job (and transitively, their individual unit jobs). -This prevents bad apples or bruised bananas from being delivered. (I'm sorry.)

diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/public.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/public.html deleted file mode 100644 index 6a6efde48..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/public.html +++ /dev/null @@ -1,5 +0,0 @@ -

Optional. Default false. If set to true, the build log -of this job will be viewable by unauthenticated users. Unauthenticated users -will always be able to see the inputs, outputs, and build status history of a -job. This is useful if you would like to expose your pipeline publicly without -showing sensitive information in the build log.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/serial.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/serial.html deleted file mode 100644 index 2f736b864..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/serial.html +++ /dev/null @@ -1,2 +0,0 @@ -

Optional. Default false. If set to true, builds will -queue up and execute one-by-one, rather than executing in parallel.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Job/serial_groups.html b/headless-services/bosh-language-server/src/main/resources/desc/Job/serial_groups.html deleted file mode 100644 index 9669bd49e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Job/serial_groups.html +++ /dev/null @@ -1,12 +0,0 @@ -

Optional. Default []. When set to an array of arbitrary -tag-like strings, builds of this job and other jobs referencing the same -tags will be serialized.

This can be used to ensure that certain jobs do not run at the same time, -like so:

jobs:
-- name: job-a
-  serial_groups: [some-tag]
-- name: job-b
-  serial_groups: [some-tag, some-other-tag]
-- name: job-c
-  serial_groups: [some-other-tag]

In this example, job-a and job-c can run concurrently, but -neither job can run builds at the same time as job-b.

The builds are executed in their order of creation, across all jobs with -common tags.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/groups.md b/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/groups.md deleted file mode 100644 index ca5c424f2..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/groups.md +++ /dev/null @@ -1,21 +0,0 @@ -Splitting up your pipeline into sections. - -A pipeline may optionally contain a section called `groups`. As more resources and jobs are added to a pipeline it can become difficult to navigate. Pipeline groups allow you to group jobs together under a header and have them show on different tabs in the user interface. Groups have no functional effect on your pipeline. - -A simple grouping for the pipeline above may look like: - - groups: - - name: tests - jobs: - - controller-mysql - - controller-postgres - - worker - - integration - - name: deploy - jobs: - - deploy - -This would display two tabs at the top of the home page: "tests" and "deploy". Once you have added groups to your pipeline then all jobs must be in a group otherwise they will not be visible. - -For a real world example of how groups can be used to simplify navigation and provide logical grouping, see the groups used at the top of the page in the [Concourse pipeline](https://ci.concourse.ci/). - diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/jobs.html b/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/jobs.html deleted file mode 100644 index 02dcf4194..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/jobs.html +++ /dev/null @@ -1,16 +0,0 @@ -

At a high level, a job describes some actions to perform when dependent -resources change (or when manually triggered). For example, you may define a -job that runs your unit tests whenever new code is pushed to a repository.

Jobs can be thought of as functions with inputs and outputs, that -automatically run when new inputs are available. A job can depend on the -outputs of upstream jobs, which is the root of pipeline functionality.

The definition of actions to perform is done via a -Build Plan, which is a very powerful -composition-based DSL that can express anything from running simple unit -tests to running a matrix of tasks and aggregating the result.

Builds

An instance of execution of a job's plan is called a build. A build -can either succeed or fail, or error if something unrelated to your code -goes wrong (i.e. if one of your workers falls off the face of the earth).

When a build runs, the job's plan is realized. Each step described by the -job's plan is executed, and so long as all Tasks succeed, the -build succeeds. If a task fails, the build fails, and its resources do not -propagate to the rest of the pipeline.

The containers running in a build can be accessed while they're running -(and also shortly after they finish) via -fly intercept, which can greatly help in -debugging.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resource_types.html b/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resource_types.html deleted file mode 100644 index 9d1ab14eb..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resource_types.html +++ /dev/null @@ -1,52 +0,0 @@ -

Additional resource types used by your pipeline.

- -

Each resource in a pipeline has a type. The resource's type determines -what versions are detected, the bits that are fetched when used for a -get step, and the side effect that occurs when used for a -put step.

Out of the box, Concourse comes with a few resource types to cover common CI -use cases like dealing with Git repositories and S3 buckets.

Beyond these core types, each pipeline can configure its own custom types by -specifying resource_types at the top level. Each custom resource type is -itself defined as a resource that provides the container image for the custom -resource type (see Implementing a Resource). You will almost always -be using the -docker-image -resource type when doing this.

The following example extends a Concourse pipeline to support use of the -pull-request -resource type and then uses it within the pipeline:

resource_types:
-- name: pull-request
-  type: docker-image
-  source:
-    repository: jtarchie/pr
-
-resources:
-- name: atomy-pr
-  type: pull-request
-  source:
-    repo: vito/atomy
-    access_token: {{access-token}}
-
-jobs:
-- name: atomy-pr-unit
-  plan:
-  - get: atomy-pr
-  - put: atomy-pr
-    params:
-      path: atomy-pr
-      status: pending
-  - task: unit
-    file: atomy-pr/ci/unit.yml
-    on_success:
-      put: atomy-pr
-      params:
-        path: atomy-pr
-        status: success
-    on_failure:
-      put: atomy-pr
-      params:
-        path: atomy-pr
-        status: failure

Custom resource types can override the core resource types, and can be defined -in terms of each other. Also, a custom resource type can use the core type that -it's overriding. This is useful if you want to e.g. provide your own custom -docker-image resource, by overriding the core one (and using it one last -time for the override itself), and then using it for all other custom resource -types.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resources.html b/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resources.html deleted file mode 100644 index 33f4a0a51..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Pipeline/resources.html +++ /dev/null @@ -1,14 +0,0 @@ -

A resource is any entity that can be checked for new versions, pulled down -at a specific version, and/or pushed up to idempotently create new versions. -A common example would be a git repository, but it can also represent more -abstract things like -time itself.

At its core, Concourse knows nothing about things like git. Instead, -it consumes a generic interface implemented by resource types. This -allows Concourse to be extended by configuring workers with resource type -implementations.

This abstraction is immensely powerful, as it does not limit Concourse to -whatever things its authors thought to integrate with. Instead, as a user of -Concourse you can just reuse resource type implementations, or -implement your own.

To use resources, configure them in your pipeline via the -resources section, and use them in -your Build Plans via the get and -put steps.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/acquire.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/acquire.md deleted file mode 100644 index 60f66b773..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/acquire.md +++ /dev/null @@ -1,3 +0,0 @@ -If true, we will attempt to move a randomly chosen lock from the -pool's unclaimed directory to the claimed directory. Acquiring will retry -until a lock becomes available. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add.md deleted file mode 100644 index 5b179306b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add.md +++ /dev/null @@ -1,4 +0,0 @@ -If set, we will add a new lock to the pool in the unclaimed state. The -value is the path to a directory containing the files `name` and `metadata` -which should contain the name of your new lock and the contents you would like -in the lock, respectively. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add_claimed.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add_claimed.md deleted file mode 100644 index 0939518de..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/add_claimed.md +++ /dev/null @@ -1 +0,0 @@ -Exactly the same as the `add` param, but adds a lock to the pool in the *claimed* state. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/claim.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/claim.md deleted file mode 100644 index 635e3d973..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/claim.md +++ /dev/null @@ -1,3 +0,0 @@ -If set, the specified lock from the pool will be acquired, rather -than a random one (as in `acquire`). Like `acquire`, claiming will retry -until the specific lock becomes available \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/release.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/release.md deleted file mode 100644 index 60be75b5f..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/release.md +++ /dev/null @@ -1,8 +0,0 @@ -If set, we will release the lock by moving it from claimed to -unclaimed. The value is the path of the lock to release (a directory -containing `name` and `metadata`), which typically is just the step that -provided the lock (either a `get` to pass one along or a `put` to acquire). - -Note: the lock must be available in your job before you can release it. In -other words, a `get` step to fetch metadata about the lock is necessary -before a `put` step can release the lock. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/remove.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/remove.md deleted file mode 100644 index 23e0c0aaf..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolPutParams/remove.md +++ /dev/null @@ -1,4 +0,0 @@ -If set, we will remove the given lock from the pool. The value is -the same as `release`. This can be used for e.g. tearing down an environment, -or moving a lock between pools by using `add` with a different pool in a -second step. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/branch.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/branch.md deleted file mode 100644 index 1fb447919..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/branch.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The branch to track. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/password.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/password.md deleted file mode 100644 index e48119630..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/password.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Password for HTTP(S) auth when pulling/pushing. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/pool.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/pool.md deleted file mode 100644 index 7cab7c010..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/pool.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The logical name of your pool of things to lock. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/private_key.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/private_key.md deleted file mode 100644 index 477801d95..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/private_key.md +++ /dev/null @@ -1,10 +0,0 @@ -*Optional.* Private key to use when pulling/pushing. Ensure it does not require a password. - -Example: - - private_key: | - -----BEGIN RSA PRIVATE KEY----- - MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W - - DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l - -----END RSA PRIVATE KEY----- diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/retry_delay.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/retry_delay.md deleted file mode 100644 index 85740560e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/retry_delay.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* If specified, dictates how long to wait until retrying -to acquire a lock or release a lock. The default is 10 seconds. -Valid values: `60s`, `90m`, `1h`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/uri.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/uri.md deleted file mode 100644 index 967245f59..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/uri.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The location of the repository. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/username.md b/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/username.md deleted file mode 100644 index 4a8ff53bf..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PoolSource/username.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Username for HTTP(S) auth when pulling/pushing. -This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth) and auth is required. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/get_params.md b/headless-services/bosh-language-server/src/main/resources/desc/PutStep/get_params.md deleted file mode 100644 index 5b998b34f..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/get_params.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* A map of arbitrary configuration to forward to the resource that will be utilized during the implicit `get` step. Refer to the resource type's documentation to see what it supports. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/params.md b/headless-services/bosh-language-server/src/main/resources/desc/PutStep/params.md deleted file mode 100644 index 6cddc2438..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/params.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* A map of arbitrary configuration to forward to the resource. - -Refer to the resource type's documentation to see what it supports. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/put.md b/headless-services/bosh-language-server/src/main/resources/desc/PutStep/put.md deleted file mode 100644 index 4811bc0a5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/put.md +++ /dev/null @@ -1,37 +0,0 @@ -Pushes to the given [Resource](https://concourse.ci/concepts.html#resources). -All artifacts collected during the plan's execution will be available in the working directory. - -For example, the following plan fetches a repo using [get](https://concourse.ci/get-step.html) and pushes it to another repo (assuming `repo-develop` and `repo-master` are defined as `git` resources): - -``` -plan: -- get: repo-develop -- put: repo-master - params: - repository: repo-develop -``` - -When the `put` succeeds, the produced version of the resource will be immediately fetched via an implicit `get` step. This is so that later steps in your plan can use the artifact that was produced. The source will be available under whatever name `put` specifies, just like as with `get`. - -So, if the logical name (whatever put specifies) differs from the concrete resource, you would specify resource as well, like so: - -``` -plan: -- put: resource-image - resource: docker-image-resource -``` - -Additionally, you can control the settings of the implicit `get` step by setting get_params. For example, if you did not want a put step utilizing the `docker-image` resource type to download the image, you would implement your `put` step as such: - -``` -plan: -- put: docker-build - params: build: git-resource - get_params: skip_download: true -``` - -``` -put: string -``` - -Required. The logical name of the resource being pushed. The pushed resource will be available under this name after the push succeeds. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/resource.md b/headless-services/bosh-language-server/src/main/resources/desc/PutStep/resource.md deleted file mode 100644 index 2d615d13d..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/PutStep/resource.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* Defaults to `name`. - -The resource to update, as configured in [resources](https://concourse.ci/configuring-resources.html). diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Resource/check_every.md b/headless-services/bosh-language-server/src/main/resources/desc/Resource/check_every.md deleted file mode 100644 index 79739b2ec..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Resource/check_every.md +++ /dev/null @@ -1 +0,0 @@ -*Optional. Default 1m.* The interval on which to check for new versions of the resource. Acceptable interval options are defined by the [time.ParseDuration function](https://golang.org/pkg/time/#ParseDuration). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Resource/name.md b/headless-services/bosh-language-server/src/main/resources/desc/Resource/name.md deleted file mode 100644 index 7c5ceaa24..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Resource/name.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the resource. This should be short and simple. This name will be referenced by [build plans](https://concourse.ci/build-plans.html) of jobs in the pipeline. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Resource/source.md b/headless-services/bosh-language-server/src/main/resources/desc/Resource/source.md deleted file mode 100644 index 0b00bce8e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Resource/source.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* The location of the resource. This varies by resource type, and is a black box to Concourse; it is blindly passed to the resource at runtime. - -To use `git` as an example, the source may contain the repo URI, the branch of the repo to track, and a private key to use when pushing/pulling. - -By convention, documentation for each resource type's configuration is in each implementation's `README`. - -You can find the source for the resource types provided with Concourse at the [Concourse GitHub organization](https://github.com/concourse?query=-resource). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Resource/type.md b/headless-services/bosh-language-server/src/main/resources/desc/Resource/type.md deleted file mode 100644 index 230728a11..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Resource/type.md +++ /dev/null @@ -1,3 +0,0 @@ -*Required.* The type of the resource. Each worker advertises a mapping of `resource-type -> container-image; type` corresponds to the key in the map. - -To see what resource types your deployment supports, check the status of your worker pool via the `/api/v1/workers` API endpoint. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Resource/webhook_token.md b/headless-services/bosh-language-server/src/main/resources/desc/Resource/webhook_token.md deleted file mode 100644 index b5802320a..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Resource/webhook_token.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* If specified, web hooks can be sent to trigger an immediate *check* of the resource, specifying this value as a primitive form of authentication via query params. - -After configuring this value, you would then configure your hook sender with the following painfully long path appended to your external URL: - - /api/v1/teams/TEAM_NAME/pipelines/PIPELINE_NAME/resources/RESOURCE_NAME/check/webhook?webhook_token=WEBHOOK_TOKEN - -Note that the request payload sent to this API endpoint is entirely ignored. You should configure the resource as if you're not using web hooks, as the resource config is still the "source of truth." \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/name.md b/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/name.md deleted file mode 100644 index 61acfa9dd..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/name.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the new resource type. This should be short and simple. This name will be referenced by `resources` defined within the same pipeline, and `image_resource`s used by tasks running in the pipeline. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/source.md b/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/source.md deleted file mode 100644 index 13c2f5ab1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/source.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* The location of the resource type's resource. This varies by resource type, and is a black box to Concourse; it is blindly passed to the resource at runtime. - -To use `docker-image` as an example, the source would contain something like `repository: username/reponame`. See the [Docker Image resource](https://github.com/concourse/docker-image-resource) (or whatever resource type your resource type uses) for more information. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/type.md b/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/type.md deleted file mode 100644 index 255250fbc..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/ResourceType/type.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The type of the resource used to provide the resource type's container image. Yes, this is a bit meta. Usually this will be `docker-image`, as the resource type must result in a container image, though there may be other image formats (possibly themselves defined as custom resource types!). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/acl.md b/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/acl.md deleted file mode 100644 index 8b245c1a8..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/acl.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* [Canned Acl](http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) -for the uploaded object. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/content_type.md b/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/content_type.md deleted file mode 100644 index ae3b6f14a..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/content_type.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* MIME [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17) -describing the contents of the uploaded object \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/file.md b/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/file.md deleted file mode 100644 index b93b97374..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3PutParams/file.md +++ /dev/null @@ -1,5 +0,0 @@ -*Required.* Path to the file to upload, provided by an output of a task. -If multiple files are matched by the glob, an error is raised. The file which -matches will be placed into the directory structure on S3 as defined in `regexp` -in the resource definition. The matching syntax is bash glob expansion, so -no capture groups, etc. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/access_key_id.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/access_key_id.md deleted file mode 100644 index 68933f84d..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/access_key_id.md +++ /dev/null @@ -1,2 +0,0 @@ -*Required.* The AWS access key to use when accessing the -bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/bucket.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/bucket.md deleted file mode 100644 index e65e4327b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/bucket.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/disable_ssl.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/disable_ssl.md deleted file mode 100644 index cd4f41ae6..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/disable_ssl.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Disable SSL for the endpoint, useful for S3 compatible providers without SSL. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/endpoint.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/endpoint.md deleted file mode 100644 index 442b89ec4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/endpoint.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Custom endpoint for using S3 compatible provider. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/key.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/key.md deleted file mode 100644 index 9e947f52c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/key.md +++ /dev/null @@ -1,2 +0,0 @@ -*Required.* The key to use for the object in the bucket tracking -the version. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/region_name.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/region_name.md deleted file mode 100644 index c94da2f51..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/region_name.md +++ /dev/null @@ -1 +0,0 @@ -*Optional. Default `us-east-1`.* The region the bucket is in. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/secret_access_key.md b/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/secret_access_key.md deleted file mode 100644 index f664ee0b4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3SemverSource/secret_access_key.md +++ /dev/null @@ -1,2 +0,0 @@ -*Required.* The AWS secret key to use when accessing -the bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/access_key_id.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/access_key_id.md deleted file mode 100644 index 123cbf661..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/access_key_id.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The AWS access key to use when accessing the bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/bucket.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/bucket.md deleted file mode 100644 index e65e4327b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/bucket.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The name of the bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/cloudfront_url.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/cloudfront_url.md deleted file mode 100644 index 16f45d3c0..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/cloudfront_url.md +++ /dev/null @@ -1,6 +0,0 @@ -*Optional.* The URL (scheme and domain) of your CloudFront distribution that is fronting this bucket (e.g -`https://d5yxxxxx.cloudfront.net`). This will affect `in` but not `check` -and `put`. `in` will ignore the `bucket` name setting, exclusively using the -`cloudfront_url`. When configuring CloudFront with versioned buckets, set -`Query String Forwarding and Caching` to `Forward all, cache based on all` to -ensure S3 calls succeed. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/disable_ssl.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/disable_ssl.md deleted file mode 100644 index 4845041f7..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/disable_ssl.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Disable SSL for the endpoint, useful for S3 -compatible providers without SSL. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/endpoint.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/endpoint.md deleted file mode 100644 index 2f1b0368b..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/endpoint.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Custom endpoint for using S3 compatible provider. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/private.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/private.md deleted file mode 100644 index 2dda82f96..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/private.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* Indicates that the bucket is private, so that any -URLs provided are signed. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/regexp.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/regexp.md deleted file mode 100644 index f4d4c4729..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/regexp.md +++ /dev/null @@ -1,4 +0,0 @@ -*Optional.* The pattern to match filenames against within S3. The first -grouped match is used to extract the version, or if a group is explicitly -named `version`, that group is used. At least one capture group must be -specified, with parentheses. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/region_name.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/region_name.md deleted file mode 100644 index 331284d84..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/region_name.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The region the bucket is in. Defaults to `us-east-1`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/secret_access_key.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/secret_access_key.md deleted file mode 100644 index abf82eab1..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/secret_access_key.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The AWS secret key to use when accessing the bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/server_side_encryption.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/server_side_encryption.md deleted file mode 100644 index 4a8c7026e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/server_side_encryption.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* An encryption algorithm to use when storing objects in S3. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/sse_kms_key_id.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/sse_kms_key_id.md deleted file mode 100644 index b95ea1d4f..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/sse_kms_key_id.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The ID of the AWS KMS master encryption key -used for the object. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/use_v2_signing.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/use_v2_signing.md deleted file mode 100644 index 2f70faa9c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/use_v2_signing.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Use signature v2 signing, useful for S3 compatible providers that do not support v4. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/versioned_file.md b/headless-services/bosh-language-server/src/main/resources/desc/S3Source/versioned_file.md deleted file mode 100644 index 7c8553219..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/S3Source/versioned_file.md +++ /dev/null @@ -1,4 +0,0 @@ -*Optional* If you enable versioning for your S3 bucket then -you can keep the file name the same and upload new versions of your file -without resorting to version numbers. This property is the path to the file -in your S3 bucket. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/bump.md b/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/bump.md deleted file mode 100644 index ff0eeb339..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/bump.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* Bump the version number semantically. The value must -be one of: - - * `major`: Bump the major version number, e.g. `1.0.0` -> `2.0.0`. - * `minor`: Bump the minor version number, e.g. `0.1.0` -> `0.2.0`. - * `patch`: Bump the patch version number, e.g. `0.0.1` -> `0.0.2`. - * `final`: Promote the version to a final version, e.g. `1.0.0-rc.1` -> `1.0.0`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/pre.md b/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/pre.md deleted file mode 100644 index caa1b40ac..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SemverGetParams/pre.md +++ /dev/null @@ -1,8 +0,0 @@ -*Optional.* When bumping, bump to a prerelease (e.g. `rc` or -`alpha`), or bump an existing prerelease. - - If present, and the version is already a prerelease matching this value, -its number is bumped. If the version is already a prerelease of another -type, (e.g. `alpha` vs. `beta`), the type is switched and the prerelease -version is reset to `1`. If the version is *not* already a pre-release, then -`pre` is added, starting at `1`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SemverPutParams/file.md b/headless-services/bosh-language-server/src/main/resources/desc/SemverPutParams/file.md deleted file mode 100644 index 95cf05f23..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SemverPutParams/file.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* Path to a file containing the version number to set. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/driver.md b/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/driver.md deleted file mode 100644 index e42f1bcf4..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/driver.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional. Default `s3`.* The driver to use for tracking the -version. Determines where the version is stored. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/initial_version.md b/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/initial_version.md deleted file mode 100644 index 9660956cd..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SemverSource/initial_version.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The version number to use when bootstrapping, i.e. when -there is not a version number present in the source. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/attempts.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/attempts.md deleted file mode 100644 index 050e1c5c5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/attempts.md +++ /dev/null @@ -1,19 +0,0 @@ -Retry a step. - -Any step can set the number of times it should be attempted by attaching an `attempts` parameter with the number of times it should be tried. - - attempts: integer - -The total number of times a step should be tried should it fail, e.g. `5` will try the step up to 5 times before giving up. - -When the number of attempts is reached and the step has still not succeeded then the step will fail. - -Attempts will retry on a Concourse error as well as build failure. - -The following will run the task, and retry it 9 times (for a total of 10 attempts) if it fails: - - plan: - - get: foo - - task: unit - file: foo/unit.yml - attempts: 10 \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/ensure.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/ensure.md deleted file mode 100644 index 32090af8c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/ensure.md +++ /dev/null @@ -1,22 +0,0 @@ -Guarantee execution of a step. - -Any step can have `ensure` tacked onto it, whose value is a second step to execute regardless of the result of the parent step. - - ensure: step - -The step to execute. Regardless of whether the parent step succeeds, fails, or errors, this step will be executed. The step will also be executed if the build was aborted, and its parent step was interrupted. - -If the parent step succeeds and the ensured step fails, the parent step is considered to have failed. - -The ensured step executes after any `on_success` or `on_failure` hooks. - -For example, the following build plan acquires a lock, and then ensures that the lock is released. - - plan: - - put: some-lock - params: acquire: true - - task: integration - file: foo/integration.yml - ensure: - put: some-lock - params: release: some-lock \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/on_failure.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/on_failure.md deleted file mode 100644 index 6422ddadf..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/on_failure.md +++ /dev/null @@ -1,15 +0,0 @@ -Any step can have `on_failure` tacked onto it, whose value is a second step to execute only if the parent step fails. - - on_failure: step - -The step to execute when the parent step fails. If the attached step succeeds, the entire step is still failed. - -The following will perform the attached task only if the first one fails: - - plan: - - get: foo - - task: unit - file: foo/unit.yml - on_failure: - task: alert - file: foo/alert.yml \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/on_success.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/on_success.md deleted file mode 100644 index 319b50941..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/on_success.md +++ /dev/null @@ -1,26 +0,0 @@ -Any step can have `on_success` tacked onto it, whose value is a second step to execute only if the parent step succeeds. - - on_success: step - -The step to execute when the parent step succeeds. If the attached step fails, the outer step is considered to have failed. - -The following will perform the second task only if the first one succeeds: - - plan: - - get: foo - - task: unit - file: foo/unit.yml - on_success: - task: alert - file: foo/alert.yml - -Note that this is semantically equivalent to the following: - - plan: - - get: foo - - task: unit - file: foo/unit.yml - - task: alert - file: foo/alert.yml - -...however it is provided mainly for cases where there is an equivalent `on_failure`, and having them next to each other is more clear. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/tags.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/tags.md deleted file mode 100644 index 51c02b011..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/tags.md +++ /dev/null @@ -1,9 +0,0 @@ -Perform a step on certain workers. - -Any step can be directed at a pool of workers for a given set of tags, by adding the `tags` attribute to it. - - tags: [string] - -*Optional. Default* `[]`. The tags by which to match workers. - -For example, if `[a, b]` is specified, only workers advertising the `a` and `b` tags (or any others) will be used for running the step. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Step/timeout.md b/headless-services/bosh-language-server/src/main/resources/desc/Step/timeout.md deleted file mode 100644 index 7b39c49c5..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/Step/timeout.md +++ /dev/null @@ -1,17 +0,0 @@ -Enforce a time limit on a step. - -Any step can have a hard time limit enforced by attaching timeout and the number of seconds to limit it to. - - timeout: duration - -The amount of time to limit the step's execution to, e.g. `30m` for 30 minutes. - -When exceeded, the step will be interrupted, with the same semantics as aborting the build (except the build will be `failed`, not `aborted`, to distinguish between human intervention and timeouts being enforced). - -The following will run the task, and cancel it if it takes longer than 1 hour and 30 minutes: - - plan: - - get: foo - - task: unit - file: foo/unit.yml - timeout: 1h30m \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/SwiftSemverSource/openstack.md b/headless-services/bosh-language-server/src/main/resources/desc/SwiftSemverSource/openstack.md deleted file mode 100644 index f4fd9255e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/SwiftSemverSource/openstack.md +++ /dev/null @@ -1,14 +0,0 @@ -*Required.* All openstack configuration must go under this key. - - * `container`: *Required.* The name of the container. - - * `item_name`: *Required.* The item name to use for the object in the container tracking -the version. - - * `region_name`: *Required.* The region the container is in. - - * `identity_endpoint`, `username`, `user_id`, `password`, `api_key`, `domain_id`, `domain_name`, `tenant_id`, `tenant_name`, `allow_reauth`, `token_id`: See below -The swift driver uses [gophercloud](http://gophercloud.io/docs/) to handle interacting -with OpenStack. All OpenStack Identity versions are supported through this library. The -Authentication properties will pass through to it. For detailed information about the -individual parameters, see https://github.com/rackspace/gophercloud/blob/master/auth_options.go \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image.md deleted file mode 100644 index 8ed654518..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* A string specifying the rootfs of the container, as interpreted -by your worker's Garden backend. - -You should only use this if you cannot use `image_resource` for some reason, -and you know what you're doing. - -WARNING: This property has been renamed to `rootfs_uri` in Concourse 3.0. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image_resource.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image_resource.md deleted file mode 100644 index e4704e722..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/image_resource.md +++ /dev/null @@ -1,22 +0,0 @@ -*Optional.* The base image of the container. This style of specifying the base image has the same effect as `image:` but uses Concourse resources to download the image. The contents of this field should be the same as a resource configuration in your pipeline (without the name). - -The following example configures the task to use the `golang:1.6` Docker image: - - image_resource: - type: docker-image - source: {repository: golang, tag: "1.6"} - -...and the following example uses an insecure private Docker registry with a username and password: - - image_resource: - type: docker-image - source: - repository: my.local.registry:8080/my/image - insecure_registries: ["my.local.registry:8080"] - username: myuser - password: mypass - email: x@x.com - -You can use any resource that returns a filesystem in the correct format (a `/rootfs` directory and a `metadata.json` file in the top level) but normally this will be the [Docker Image resource](https://github.com/concourse/docker-image-resource). If you'd like to make a resource of your own that supports this please use that as a reference implementation for now. - -If you want to use an artifact source within the plan containing an image, you must set the [image](https://concourse.ci/task-step.html#task-image) in the plan step instead. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/inputs.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/inputs.md deleted file mode 100644 index 94b55bbae..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/inputs.md +++ /dev/null @@ -1,3 +0,0 @@ -*Required.* The expected set of inputs for the task. - -This determines which artifacts will propagate into the task, as the [build plan](https://concourse.ci/build-plans.html) executes. If any specified inputs are not present, the task will end with an error, without running. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/outputs.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/outputs.md deleted file mode 100644 index 0d7bee54e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/outputs.md +++ /dev/null @@ -1,35 +0,0 @@ -*Optional.* The artifacts produced by the task. - -Each output configures a directory to make available to later steps in the [build plan](https://concourse.ci/build-plans.html). The directory will be automatically created before the task runs, and the task should place any artifacts it wants to export in the directory. - -For example, the following task and script would be used to propagate a built binary to later steps: - - --- - platform: linux - - image_resource: # ... - - inputs: - - name: project-src - - outputs: - - name: built-project - - run: - path: project-src/ci/build - -...assuming `project-src/ci/build` looks something like: - - #!/bin/bash - set -e -u -x - export GOPATH=$PWD/project-src - go build -o built-project/my-project github.com/concourse/my-project - -...this task could then be used in a build plan like so: - - plan: - - get: project-src - - task: build-bin - file: project-src/ci/build.yml - - put: project-bin - params: file: built-project/my-project diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/params.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/params.md deleted file mode 100644 index b85bdb50e..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/params.md +++ /dev/null @@ -1,3 +0,0 @@ -*Optional.* A key-value mapping of values that are exposed to the task via environment variables. - -Use this to provide things like credentials, not to set up the task's Bash environment (they do not support interpolation). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/platform.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/platform.md deleted file mode 100644 index ff0e53c63..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/platform.md +++ /dev/null @@ -1,3 +0,0 @@ -*Required.* The platform the task should run on. By convention, `windows`, -`linux`, or `darwin` are specified. This determines the pool of workers -that the task can run against. The base deployment provides Linux workers. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/rootfs_uri.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/rootfs_uri.md deleted file mode 100644 index e40eca352..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/rootfs_uri.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional.* A string specifying the rootfs of the container, as interpreted -by your worker's Garden backend. - -You should only use this if you cannot use `image_resource` for some reason, -and you know what you're doing. - -Note: Prior to Concourse 3.0 this property was called `image`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/run.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/run.md deleted file mode 100644 index d9e161e21..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskConfig/run.md +++ /dev/null @@ -1,3 +0,0 @@ -*Required.* The command to execute in the container. - -Note that this is *not* provided as a script blob, but explicit `path` and `args` values; this allows `fly` to forward arguments to the script, and forces your config `.yml` to stay fairly small. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/name.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/name.md deleted file mode 100644 index 41ef05673..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/name.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The logical name of the input. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/path.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/path.md deleted file mode 100644 index c6a4d1486..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskInput/path.md +++ /dev/null @@ -1 +0,0 @@ -*Optional.* The path where the input will be placed. If not specified, the input's name is used. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/name.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/name.md deleted file mode 100644 index 654fe6ff0..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/name.md +++ /dev/null @@ -1 +0,0 @@ -*Required.* The logical name of the output. The contents under `path` will be made available to the rest of the plan under this name. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/path.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/path.md deleted file mode 100644 index 7d2d72973..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskOutput/path.md +++ /dev/null @@ -1,4 +0,0 @@ -*Optional.* The path to a directory where the output will be taken from. If not specified, the output's `name` is used. - -Note that this value must not overlap with any other inputs or outputs. Each output results in a new empty directory that your task should place artifacts in; if the path overlaps it'll clobber whatever files used to be there. - diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/config.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/config.md deleted file mode 100644 index dd419a36c..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/config.md +++ /dev/null @@ -1,3 +0,0 @@ -*One of `config` or `file` attributes is required.* - -Use `config` to inline the task config statically. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/file.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/file.md deleted file mode 100644 index f2eaf8b67..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/file.md +++ /dev/null @@ -1,13 +0,0 @@ -*One of `config` or `file` attributes is required.* - -`file` points at a `.yml` file containing the task config, which allows this to be tracked with your resources. - -The first segment in the path should refer to another source from the plan, and the rest of the path is relative to that source. - -For example, if in your plan you have the following `get` step: - - - get: something - -And the `something` resource provided a `unit.yml` file, you would set - - file: something/unit.yml. diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/image.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/image.md deleted file mode 100644 index 0ab89af03..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/image.md +++ /dev/null @@ -1,33 +0,0 @@ -*Optional.* Names an artifact source within the plan containing an image to use for the task. This overrides any `image` or `image_resource` configuration present in the task configuration. - -This is very useful when part of your pipeline involves building an image, possibly with dependencies pre-baked. You can then propagate that image through the rest of your pipeline, guaranteeing that the correct version (and thus a consistent set of dependencies) is used throughout your pipeline. - -For example, here's a pipeline building an image in one job and propagating it to the next: - - resources: - - name: my-project - type: git - source: {uri: https://github.com/my-user/my-project} - - - name: my-task-image - type: docker-image - source: {repository: my-user/my-repo} - - jobs: - - name: build-task-image - plan: - - get: my-project - - put: my-task-image - params: {build: my-project/ci/images/my-task} - - - name: use-task-image - plan: - - get: my-task-image - passed: [build-task-image] - - get: my-project - passed: [build-task-image] - - task: use-task-image - image: my-task-image - file: my-project/ci/tasks/my-task.yml - -This can also be used in the simpler case of explicitly keeping track of dependent images, in which case you just wouldn't have a job building it (`build-task-image` in the above example). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/input_mapping.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/input_mapping.md deleted file mode 100644 index f2645f6dc..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/input_mapping.md +++ /dev/null @@ -1,14 +0,0 @@ -*Optional.* A map from task input names to concrete names in the build plan. This allows a task with generic input names to be used multiple times in the same plan, mapping its inputs to specific resources within the plan. - -For example: - - plan: - - get: diego-release - - get: cf-release - - get: ci-scripts - - task: audit-diego-release - file: ci-scripts/audit-release.yml - input_mapping: {release-repo: diego-release} - - task: audit-cf-release - file: ci-scripts/audit-release.yml - input_mapping: {release-repo: cf-release} \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/output_mapping.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/output_mapping.md deleted file mode 100644 index 8e1e5ee77..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/output_mapping.md +++ /dev/null @@ -1,16 +0,0 @@ -*Optional.* A map from task output names to concrete names to register in the build plan. This allows a task with generic output names to be used multiple times in the same plan. - -This is often used together with input_mapping. For example: - - plan: - - get: diego-release - - get: cf-release - - get: ci-scripts - - task: create-diego-release - file: ci-scripts/create-release.yml - input_mapping: {release-repo: diego-release} - output_mapping: {release-tarball: diego-release-tarball} - - task: create-cf-release - file: ci-scripts/create-release.yml - input_mapping: {release-repo: cf-release} - output_mapping: {release-tarball: cf-release-tarball} \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/params.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/params.md deleted file mode 100644 index e8b25a714..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/params.md +++ /dev/null @@ -1,14 +0,0 @@ -*Optional.* A map of task parameters to set, overriding those configured in `config` or `file`. This is useful for passing in credentials or other configuration to the task from the pipeline. - -For example: - - plan: - - get: my-repo - - task: integration - file: my-repo/ci/integration.yml - params: - REMOTE_SERVER: 10.20.30.40:8080 - USERNAME: my-user - PASSWORD: my-pass - -This is often used in combination with `{{parameters}}` in the pipeline. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/privileged.html b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/privileged.html deleted file mode 100644 index 3b1229b65..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/privileged.html +++ /dev/null @@ -1,8 +0,0 @@ -privileged: boolean

Optional. Default false. If set to true, the task will -run with full capabilities, as determined by the Garden backend the task runs -on. For Linux-based backends it typically determines whether or not the -container will run in a separate user namespace, and whether the root -user is "actual" root (if set to true) or a user namespaced -root (if set to false, the default).

This is a gaping security hole; use wisely and only if necessary. This is not -part of the task configuration to prevent privilege escalation via pull -requests.

\ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/task.md b/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/task.md deleted file mode 100644 index 2f4b0a502..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TaskStep/task.md +++ /dev/null @@ -1,30 +0,0 @@ -Executes a [Task](https://concourse.ci/concepts.html#tasks), either from a file fetched via the preceding steps, or with inlined configuration. - - task: string - -Required. A freeform name for the task that's being executed. Common examples would be `unit` or `integration`. - -If any task in the build plan fails, the build will complete with failure. By default, any subsequent steps will not be performed. You can perform additional steps after failure by adding a `on_failure` or `ensure` step. - -For example, the following plan fetches a single repository and executes multiple tasks, using the `aggregate` step, in a build matrix style configuration: - - plan: - - get: my-repo - - aggregate: - - task: go-1.3 - file: my-repo/go-1.3.yml - - task: go-1.4 - file: my-repo/ci/go-1.4.yml - -Only if both tasks succeed will the build go green. - -When a task completes, the files in its declared outputs will be made available to subsequent steps. This allows those subsequent steps to process the result of a task. For example, the following plan pulls down a repo, makes a commit to it, and pushes the commit to another repo (the task must have an output called `repo-with-commit`): - - plan: - - get: my-repo - - task: commit - file: my-repo/commit.yml - - put: other-repo - params: - repository: repo-with-commit - diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/days.md b/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/days.md deleted file mode 100644 index 9745a7732..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/days.md +++ /dev/null @@ -1,6 +0,0 @@ -*Optional.* Run only on these day(s). Supported days are: `Sunday`, -`Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday` and `Saturday`. - -e.g. - - days: [Monday, Wednesday] diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/interval.md b/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/interval.md deleted file mode 100644 index 7284eb0ac..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/interval.md +++ /dev/null @@ -1,2 +0,0 @@ -*Optional.* The interval on which to report new versions. Valid -values: `60s`, `90m`, `1h`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/location.md b/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/location.md deleted file mode 100644 index 566d5fed2..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/location.md +++ /dev/null @@ -1,7 +0,0 @@ -*Optional. Default `UTC`.* The -[location](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) in -which to interpret `start`, `stop`, and `days`. - -e.g. - - location: Africa/Abidjan diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/start.md b/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/start.md deleted file mode 100644 index bac338139..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/start.md +++ /dev/null @@ -1,11 +0,0 @@ -*Optional.* Only create new time versions between `start` and `stop` -time range. The supported time formats are: `3:04 PM`, `3PM`, `3 PM`, -`15:04`, and `1504`. - -e.g. - - start: 8:00 PM - stop: 9:00 PM - -**Deprecation: an offset may be appended, e.g. `+0700` or `-0400`, but you -should use `location` instead.** diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/stop.md b/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/stop.md deleted file mode 100644 index bac338139..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TimeSource/stop.md +++ /dev/null @@ -1,11 +0,0 @@ -*Optional.* Only create new time versions between `start` and `stop` -time range. The supported time formats are: `3:04 PM`, `3PM`, `3 PM`, -`15:04`, and `1504`. - -e.g. - - start: 8:00 PM - stop: 9:00 PM - -**Deprecation: an offset may be appended, e.g. `+0700` or `-0400`, but you -should use `location` instead.** diff --git a/headless-services/bosh-language-server/src/main/resources/desc/TryStep/try.md b/headless-services/bosh-language-server/src/main/resources/desc/TryStep/try.md deleted file mode 100644 index 9f13e64e9..000000000 --- a/headless-services/bosh-language-server/src/main/resources/desc/TryStep/try.md +++ /dev/null @@ -1,17 +0,0 @@ -Permit failure of a step. - - try: step - -Performs the given step, swallowing any failure. - -This can be used when you want to perform some side-effect, but you don't really want the whole build to fail if it doesn't work. For example, when emitting logs to S3 for analyzing later, if S3 flakes out it's not too critical. - - plan: - - task: run-tests - config: # ... - on_success: - try: - put: test-logs - from: run-tests/*.log - - task: do-something-else - config: # ... \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java new file mode 100644 index 000000000..3c8283b7b --- /dev/null +++ b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2016 Pivotal, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.concourse; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.ide.vscode.bosh.BoshLanguageServer; +import org.springframework.ide.vscode.commons.util.text.LanguageId; +import org.springframework.ide.vscode.languageserver.testharness.Editor; +import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness; + +public class BoshEditorTest { + + LanguageServerHarness harness; + + @Before public void setup() throws Exception { + harness = new LanguageServerHarness(() -> { + return new BoshLanguageServer() + .setMaxCompletions(100); + }, + LanguageId.BOSH_DEPLOYMENT + ); + harness.intialize(null); + } + + @Test public void toplevelV2PropertyNamesKnown() throws Exception { + Editor editor = harness.newEditor( + "name: some-name\n" + + "blah: hoooo\n" + ); + editor.assertProblems( + "blah|Unknown property" + ); + } + + @Test public void toplevelV2PropertyHovers() throws Exception { + Editor editor = harness.newEditor( + "name: some-name\n" + + "blah: hoooo\n" + ); + editor.assertHoverContains("name", "The name of the deployment"); + } + + @Test public void toplevelV2PropertyCompletions() throws Exception { + Editor editor = harness.newEditor( + "<*>\n" + ); + editor.assertCompletions( + "name: <*>" + ); + } + +} diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServerTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshLanguageServerTest.java similarity index 81% rename from headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServerTest.java rename to headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshLanguageServerTest.java index c0418f3f5..3b542dd30 100644 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServerTest.java +++ b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshLanguageServerTest.java @@ -20,19 +20,18 @@ import java.nio.file.Paths; import org.eclipse.lsp4j.InitializeResult; import org.eclipse.lsp4j.TextDocumentSyncKind; import org.junit.Test; -import org.springframework.ide.vscode.concourse.ConcourseLanguageServer; +import org.springframework.ide.vscode.bosh.BoshLanguageServer; import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness; -import static org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngineOptions.*; -public class ConcourseLanguageServerTest { +public class BoshLanguageServerTest { public static File getTestResource(String name) throws URISyntaxException { - return Paths.get(ConcourseLanguageServerTest.class.getResource(name).toURI()).toFile(); + return Paths.get(BoshLanguageServerTest.class.getResource(name).toURI()).toFile(); } @Test public void createAndInitializeServerWithWorkspace() throws Exception { - LanguageServerHarness harness = new LanguageServerHarness(() -> new ConcourseLanguageServer(TEST_DEFAULT)); + LanguageServerHarness harness = new LanguageServerHarness(() -> new BoshLanguageServer()); File workspaceRoot = getTestResource("/workspace/"); assertExpectedInitResult(harness.intialize(workspaceRoot)); } @@ -40,7 +39,7 @@ public class ConcourseLanguageServerTest { @Test public void createAndInitializeServerWithoutWorkspace() throws Exception { File workspaceRoot = null; - LanguageServerHarness harness = new LanguageServerHarness(() -> new ConcourseLanguageServer(TEST_DEFAULT)); + LanguageServerHarness harness = new LanguageServerHarness(() -> new BoshLanguageServer()); assertExpectedInitResult(harness.intialize(workspaceRoot)); } diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java deleted file mode 100644 index 097e779b8..000000000 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java +++ /dev/null @@ -1,3928 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import static org.junit.Assert.assertEquals; -import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains; - -import java.io.InputStream; -import java.util.Arrays; -import java.util.List; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.Diagnostic; -import org.eclipse.lsp4j.DiagnosticSeverity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.ide.vscode.commons.util.IOUtil; -import org.springframework.ide.vscode.commons.util.Unicodes; -import org.springframework.ide.vscode.commons.util.text.LanguageId; -import org.springframework.ide.vscode.commons.yaml.completion.YamlCompletionEngineOptions; -import org.springframework.ide.vscode.languageserver.testharness.CodeAction; -import org.springframework.ide.vscode.languageserver.testharness.Editor; -import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness; -import org.springframework.ide.vscode.languageserver.testharness.SynchronizationPoint; - -public class ConcourseEditorTest { - - private static final YamlCompletionEngineOptions OPTIONS = YamlCompletionEngineOptions.TEST_DEFAULT; - - private static final String CURSOR = "<*>"; - LanguageServerHarness harness; - - @Before public void setup() throws Exception { - harness = new LanguageServerHarness(() -> { - return new ConcourseLanguageServer(OPTIONS) - .setMaxCompletions(100); - }, - LanguageId.CONCOURSE_PIPELINE - ); - harness.intialize(null); - } - - @Test public void addSingleRequiredPropertiesQuickfix() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: foo\n" + - " source:\n" + - " username: someone\n" + - "# Confuse" - ); - Diagnostic problem = editor.assertProblems( - "-|'type' is required", - "foo|Unused" - ).get(0); - CodeAction quickfix = editor.assertCodeAction(problem); - assertEquals("Add property 'type'", quickfix.getLabel()); - quickfix.perform(); - - editor.assertText( - "resources:\n" + - "- name: foo\n" + - " source:\n" + - " username: someone\n" + - " type: <*>\n" + - "# Confuse" - ); - } - - @Test public void addMultipleRequiredPropertiesQuickfix() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: foo\n" + - " type: pool\n" + - " source:\n" + - " username: someone\n" - ); - Diagnostic problem = editor.assertProblems( - "foo|Unused", - "source|[branch, pool, uri] are required").get(1); - CodeAction quickfix = editor.assertCodeAction(problem); - assertEquals("Add properties: [branch, pool, uri]", quickfix.getLabel()); - quickfix.perform(); - - editor.assertText( - "resources:\n" + - "- name: foo\n" + - " type: pool\n" + - " source:\n" + - " username: someone\n" + - " branch: <*>\n" + - " pool: \n" + - " uri: \n" - ); - } - - @Test public void reconcileResourceTypeType() throws Exception { - Editor editor; - editor = harness.newEditor( - "resource_types:\n" + - "- name: s3-multi\n" + - " type: # <- bad\n" - ); - editor.assertProblems( - "^ # <- bad|cannot be blank" - ); - - editor = harness.newEditor( - "resource_types:\n" + - "- name: s3-multi\n" + - " type: garbage\n" - ); - editor.assertProblems( - "garbage|Resource Type does not exist" - ); - } - - @Test public void testReconcileCatchesParseError() throws Exception { - Editor editor = harness.newEditor( - "somemap: val\n"+ - "- sequence" - ); - editor.assertProblems( - "-|expected " - ); - } - - @Test public void reconcileRunsOnDocumentOpenAndChange() throws Exception { - Editor editor = harness.newEditor( - "somemap: val\n"+ - "- sequence" - ); - - editor.assertProblems( - "-|expected " - ); - - editor.setText( - "- sequence\n" + - "zomemap: val" - ); - - editor.assertProblems( - "z|expected " - ); - } - - @Test - public void reconcileMisSpelledPropertyNames() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resorces:\n" + - "- name: git\n" + - " type: git\n" - ); - editor.assertProblems("resorces|Unknown property"); - } - - @Test - public void reconcileAcceptsSensiblePipelineFile() throws Exception { - Editor editor; - - editor = harness.newEditor( - getClasspathResourceText("workspace/pipeline.yml") - ); - editor.assertProblems(/*NONE*/);; - } - - private String getClasspathResourceText(String resourceName) throws Exception { - InputStream stream = ConcourseEditorTest.class.getClassLoader().getResourceAsStream(resourceName); - return IOUtil.toString(stream); - } - - @Test - public void reconcileStructuralProblems() throws Exception { - Editor editor; - - //resources should be a sequence not a map, even if there's only one entry - editor = harness.newEditor( - "resources:\n" + - " name: git\n" + - " type: git\n" - ); - editor.assertProblems( - "name: git\n type: git|Expecting a 'Sequence' but found a 'Map'" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - task: a-task\n" + - " tags: a-single-string\n" - ); - editor.assertProblems( - "-^ task|One of [config, file] is required", - "a-single-string|Expecting a 'Sequence'" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - try:\n" + - " put: a-resource\n" - ); - editor.assertProblems( - "a-resource|does not exist" - ); - } - - @Test - public void primaryStepCompletions() throws Exception { - assertContextualCompletions( - // Context: - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - <*>" - , // ============== - "<*>" - , // => - "aggregate:\n" + - " - <*>" - , // ============== - "do:\n" + - " - <*>" - , // ============== - "get: <*>" - , // ============== - "put: <*>" - , // ============== - "task: <*>" - , // ============== - "try:\n" + - " <*>" - ); - } - - @Test - public void PT_136196057_do_step_completion_indentation() throws Exception { - assertCompletions( - "jobs:\n" + - "- name:\n"+ - " plan:\n" + - " - do<*>" - , // => - "jobs:\n" + - "- name:\n"+ - " plan:\n" + - " - do:\n" + - " - <*>" - ); - } - - @Test - public void primaryStepHovers() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - get: something\n" + - " - put: something\n" + - " - do: []\n" + - " - aggregate:\n" + - " - task: perform-something\n" + - " - try:\n" + - " put: test-logs\n" - ); - - editor.assertHoverContains("get", "Fetches a resource"); - editor.assertHoverContains("put", "Pushes to the given [Resource]"); - editor.assertHoverContains("aggregate", "Performs the given steps in parallel"); - editor.assertHoverContains("task", "Executes a [Task]"); - editor.assertHoverContains("do", "performs the given steps serially"); - editor.assertHoverContains("try", "Performs the given step, swallowing any failure"); - } - - @Test - public void putStepHovers() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - put: something\n" + - " resource: something\n" + - " params:\n" + - " some_param: some_value\n" + - " get_params:\n" + - " skip_download: true\n" - ); - - editor.assertHoverContains("resource", "The resource to update"); - editor.assertHoverContains("params", "A map of arbitrary configuration"); - editor.assertHoverContains("get_params", "A map of arbitrary configuration to forward to the resource that will be utilized during the implicit `get` step"); - } - - @Test - public void getStepHovers() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - get: something\n" + - " resource: something\n" + - " version: latest\n" + - " passed: [other-job]\n" + - " params:\n" + - " some_param: some_value\n" + - " trigger: true\n" + - " attempts: 10\n" + - " on_failure:\n" + - " - bogus: bad\n" + - " on_success:\n" + - " - bogus: bad\n" + - " ensure:\n" + - " task: cleanups\n" - ); - editor.assertHoverContains("resource", "The resource to fetch"); - editor.assertHoverContains("version", "The version of the resource to fetch"); - editor.assertHoverContains("params", "A map of arbitrary configuration"); - editor.assertHoverContains("trigger", "Set to `true` to auto-trigger"); - editor.assertHoverContains("attempts", "Any step can set the number of times it should be attempted"); - editor.assertHoverContains("on_failure", "Any step can have `on_failure` tacked onto it"); - editor.assertHoverContains("on_success", "Any step can have `on_success` tacked onto it"); - editor.assertHoverContains("ensure", "a second step to execute regardless of the result of the parent step"); - } - - @Test - public void groupHovers() throws Exception { - Editor editor = harness.newEditor( - "groups:\n" + - "- name: some-group\n" + - " resources: []\n" + - " jobs: []\n" - ); - editor.assertHoverContains("name", "The name of the group"); - editor.assertHoverContains("resources", "A list of resources that should appear in this group"); - editor.assertHoverContains("jobs", " A list of jobs that should appear in this group"); - } - - @Test - public void concourse_3_0_rootfs_uri_prop() throws Exception { - Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "platform: linux\n" + - "image: blah\n" + - "run:\n" + - " path: demo-repo/ci/tasks/run-tests.sh" - ); - Diagnostic p = editor.assertProblems("image|renamed to 'rootfs_uri'").get(0); - assertEquals(DiagnosticSeverity.Warning, p.getSeverity()); - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "platform: linux\n" + - "image: blah\n" + - "run:\n" + - " path: demo-repo/ci/tasks/run-tests.sh" - ); - editor.assertHoverContains("image", "renamed to `rootfs_uri`"); - } - - @Test - public void taskStepHovers() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - task: do-something\n" + - " file: some-file.yml\n" + - " privileged: true\n" + - " image: some-image\n" + - " params:\n" + - " map: of-stuff\n" + - " input_mapping:\n" + - " map: of-stuff\n" + - " output_mapping:\n" + - " map: of-stuff\n" + - " config: some-config\n" + - " tags: [a, b, c]\n"+ - " attempts: 10\n" + - " timeout: 1h30m\n" + - " ensure:\n" + - " bogus: bad\n" + - " on_failure:\n" + - " bogus: bad\n" + - " on_success:\n" + - " bogus: bad\n" - ); - editor.assertHoverContains("file", "`file` points at a `.yml` file containing the task config"); - editor.assertHoverContains("privileged", "If set to `true`, the task will run with full capabilities"); - editor.assertHoverContains("image", "Names an artifact source within the plan"); - editor.assertHoverContains("params", "A map of task parameters to set, overriding those configured in `config` or `file`"); - editor.assertHoverContains("input_mapping", "A map from task input names to concrete names in the build plan"); - editor.assertHoverContains("output_mapping", "A map from task output names to concrete names"); - editor.assertHoverContains("config", "Use `config` to inline the task config"); - editor.assertHoverContains("tags", "Any step can be directed at a pool of workers"); - editor.assertHoverContains("timeout", "amount of time to limit the step's execution"); - } - - @Test - public void aggregateStepHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "jobs:\n" + - "- name: some-job\n" + - " plan:\n" + - " - aggregate:\n" + - " - get: some-resource\n" - ); - - editor.assertHoverContains("aggregate", "Performs the given steps in parallel"); - } - - @Test - public void reconcileSimpleTypes() throws Exception { - Editor editor; - - //check for 'format' errors: - editor = harness.newEditor( - "jobs:\n" + - "- name: foo\n" + - " serial: boohoo\n" + - " max_in_flight: -1\n" + - " plan:\n" + - " - get: git\n" + - " trigger: yohoho\n" + - " attempts: 0\n" + - " timeout: 1h:30m\n" - ); - editor.assertProblems( - "boohoo|boolean", - "-1|must be positive", - "git|resource does not exist", - "yohoho|boolean", - "0|must be at least 1", - "1h:30m|Duration" - ); - - //check that correct values are indeed accepted - editor = harness.newEditor( - "resources:\n" + - "- name: git\n" + - " type: git\n" + - "jobs:\n" + - "- name: foo\n" + - " serial: true\n" + - " max_in_flight: 2\n" + - " plan:\n" + - " - get: git\n" + - " trigger: true" - ); - editor.assertProblems(/*none*/); - - } - - @Test - public void noListIndent() throws Exception { - Editor editor; - editor = harness.newEditor("jo<*>"); - editor.assertCompletions( - "jobs:\n"+ - "- <*>" - ); - } - - @Test - public void toplevelCompletions() throws Exception { - Editor editor; - editor = harness.newEditor(CURSOR); - editor.assertCompletions( - "groups:\n" + - "- name: <*>" - , // -------------- - "jobs:\n" + - "- <*>" - , // --------------- - "resource_types:\n" + - "- <*>" - , // --------------- - "resources:\n"+ - "- <*>" - ); - - editor = harness.newEditor("rety<*>"); - editor.assertCompletions( - "resource_types:\n" + - "- <*>" - ); - } - - @Test - public void valueCompletions() throws Exception { - String [] builtInResourceTypes = { - "git", "hg", "time", "s3", "archive", - "semver", "github-release", "docker-image", "tracker", - "pool", "cf", - "bosh-io-release", "bosh-io-stemcell", "bosh-deployment", - "vagrant-cloud" - }; - Arrays.sort(builtInResourceTypes); - - String[] expectedCompletions = new String[builtInResourceTypes.length]; - for (int i = 0; i < expectedCompletions.length; i++) { - expectedCompletions[i] = - "resources:\n" + - "- type: "+builtInResourceTypes[i]+"<*>\n" + - " source:"; - } - - assertCompletions( - "resources:\n" + - "- type: <*>\n" + - " source:" - , //=> - expectedCompletions - ); - assertCompletions( - "jobs:\n" + - "- name: foo\n" + - " serial: <*>" - , // => - "jobs:\n" + - "- name: foo\n" + - " serial: false<*>" - , // -- - "jobs:\n" + - "- name: foo\n" + - " serial: true<*>" - ); - } - - @Test - public void topLevelHoverInfos() throws Exception { - Editor editor = harness.newEditor( - "resource_types:\n" + - "- name: s3-multi\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/s3-resource-simple\n" + - "resources:\n" + - "- name: docker-git\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com:spring-projects/sts4.git\n" + - " branch: {{branch}}\n" + - " username: kdvolder\n" + - " private_key: {{rsa_id}}\n" + - " paths:\n" + - " - concourse/docker\n" + - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " - put: docker-image\n" + - " params:\n" + - " build: docker-git/concourse/docker\n" + - " get_params: \n" + - " skip_download: true\n" + - "groups:\n" + - "- name: a-groups\n" - ); - - editor.assertHoverContains("resource_types", "each pipeline can configure its own custom types by specifying `resource_types` at the top level."); - editor.assertHoverContains("resources", "A resource is any entity that can be checked for new versions"); - editor.assertHoverContains("jobs", "At a high level, a job describes some actions to perform"); - editor.assertHoverContains("groups", "A pipeline may optionally contain a section called `groups`"); - } - - @Test - public void reconcileResourceReferences() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: sts4\n" + - " type: git\n" + - " source:\n" + - " uri: https://github.com/kdvolder/somestuff\n" + - " branch: master\n" + - "jobs:\n" + - "- name: job1\n" + - " plan:\n" + - " - get: sts4\n" + - " - get: bogus-get\n" + - " - task: do-stuff\n" + - " image: bogus-image\n" + - " file: some-file.yml\n" + - " input_mapping:\n" + - " task-input: bogus-input\n" + - " repo: sts4\n" + - " - put: bogus-put\n" - ); - editor.assertProblems( - "bogus-get|resource does not exist", - "bogus-image|resource does not exist", -// "bogus-input|resource does not exist", //Not checked anymore. See: https://www.pivotaltracker.com/story/show/145024233 - "bogus-put|resource does not exist" - ); - - editor.assertProblems( - "bogus-get|[sts4]", - "bogus-image|[sts4]", -// "bogus-input|[sts4]", //Not checked anymore. See: https://www.pivotaltracker.com/story/show/145024233 - "bogus-put|[sts4]" - ); - } - - @Test - public void reconcileDuplicateResourceNames() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: sts4\n" + - " type: git\n" + - "- name: utils\n" + - " type: git\n" + - "- name: sts4\n" + - " type: git\n" - ); - editor.assertProblems( - "sts4|Duplicate resource name", - "sts4|Unused", - "utils|Unused", - "sts4|Duplicate resource name", - "sts4|Unused" - ); - } - - @Test - public void reconcileDuplicateResourceTypeNames() throws Exception { - Editor editor = harness.newEditor( - "resource_types:\n" + - "- name: slack-notification\n" + - " type: docker-image\n" + - "- name: slack-notification\n" + - " type: docker-image" - ); - editor.assertProblems( - "slack-notification|Duplicate resource-type name", - "slack-notification|Duplicate resource-type name" - ); - } - - @Test - public void violatedPropertyConstraintsAreWarnings() throws Exception { - Editor editor; - - editor = harness.newEditor( - "jobs:\n" + - "- name: blah" - ); - Diagnostic problem = editor.assertProblems("-^ name: blah|'plan' is required").get(0); - assertEquals(DiagnosticSeverity.Warning, problem.getSeverity()); - - editor = harness.newEditor( - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - task: foo" - ); - problem = editor.assertProblems("-^ task: foo|One of [config, file] is required").get(0); - assertEquals(DiagnosticSeverity.Warning, problem.getSeverity()); - - editor = harness.newEditor( - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - task: foo\n" + - " config: {}\n" + - " file: path/to/file" - ); - { - List problems = editor.assertProblems( - "config|[platform, run] are required", - "config|Only one of [config, file]", - "config|One of [image_resource, rootfs_uri, image]", - "file|Only one of [config, file]" - ); - //All of the problems in this example are property contraint violations! So all should be warnings. - for (Diagnostic diagnostic : problems) { - assertEquals(DiagnosticSeverity.Warning, diagnostic.getSeverity()); - } - } - } - - @Test - public void underlineParentPropertyForMissingNode() throws Exception { - //See: https://www.pivotaltracker.com/story/show/140709005 - - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: hello-world\n" + - " plan:\n" + - " - task: say-hello\n" + - " config:\n" + - " image_resource:\n" + - " type: docker-image\n" + - " source: {repository: ubuntu}\n" + - " run:\n" + - " path: echo\n" + - " args: [\"Hello, world!\"]" - ); - editor.assertProblems( - "config|'platform' is required" - ); - } - - @Test - public void reconcileDuplicateJobNames() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: job-1\n" + - "- name: utils\n" + - "- name: job-1\n" - ); - editor.assertProblems( - "-^ name: job-1|'plan' is required", - "job-1|Duplicate job name", - "-^ name: utils|'plan' is required", - "-^ name: job-1|'plan' is required", - "job-1|Duplicate job name" - ); - } - - @Test - public void completionsResourceReferences() throws Exception { - assertContextualCompletions( - "resources:\n" + - "- name: sts4\n" + - "- name: repo-a\n" + - "- name: repo-b\n" + - "jobs:\n" + - "- name: job1\n" + - " plan:\n" + - " - get: <*>\n" - , //////////////////// - "<*>" - , // => - "repo-a<*>", "repo-b<*>", "sts4<*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: sts4\n" + - "- name: repo-a\n" + - "- name: repo-b\n" + - "jobs:\n" + - "- name: job1\n" + - " plan:\n" + - " - put: <*>\n" - , //////////////////// - "r<*>" - , // => - "repo-a<*>", "repo-b<*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: sts4\n" + - "- name: repo-a\n" + - "- name: repo-b\n" + - "jobs:\n" + - "- name: job1\n" + - " plan:\n" + - " - task: do-it\n" + - " input_mapping:\n" + - " remapped: <*>\n" - , //////////////////// - "<*>" - , // => - "repo-a<*>", "repo-b<*>", "sts4<*>" - ); - - } - - @Test - public void reconcileDuplicateKeys() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-repo\n" + - " type: git\n" + - " source:\n" + - " branch: master\n" + - " uri: https://github.com/kdvolder/my-repo\n" + - "resources:\n" + - "- name: your-repo\n" + - " type: git\n" + - " type: git\n" + - " source:\n" + - " branch: master\n" + - " uri: https://github.com/kdvolder/forked-repo\n" - ); - - editor.assertProblems( - "resources|Duplicate key", - "my-repo|Unused 'Resource'", - "resources|Duplicate key", - "your-repo|Unused 'Resource'", - "type|Duplicate key", - "type|Duplicate key" - ); - } - - @Test - public void reconcileJobNames() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: git-repo\n" + - " type: git\n" + - "- name: build-artefact\n" + - " type: git\n" + - "jobs:\n" + - "- name: build\n" + - " plan:\n" + - " - get: git-repo\n" + - " - task: run-build\n" + - " file: some-task.yml\n" + - " - put: build-artefact\n" + - "- name: test\n" + - " plan:\n" + - " - get: git-repo\n" + - " passed:\n" + - " - not-a-job\n" + - " - build\n" - ); - - editor.assertProblems( - "build-artefact|should define 'branch'", - "not-a-job|does not exist" - ); - } - - @Test - public void reconcileGroups() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: git-repo\n" + - " type: git\n" + - "- name: build-artefact\n" + - " type: git\n" + - "jobs:\n" + - "- name: build\n" + - " plan:\n" + - " - get: git-repo\n" + - " - task: run-build\n" + - " file: tasks/some-task.yml\n" + - " - put: build-artefact # <- bad\n" + - "- name: test\n" + - " plan:\n" + - " - get: git-repo\n" + - "groups:\n" + - "- name: some-group\n" + - " jobs: [build, test, bogus-job]\n" + - " resources: [git-repo, build-artefact, not-a-resource]" - ); - - editor.assertProblems( - "build-artefact^ # <- bad|should define 'branch'", - "bogus-job|does not exist", - "not-a-resource|does not exist" - ); - } - - @Test public void timeResourceCompletions() throws Exception { - assertContextualCompletions( - "resources:\n" + - "- name: every5minutes\n" + - " type: time\n" + - " source:\n" + - " location: <*>" - , // ====================== - "Van<*>" - , // => - "America/Vancouver<*>", - "Asia/Vientiane<*>", - "Europe/Vatican<*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: every5minutes\n" + - " type: time\n" + - " source:\n" + - " <*>\n" + - " blah: blah" - , // ====================== - "<*>" - , // => - "days:\n"+ - " - <*>", - "interval: <*>", - "location: <*>", - "start: <*>", - "stop: <*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: every5minutes\n" + - " type: time\n" + - " source:\n" + - " days:\n" + - " - <*>" - , // ====================== - "<*>" - , // => - "Friday<*>", - "Monday<*>", - "Saturday<*>", - "Sunday<*>", - "Thursday<*>", - "Tuesday<*>", - "Wednesday<*>" - ); - - } - - @Test public void timeResourceSourceReconcile() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: every5minutes\n" + - " type: time\n" + - " source:\n" + - " location: PST8PDT\n" + - " start: 7AM\n" + - " stop: 8AM\n" + - " interval: 5m\n" + - " days:\n" + - " - Thursday\n" - ); - editor.assertProblems( - "every5minutes|Unused" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: every5minutes\n" + - " type: time\n" + - " source:\n" + - " location: some-location\n" + - " start: the-start-time\n" + - " stop: the-stop-time\n" + - " interval: the-interval\n" + - " days:\n" + - " - Monday\n" + - " - Someday\n" - ); - editor.assertProblems( - "every5minutes|Unused", - "some-location|Unknown 'Location'", - "the-start-time|not a valid 'Time'", - "the-stop-time|not a valid 'Time'", - "the-interval|not a valid 'Duration'", - "Someday|unknown 'Day'" - ); - } - - @Test public void timeResourceSourceHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: timed-trigger\n" + - " type: time\n" + - " source:\n" + - " interval: 5m\n" + - " location: UTC\n" + - " start: 8:00PM\n" + - " stop: 9:00PM\n" + - " days: [Monday, Wednesday, Friday]" - ); - editor.assertHoverContains("interval", "interval on which to report new versions"); - editor.assertHoverContains("location", "*Optional. Default `UTC`"); - editor.assertHoverContains("start", "The supported time formats are"); - editor.assertHoverContains("stop", "The supported time formats are"); - editor.assertHoverContains("days", "Run only on these day(s)"); - } - - @Test public void gitResourceSourceReconcile() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: sts4-out\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com:spring-projects/sts4.git\n" + - " bogus: bad\n" + - " branch: {{branch}}\n" + - " private_key: {{rsa_id}}\n" + - " username: jeffy\n" + - " password: {{git_passwords}}\n" + - " paths: not-a-list\n" + - " ignore_paths: also-not-a-list\n" + - " skip_ssl_verification: skip-it\n" + - " tag_filter: RELEASE_*\n" + - " git_config:\n" + - " - name: good\n" + - " val: bad\n" + - " disable_ci_skip: no_ci_skip\n" + - " commit_verification_keys: not-a-list-of-keys\n" + - " commit_verification_key_ids: not-a-list-of-ids\n" + - " gpg_keyserver: hkp://somekeyserver.net" - ); - editor.assertProblems( - "sts4-out|Unused", - "bogus|Unknown property", - "not-a-list|Expecting a 'Sequence'", - "also-not-a-list|Expecting a 'Sequence'", - "skip-it|'boolean'", - "val|Unknown property", - "no_ci_skip|'boolean'", - "not-a-list-of-keys|Expecting a 'Sequence'", - "not-a-list-of-ids|Expecting a 'Sequence'" - ); - } - - @Test public void gitResourceSourceCompletions() throws Exception { - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: the-repo\n" + - " type: git\n" + - " source:\n" + - " <*>" - , //================ - "<*>" - , // ==> - "uri: <*>" - ); - - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: the-repo\n" + - " type: git\n" + - " source:\n" + - " uri:\n" + - " <*>" - , //================ - "<*>" - , // ==> - "branch: <*>" - , - "commit_verification_key_ids:\n" + - " - <*>" - , - "commit_verification_keys:\n" + - " - <*>" - , - "disable_ci_skip: <*>" - , - "git_config:\n" + - " - <*>" - , - "gpg_keyserver: <*>" - , - "ignore_paths:\n" + - " - <*>" - , - "password: <*>" - , - "paths:\n" + - " - <*>" - , - "private_key: <*>" - , - "skip_ssl_verification: <*>" - , - "tag_filter: <*>" - , - "username: <*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: the-repo\n" + - " type: git\n" + - " source:\n" + - " git_config:\n" + - " - <*>" - , // ============= - "<*>" - , // ==> - "name: <*>", - "value: <*>" - ); - } - - @Test public void gitResourceSourceHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: sts4-out\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com:spring-projects/sts4.git\n" + - " bogus: bad\n" + - " branch: {{branch}}\n" + - " private_key: {{rsa_id}}\n" + - " username: jeffy\n" + - " password: {{git_passwords}}\n" + - " paths: not-a-list\n" + - " ignore_paths: also-not-a-list\n" + - " skip_ssl_verification: skip-it\n" + - " tag_filter: RELEASE_*\n" + - " git_config:\n" + - " - name: good\n" + - " val: bad\n" + - " disable_ci_skip: no_ci_skip\n" + - " commit_verification_keys: not-a-list-of-keys\n" + - " commit_verification_key_ids: not-a-list-of-ids\n" + - " gpg_keyserver: hkp://somekeyserver.net" - ); - editor.assertHoverContains("uri", "*Required.* The location of the repository."); - editor.assertHoverContains("branch", "The branch to track"); - editor.assertHoverContains("private_key", "Private key to use when pulling/pushing"); - editor.assertHoverContains("username", "Username for HTTP(S) auth"); - editor.assertHoverContains("password", "Password for HTTP(S) auth"); - editor.assertHoverContains("paths", "a list of glob patterns"); - editor.assertHoverContains("ignore_paths", "The inverse of `paths`"); - editor.assertHoverContains("skip_ssl_verification", "Skips git ssl verification"); - editor.assertHoverContains("tag_filter", "the resource will only detect commits"); - editor.assertHoverContains("git_config", "configure git global options"); - editor.assertHoverContains("disable_ci_skip", "Allows for commits that have been labeled with `[ci skip]`"); - editor.assertHoverContains("commit_verification_keys", "Array of GPG public keys"); - editor.assertHoverContains("commit_verification_key_ids", "Array of GPG public key ids"); - } - - @Test public void gitResourceGetParamsCompletions() throws Exception { - String context = - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " params:\n" + - " <*>\n" + - " blah: blah"; - - assertContextualCompletions(context, - "<*>" - , // ===> - "depth: <*>" - , - "disable_git_lfs: <*>" - , - "fetch:\n" + - " - <*>" - , - "submodules:\n"+ - " <*>" - ); - assertContextualCompletions(context, - "disable_git_lfs: <*>" - , // ===> - "disable_git_lfs: false<*>", - "disable_git_lfs: true<*>" - ); - assertContextualCompletions(context, - "submodules: <*>" - , // ===> - "submodules: all<*>", - "submodules: none<*>" - ); - } - - @Test public void gitResourceGetParamsHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " params:\n" + - " depth: -1\n" + - " disable_git_lfs: not-bool\n" + - " submodules: none" - ); - editor.assertHoverContains("depth", "using the `--depth` option"); - editor.assertHoverContains("submodules", "If `none`, submodules will not be fetched"); - editor.assertHoverContains("disable_git_lfs", "will not fetch Git LFS files"); - } - - @Test public void gitResourceGetParamsReconcile() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " params:\n" + - " depth: -1\n" + - " disable_git_lfs: not-bool\n" - ); - editor.assertProblems( - "-1|must be positive", - "not-bool|'boolean'" - ); - } - - @Test public void gitResourcePutParamsCompletions() throws Exception { - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " params:\n" + - " <*>" - , - "<*>" - , // => - "repository: <*>" - ); - - String context = - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " params:\n" + - " repository: blah\n" + - " <*>"; - - assertContextualCompletions(PLAIN_COMPLETION, context, - "<*>" - , // ===> - "annotate: <*>" - , - "force: <*>" - , - "only_tag: <*>" - , - "rebase: <*>" - , - "tag: <*>" - , - "tag_prefix: <*>" - ); - assertContextualCompletions(context, - "rebase: <*>" - , // ===> - "rebase: false<*>", - "rebase: true<*>" - ); - assertContextualCompletions(context, - "only_tag: <*>" - , // ===> - "only_tag: false<*>", - "only_tag: true<*>" - ); - assertContextualCompletions(context, - "force: <*>" - , // ===> - "force: false<*>", - "force: true<*>" - ); - } - - @Test public void gitResourcePutParamsReconcile() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - " source:\n" + - " uri: some-uri\n" + - " branch: master\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " params: {}\n" - ); - editor.assertProblems("params|'repository' is required"); - - editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - " source:\n" + - " uri: some-uri\n" + - " branch: master\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " params:\n" + - " repository: some-other-repo\n" + - " rebase: do-rebase\n" + - " only_tag: do-tag\n" + - " force: force-it\n" - ); - editor.assertProblems( - "do-rebase|'boolean'", - "do-tag|'boolean'", - "force-it|'boolean'" - ); - } - - @Test public void gitResourcePutParamsHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " params:\n" + - " repository: some-other-repo\n" + - " rebase: do-rebase\n" + - " tag: the-tag-file\n" + - " only_tag: do-tag\n" + - " tag_prefix: RELEASE\n" + - " force: force-it\n" + - " annotate: release-annotion\n" - ); - - editor.assertHoverContains("repository", "The path of the repository"); - editor.assertHoverContains("rebase", "attempt rebasing"); - editor.assertHoverContains("tag", "HEAD will be tagged"); - editor.assertHoverContains("only_tag", "push only the tags"); - editor.assertHoverContains("tag_prefix", "prepended with this string"); - editor.assertHoverContains("force", "pushed regardless of the upstream state"); - editor.assertHoverContains("annotate", "path to a file containing the annotation message"); - } - - @Test public void gitResourcePut_get_params_Hovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - put: my-git\n" + - " get_params:\n" + - " depth: 1\n" + - " submodules: none\n" + - " disable_git_lfs: true\n" - ); - - editor.assertHoverContains("depth", "using the `--depth` option"); - editor.assertHoverContains("submodules", "If `none`, submodules will not be fetched"); - editor.assertHoverContains("disable_git_lfs", "will not fetch Git LFS files"); - } - - @Test - public void contentAssistJobNames() throws Exception { - assertContextualCompletions( - "resources:\n" + - "- name: git-repo\n" + - "- name: build-artefact\n" + - "jobs:\n" + - "- name: build\n" + - " plan:\n" + - " - get: git-repo\n" + - " - task: run-build\n" + - " - put: build-artefact\n" + - "- name: test\n" + - " plan:\n" + - " - get: git-repo\n" + - " passed:\n" + - " - <*>\n" - , /////////////////////////// - "<*>" - , // => - "build<*>", - "test<*>" - ); - } - - @Test - public void resourceTypeAttributeHovers() throws Exception { - Editor editor = harness.newEditor( - "resource_types:\n" + - "- name: s3-multi\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/s3-resource-simple\n" - ); - - editor.assertHoverContains("name", "This name will be referenced by `resources` defined within the same pipeline"); - editor.assertHoverContains("type", 2, "used to provide the resource type's container image"); - editor.assertHoverContains("source", 2, "The location of the resource type's resource"); - } - - @Test - public void resourceAttributeHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: sts4\n" + - " type: git\n" + - " check_every: 5m\n" + - " webhook_token: bladayadayaaa\n" + - " source:\n" + - " repository: https://github.com/spring-projects/sts4\n" - ); - - editor.assertHoverContains("name", "The name of the resource"); - editor.assertHoverContains("type", "The type of the resource. Each worker advertises"); - editor.assertHoverContains("source", 2, "The location of the resource"); - editor.assertHoverContains("webhook_token", "web hooks can be sent to trigger an immediate *check* of the resource"); - editor.assertHoverContains("check_every", "The interval on which to check for new versions"); - } - - @Test public void requiredPropertiesReconcile() throws Exception { - Editor editor; - - //addProp(resource, "name", resourceNameDef).isRequired(true); - editor = harness.newEditor( - "resources:\n" + - "- type: git" - ); - editor.assertProblems("-^ type: git|'name' is required"); - - //addProp(resource, "type", t_resource_type_name).isRequired(true); - editor = harness.newEditor( - "resources:\n" + - "- name: foo" - ); - editor.assertProblems( - "-^ name: foo|'type' is required", - "foo|Unused" - ); - - //Both name and type missing: - editor = harness.newEditor( - "resources:\n" + - "- source: {}" - ); - editor.assertProblems("-^ source:|[name, type] are required"); - - //addProp(job, "name", jobNameDef).isRequired(true); - editor = harness.newEditor( - "jobs:\n" + - "- name: foo" - ); - editor.assertProblems("-^ name: foo|'plan' is required"); - - //addProp(job, "plan", f.yseq(step)).isRequired(true); - editor = harness.newEditor( - "jobs:\n" + - "- plan: []" - ); - editor.assertProblems("-^ plan: []|'name' is required"); - - //addProp(resourceType, "name", t_ne_string).isRequired(true); - editor = harness.newEditor( - "resource_types:\n" + - "- type: docker-image" - ); - editor.assertProblems("-^ type: docker-image|'name' is required"); - - //addProp(resourceType, "type", t_image_type).isRequired(true); - editor = harness.newEditor( - "resource_types:\n" + - "- name: foo" - ); - editor.assertProblems("-^ name: foo|'type' is required"); - - //addProp(gitSource, "uri", t_string).isRequired(true); - editor = harness.newEditor( - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " branch: master" - ); - editor.assertProblems( - "foo|Unused", - "source|'uri' is required" - ); - - //addProp(group, "name", t_ne_string).isRequired(true); - editor = harness.newEditor( - "groups:\n" + - "- jobs: []" - ); - editor.assertProblems("-^ jobs: []|'name' is required"); - } - - @Test public void gitBranchRequiredInPutStep() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: repo\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com/johny-coder/test-repo\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: repo\n" + - " - put: repo # <- bad\n" - ); - editor.assertProblems( - "repo^ # <- bad|should define 'branch'" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: repo\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com/johny-coder/test-repo\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: repo\n" + - " - put: blah\n" + - " resource: repo # <- bad\n" - ); - editor.assertProblems( - "repo^ # <- bad|should define 'branch'" - ); - } - - @Test public void dockerImageResourceSourceReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-docker-image\n" + - " type: docker-image\n" + - " source:\n" + - " tag: latest\n" - ); - editor.assertProblems( - "my-docker-image|Unused 'Resource'", - "source|'repository' is required" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: my-docker-image\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/sts4-build-env\n" + - " tag: latest\n" + - " username: kdvolder\n" + - " password: {{docker_password}}\n" + - " aws_access_key_id: {{aws_access_key}}\n" + - " aws_secret_access_key: {{aws_secret_key}}\n" + - " insecure_registries: no-list\n" + - " registry_mirror: https://my-docker-registry.com\n" + - " ca_certs:\n" + - " - domain: example.com:443\n" + - " cert: |\n" + - " -----BEGIN CERTIFICATE-----\n" + - " ...\n" + - " -----END CERTIFICATE-----\n" + - " bogus_ca_certs_prop: bad\n" + - " client_certs:\n" + - " - domain: example.com:443\n" + - " cert: |\n" + - " -----BEGIN CERTIFICATE-----\n" + - " ...\n" + - " -----END CERTIFICATE-----\n" + - " key: |\n" + - " -----BEGIN RSA PRIVATE KEY-----\n" + - " ...\n" + - " -----END RSA PRIVATE KEY-----\n" + - " bogus_client_cert_prop: bad\n" - ); - editor.assertProblems( - "my-docker-image|Unused 'Resource'", - "no-list|Expecting a 'Sequence'", - "bogus_ca_certs_prop|Unknown property", //ca_certs - "bogus_client_cert_prop|Unknown property" //client_certs - ); - - editor.assertHoverContains("repository", "The name of the repository"); - editor.assertHoverContains("tag", "The tag to track"); - editor.assertHoverContains("username", "username to authenticate"); - editor.assertHoverContains("password", "password to use"); - editor.assertHoverContains("aws_access_key_id", "AWS access key to use"); - editor.assertHoverContains("aws_secret_access_key", "AWS secret key to use"); - editor.assertHoverContains("insecure_registries", "array of CIDRs"); - editor.assertHoverContains("registry_mirror", "URL pointing to a docker registry"); - editor.assertHoverContains("ca_certs", "Each entry specifies the x509 CA certificate for"); - editor.assertHoverContains("client_certs", "Each entry specifies the x509 certificate and key"); - } - - @Test public void dockerImageResourceGetParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-docker-image\n" + - " type: docker-image\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - get: my-docker-image\n" + - " params:\n" + - " save: save-it\n" + - " rootfs: tar-it\n" + - " skip_download: skip-it\n" - ); - - editor.assertProblems( - "save-it|'boolean'", - "tar-it|'boolean'", - "skip-it|'boolean'" - ); - - editor.assertHoverContains("save", "docker save"); - editor.assertHoverContains("rootfs", "a `.tar` file of the image"); - editor.assertHoverContains("skip_download", "Skip `docker pull`"); - } - - @Test public void dockerImageResourcePutParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-docker-image\n" + - " type: docker-image\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: my-docker-image\n" + - " params:\n" + - " build: path/to/docker/dir\n" + - " load: path/to/image\n" + - " dockerfile: path/to/Dockerfile\n"+ - " cache: cache-it\n" + - " cache_tag: the-cache-tag\n" + - " load_base: path/to/base-image\n" + - " load_file: path/to/file-to-load\n" + - " load_repository: some-repo\n" + - " load_tag: some-tag\n" + - " import_file: path/to/file-to-import\n" + - " pull_repository: path/to/repository-to-pull\n" + - " pull_tag: tag-to-pull\n" + - " tag: path/to/file-containing-tag\n" + - " tag_prefix: v\n" + - " tag_as_latest: tag-latest\n" + - " build_args: the-build-args\n" + - " build_args_file: path/to/file-with-build-args.json\n" + - " get_params:\n" + - " save: save-it\n" + - " rootfs: tar-it\n" + - " skip_download: skip-it\n" - ); - - editor.assertProblems( - "cache-it|'boolean'", - "pull_repository|Deprecated", - "pull_tag|Deprecated", - "tag-latest|'boolean'", - "the-build-args|Expecting a 'Map'", - - "save-it|'boolean'", - "tar-it|'boolean'", - "skip-it|'boolean'" - ); - assertEquals(DiagnosticSeverity.Warning, editor.assertProblem("pull_repository").getSeverity()); - assertEquals(DiagnosticSeverity.Warning, editor.assertProblem("pull_tag").getSeverity()); - - editor.assertHoverContains("build", "directory containing a `Dockerfile`"); - editor.assertHoverContains("load", "directory containing an image"); - editor.assertHoverContains("dockerfile", "path of the `Dockerfile` in the directory"); - editor.assertHoverContains("cache", "first pull `image:tag` from the Docker registry"); - editor.assertHoverContains("cache_tag", "specific tag to pull"); - editor.assertHoverContains("load_base", "path to a directory containing an image to `docker load`"); - editor.assertHoverContains("load_file", "path to a file to `docker load`"); - editor.assertHoverContains("load_repository", "repository of the image loaded from `load_file`"); - editor.assertHoverContains("load_tag", "tag of image loaded from `load_file`"); - editor.assertHoverContains("import_file", "file to `docker import`"); - editor.assertHoverContains("pull_repository", "repository to pull down"); - editor.assertHoverContains("pull_tag", "tag of the repository to pull down"); - editor.assertHoverContains(" tag:", "a path to a file containing the name"); // The word 'tag' occurs many times in editor so add use " tag: " to be precise - editor.assertHoverContains("tag_prefix", "prepended with this string"); - editor.assertHoverContains("tag_as_latest", "tagged as `latest`"); - editor.assertHoverContains("build_args", "map of Docker build arguments"); - editor.assertHoverContains("build_args_file", "JSON file containing"); - - editor.assertHoverContains("save", "docker save"); - editor.assertHoverContains("rootfs", "a `.tar` file of the image"); - editor.assertHoverContains("skip_download", "Skip `docker pull`"); - } - - @Test public void s3ResourceSourceReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: s3-snapshots\n" + - " type: s3\n" + - " source:\n" + - " access_key_id: the-key" - ); - editor.assertProblems( - "s3-snapshots|Unused 'Resource'", - "source|'bucket' is required", - "source|One of [regexp, versioned_file] is required" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: s3-snapshots\n" + - " type: s3\n" + - " source:\n" + - " bucket: the-bucket\n" + - " access_key_id: the-access-key\n" + - " secret_access_key: the-secret-key\n" + - " region_name: bogus-region\n" + - " private: is-private\n" + - " cloudfront_url: https://d5yxxxxx.cloudfront.net\n" + - " endpoint: https://blah.custom.com/blah/blah\n" + - " disable_ssl: no_ssl_checking\n" + - " server_side_encryption: some-encryption-algo\n" + //TODO: validation and CA? What values are acceptable? - " sse_kms_key_id: the-master-key-id\n" + - " use_v2_signing: should-use-v2\n" + - " regexp: path-to-file-(.*).tar.gz\n" + - " versioned_file: path/to/file.tar.gz\n" - ); - editor.assertProblems( - "s3-snapshots|Unused 'Resource'", - "bogus-region|unknown 'S3Region'", - "is-private|'boolean'", - "no_ssl_checking|'boolean'", - "should-use-v2|'boolean'", - "regexp|Only one of [regexp, versioned_file] should be defined", - "versioned_file|Only one of [regexp, versioned_file] should be defined" - ); - - editor.assertHoverContains("bucket", "The name of the bucket"); - editor.assertHoverContains("access_key_id", "The AWS access key"); - editor.assertHoverContains("secret_access_key", "The AWS secret key"); - editor.assertHoverContains("region_name", "The region the bucket is in"); - editor.assertHoverContains("private", "Indicates that the bucket is private"); - editor.assertHoverContains("cloudfront_url", "The URL (scheme and domain) of your CloudFront distribution"); - editor.assertHoverContains("endpoint", "Custom endpoint for using S3"); - editor.assertHoverContains("disable_ssl", "Disable SSL for the endpoint"); - editor.assertHoverContains("server_side_encryption", "An encryption algorithm to use"); - editor.assertHoverContains("sse_kms_key_id", "The ID of the AWS KMS master encryption key"); - editor.assertHoverContains("use_v2_signing", "Use signature v2 signing"); - editor.assertHoverContains("regexp", "The pattern to match filenames against within S3"); - editor.assertHoverContains("versioned_file", "If you enable versioning for your S3 bucket"); - } - - @Test public void s3ResourceRegionCompletions() throws Exception { - String[] validRegions = { - //See: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html - "us-west-1", "us-west-2", "ca-central-1", - "EU", "eu-west-1", "eu-west-2", "eu-central-1", - "ap-south-1", "ap-southeast-1", "ap-southeast-2", - "ap-northeast-1", "ap-northeast-2", - "sa-east-1", "us-east-2" - }; - Arrays.sort(validRegions); - - String[] expectedCompletions = new String[validRegions.length]; - for (int i = 0; i < expectedCompletions.length; i++) { - expectedCompletions[i] = validRegions[i]+"<*>"; - } - - assertContextualCompletions( - "resources:\n" + - "- name: s3-snapshots\n" + - " type: s3\n" + - " source:\n" + - " region_name: <*>" - , //=================== - "<*>" - , // ===> - expectedCompletions - ); - } - - @Test public void s3ResourceGetParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-s3-bucket\n" + - " type: s3\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - get: my-s3-bucket\n" + - " params:\n" + - " no-params-expected: bad" - ); - - editor.assertProblems( - "no-params-expected|Unknown property" - ); - } - - @Test public void s3ResourcePutParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-s3-bucket\n" + - " type: s3\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: my-s3-bucket\n" + - " params:\n" + - " acl: public-read\n" + - " get_params:\n" + - " no-params-expected: bad" - ); - editor.assertProblems( - "params|'file' is required", - "no-params-expected|Unknown property" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: my-s3-bucket\n" + - " type: s3\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: my-s3-bucket\n" + - " params:\n" + - " file: path/to/file\n" + - " acl: bad-acl\n" + - " content_type: anything/goes\n" - ); - editor.assertProblems( - "bad-acl|unknown 'S3CannedAcl'" - ); - - editor.assertHoverContains("file", "Path to the file to upload"); - editor.assertHoverContains("acl", "Canned Acl"); - editor.assertHoverContains("content_type", "MIME"); - } - - @Test public void s3ResourcePutParamsContentAssist() throws Exception { - String[] cannedAcls = { //See http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl - "private", - "public-read", - "public-read-write", - "aws-exec-read", - "authenticated-read", - "bucket-owner-read", - "bucket-owner-full-control", - "log-delivery-write" - }; - Arrays.sort(cannedAcls); - - String conText = - "resources:\n" + - "- name: my-s3-bucket\n" + - " type: s3\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: my-s3-bucket\n" + - " params:\n" + - " <*>"; - - assertContextualCompletions(conText, - "content_type: json<*>" - , //=> - "content_type: application/json; charset=utf-8<*>" - ); - - String[] expectedAclCompletions = new String[cannedAcls.length]; - for (int i = 0; i < expectedAclCompletions.length; i++) { - expectedAclCompletions[i] = "acl: "+cannedAcls[i]+"<*>"; - } - assertContextualCompletions(conText, - "acl: <*>" - , // ===> - expectedAclCompletions - ); - } - - @Test public void poolResourceSourceReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: swimming-pool\n" + - " type: pool\n" + - " source:\n" + - " private_key: stuff" - ); - editor.assertProblems( - "swimming-pool|Unused", - "source|[branch, pool, uri] are required" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: the--locks\n" + - " type: pool\n" + - " source:\n" + - " uri: git@github.com:concourse/locks.git\n" + - " branch: master\n" + - " pool: aws\n" + - " private_key: |\n" + - " -----BEGIN RSA PRIVATE KEY-----\n" + - " MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W\n" + - " ...\n" + - " DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l\n" + - " -----END RSA PRIVATE KEY-----\n" + - " username: jonhsmith\n" + - " password: his-password\n" + - " retry_delay: retry-after\n" - ); - editor.assertProblems( - "the--locks|Unused", - "retry-after|'Duration'" - ); - - editor.assertHoverContains("uri", "The location of the repository."); - editor.assertHoverContains("branch", "The branch to track"); - editor.assertHoverContains("pool", 2, "The logical name of your pool of things to lock"); - editor.assertHoverContains("private_key", "Private key to use when pulling/pushing"); - editor.assertHoverContains("username", "Username for HTTP(S) auth"); - editor.assertHoverContains("password", "Password for HTTP(S) auth "); - editor.assertHoverContains("retry_delay", "how long to wait until retrying"); - } - - @Test public void poolResourceGetParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-locks\n" + - " type: pool\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - get: my-locks\n" + - " params:\n" + - " no-params-expected: bad" - ); - - editor.assertProblems( - "no-params-expected|Unknown property" - ); - } - - @Test public void poolResourcePutParamsReconcileAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: my-locks\n" + - " type: pool\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: my-locks\n" + - " params:\n" + - " acquire: should-acquire\n" + - " claim: a-specific-lock\n" + - " release: path/to/lock\n" + - " add: path/to/lock\n" + - " add_claimed: path/to/lock\n" + - " remove: path/to/lock" - ); - - editor.assertProblems( - "acquire|Only one of", - "should-acquire|'boolean'", - "claim|Only one of", - "release|Only one of", - "add|Only one of", - "add_claimed|Only one of", - "remove|Only one of" - ); - - editor.assertHoverContains("acquire", "attempt to move a randomly chosen lock"); - editor.assertHoverContains("claim", "the specified lock from the pool will be acquired"); - editor.assertHoverContains("release", "release the lock"); - editor.assertHoverContains("add", "add a new lock to the pool in the unclaimed state"); - editor.assertHoverContains("add_claimed", "in the *claimed* state"); - editor.assertHoverContains("remove", "remove the given lock from the pool"); - } - - @Test public void semverResourceSourceReconcileAtomNotAllowed() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source: an-atom" - ); - editor.assertProblems( - "version|Unused 'Resource'", - "an-atom|Expecting a 'Map'" - ); - } - - @Test public void semverResourceSourceReconcileRequiredProps() throws Exception { - Editor editor; - - //required props for s3 driver - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: s3" - ); - editor.assertProblems( - "version|Unused", - "source|[access_key_id, bucket, key, secret_access_key] are required" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source: {}" - ); - editor.assertProblems( - "version|Unused", - "source|[access_key_id, bucket, key, secret_access_key] are required" - ); - - // required props for git driver - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: git" - ); - editor.assertProblems( - "version|Unused", - "source|[branch, file, uri] are required" - ); - - //required props for swift driver - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: swift" - ); - editor.assertProblems( - "version|Unused", - "source|'openstack' is required" - ); - } - - @Test public void semverResourceSourceBadDriver() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: bad-driver" - ); - editor.assertProblems( - "version|Unused", - "bad-driver|'SemverDriver'" - ); - } - - @Test public void semverGitResourceSourceContentAssist() throws Exception { - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " <*>" - , // =========== - "<*>" - , // ==> - "uri: <*>" - ); - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " uri: something\n" + - "<*>" - , // ============= - " <*>" - , // ==> - " branch: <*>" - , - " file: <*>" - ); - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " uri: something\n" + - " branch: master\n" + - " file: somefile\n" + - "<*>" - , // ============= - " <*>" - , // ==> - " git_user: <*>" - , - " initial_version: <*>" - , - " password: <*>" - , - " private_key: <*>" - , - " username: <*>" - ); - - } - - @Test public void semverGitResourceSourceReconcileAndHovers() throws Exception { - Editor editor; - - // required props for git driver - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: not-a-version\n" + //TODO: should be marked as a error but isn't yet. - " driver: git\n" + - " uri: git@github.com:concourse/concourse.git\n" + - " branch: version\n" + - " file: version\n" + - " private_key: {{concourse-repo-private-key}}\n" + - " username: jsmith\n" + - " password: s3cre$t\n" + - " git_user: jsmith@mailhost.com\n" + - " bogus: bad" - ); - editor.assertProblems( - "version|Unused", - "bogus|Unknown property" - ); - - editor.assertHoverContains("initial_version", "version number to use when bootstrapping"); - editor.assertHoverContains("driver", "The driver to use"); - editor.assertHoverContains("uri", "The repository URL"); - editor.assertHoverContains("branch", "The branch the file lives on"); - editor.assertHoverContains("file", "The name of the file"); - editor.assertHoverContains("private_key", "The SSH private key"); - editor.assertHoverContains("username", "Username for HTTP(S) auth"); - editor.assertHoverContains("password", "Password for HTTP(S) auth"); - editor.assertHoverContains("git_user", "The git identity to use"); - } - - @Test public void semverResourceSourcePrimaryContentAssist() throws Exception { - - //S3 completions - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "bucket: <*>", - "driver: <*>" - ); - - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " driver: s3\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "bucket: <*>" - ); - - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " driver: s3\n" + - " bucket: some-bucket\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "access_key_id: <*>", - "key: <*>", - "secret_access_key: <*>" - ); - - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " bucket: some-bucket\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "access_key_id: <*>", - "driver: <*>", - "key: <*>", - "secret_access_key: <*>" - ); - - //git completions - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "uri: <*>" - ); - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " uri: blah\n" + - " <*>" - , ///////////// - "<*>" - , // ==> - "branch: <*>", - "file: <*>" - ); - assertContextualCompletions(PLAIN_COMPLETION, - "resources:\n" + - "- name: fff\n" + - " type: semver\n" + - " source:\n" + - " driver: git\n" + - " uri: blah\n" + - " branch: master\n" + - " file: version-file\n"+ - " <*>" - , ///////////// - "<*>" - , // ==> - "git_user: <*>", - "initial_version: <*>", - "password: <*>", - "private_key: <*>", - "username: <*>" - ); - } - - @Test public void semverS3ResourceSourceReconcileAndHovers() throws Exception { - Editor editor; - - //without explicit 'driver'... should assume s3 by default - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: 1.2.3\n" + - " bucket: the-bucket\n" + - " key: object-key\n" + - " access_key_id: aws-access-key\n" + - " secret_access_key: aws-access-key\n" + - " region_name: bogus-region\n" + - " endpoint: https://blah.com/blah\n" + - " disable_ssl: no-use-ssl\n" + - " bogus-prop: bad" - ); - editor.assertProblems( - "version|Unused 'Resource'", - "bogus-region|'S3Region'", - "no-use-ssl|'boolean'", - "bogus-prop|Unknown property" - ); - - - //with explicit 'driver: s3' - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: 1.2.3\n" + - " driver: s3\n" + - " bucket: the-bucket\n" + - " key: object-key\n" + - " access_key_id: aws-access-key\n" + - " secret_access_key: aws-access-key\n" + - " region_name: bogus-region\n" + - " endpoint: https://blah.com/blah\n" + - " disable_ssl: no-use-ssl\n" + - " bogus-prop: bad" - ); - editor.assertProblems( - "version|Unused 'Resource'", - "bogus-region|'S3Region'", - "no-use-ssl|'boolean'", - "bogus-prop|Unknown property" - ); - - editor.assertHoverContains("initial_version", "version number to use when bootstrapping"); - editor.assertHoverContains("driver", "The driver to use"); - editor.assertHoverContains("bucket", "The name of the bucket"); - editor.assertHoverContains("key", "The key to use for the object"); - editor.assertHoverContains("access_key_id", "The AWS access key to"); - editor.assertHoverContains("secret_access_key", "The AWS secret key to"); - editor.assertHoverContains("region_name", "The region the bucket is in"); - editor.assertHoverContains("endpoint", "Custom endpoint for using S3"); - editor.assertHoverContains("disable_ssl", "Disable SSL for the endpoint"); - } - - @Test public void semverSwiftResourceSourceReconcileAndHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: 1.2.3\n" + - " driver: swift\n" + - " openstack:\n" + - " container: nice-container\n" + - " item_name: flubber-blub\n" + - " region_name: us-west-1\n" - ); - editor.assertProblems("version|Unused 'Resource'"); - editor.assertHoverContains("openstack", "All openstack configuration"); - } - - @Test public void semverResourceGetParamsReconcileAndHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: 1.2.3\n" + - " driver: swift\n" + - " openstack: whatever\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - get: version\n" + - " params:\n" + - " bump: what-to-bump\n" + - " pre: beta\n" + - " bogus: bad\n" - ); - editor.assertProblems( - "what-to-bump|[final, major, minor, patch]", - "bogus|Unknown property" - ); - - editor.assertHoverContains("bump", "Bump the version number"); - editor.assertHoverContains("pre", "bump to a prerelease"); - } - - @Test public void semverPutParamsReconcileAndHovers() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - " source:\n" + - " initial_version: 1.2.3\n" + - " driver: swift\n" + - " openstack: whatever\n" + - "jobs:\n" + - "- name: a-job\n" + - " plan:\n" + - " - put: version\n" + - " params:\n" + - " file: version-file\n" + - " bump: what-to-bump\n" + - " pre: alpha\n" + - " bogus-one: bad\n" + - " get_params:\n" + - " file: not-expected-here\n" + - " bump: what-to-get-bump\n" + - " pre: beta\n" + - " bogus-two: bad\n" - ); - editor.assertProblems( - "what-to-bump|[final, major, minor, patch]", - "bogus-one|Unknown property", - "file|Unknown property", - "what-to-get-bump|[final, major, minor, patch]", - "bogus-two|Unknown property" - ); - - editor.assertHoverContains("file", 1, "Path to a file containing the version number"); - editor.assertHoverContains("bump", 1, "Bump the version number"); - editor.assertHoverContains("bump", 2, "Bump the version number"); - editor.assertHoverContains("pre", 1, "bump to a prerelease"); - editor.assertHoverContains("pre", 2, "bump to a prerelease"); - } - - @Test public void reconcileExplicitResourceAttributeInPutStep() throws Exception { - //See: https://www.pivotaltracker.com/story/show/138568839 - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: aws-environments\n" + - " type: pool\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - put: environment-1\n" + - " resource: aws-environments\n" + - " params:\n" + - " acquire: true\n" + - " bogus_param: bad\n" + - " get_params:\n" + - " bogus_get_param: bad" - ); - editor.assertProblems( - "bogus_param|Unknown property", - "bogus_get_param|Unknown property" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: aws-environments\n" + - " type: pool\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - get: environment-1\n" + - " resource: aws-environments\n" + - " params:\n" + - " bogus_param: bad\n" - ); - editor.assertProblems( - "bogus_param|Unknown property" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: aws-environments\n" + - " type: pool\n" + - " source:\n" + - " uri: git@github.com:concourse/locks.git\n" + - " branch: master\n" + - " pool: aws\n" + - " private_key: |\n" + - " -----BEGIN RSA PRIVATE KEY-----\n" + - " MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W\n" + - " ...\n" + - " DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l\n" + - " -----END RSA PRIVATE KEY-----\n" + - " username: jonhsmith\n" + - " password: his-password\n" + - " retry_delay: 10s\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - get: aws-environments\n" + - " params: {} \n" + - " - put: environment-1\n" + - " resource: aws-environments\n" + - " params: {acquire: true}\n" + - " - put: environment-2\n" + - " resource: aws-environments\n" + - " params: \n" + - " acquire: true\n" + - " bogus_param: blah\n" + - " - task: test-multi-aws\n" + - " file: my-scripts/test-multi-aws.yml\n" + - " - put: aws-environments\n" + - " params: {release: environment-1}\n" + - " - put: aws-environments\n" + - " params: {release: environment-2}" - ); - editor.assertProblems( - "bogus_param|Unknown property" - ); - } - - @Test - public void resourceNameContentAssist() throws Exception { - String conText; - - conText = - "resources:\n" + - "- name: foo-resource\n" + - "- name: bar-resource\n" + - "- name: other-resource\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - <*>"; - assertContextualCompletions(conText - , // ============== - "get: <*>" - , - "get: bar-resource<*>", - "get: foo-resource<*>", - "get: other-resource<*>" - ); - assertContextualCompletions(conText - , // ============== - "put: <*>" - , // ==> - "put: bar-resource<*>", - "put: foo-resource<*>", - "put: other-resource<*>" - ); - - - conText = - "resources:\n" + - "- name: foo-resource\n" + - "- name: bar-resource\n" + - "- name: other-resource\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - put: something\n" + - " <*>"; - assertContextualCompletions(conText - , // ============== - "resource: <*>" - , // ==> - "resource: bar-resource<*>", - "resource: foo-resource<*>", - "resource: other-resource<*>" - ); - - conText = - "resources:\n" + - "- name: foo-resource\n" + - "- name: bar-resource\n" + - "- name: other-resource\n" + - "jobs:\n" + - "- name: test-multi-aws\n" + - " plan:\n" + - " - <*>\n" + - " resource: foo-resource\n"; // presence of explicit 'resource' attribute should disable treating the name in put/get as a resource-name - - assertContextualCompletions(conText, - "put: <*>" - // ==> NONE - ); - assertContextualCompletions(conText, - "get: <*>" - // ==> NONE - ); - } - - @Test - public void gotoResourceDefinition() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "- name: build-env\n" + - " type: docker-image\n" + - "jobs:\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " params:\n" + - " rootfs: true\n" + - " save: true\n" + - " - put: build-env\n" + - " build: my-git/docker\n" - ); - - editor.assertGotoDefinition(editor.positionOf("get: my-git", "my-git"), - editor.rangeOf("- name: my-git", "my-git") - ); - } - - @Test - public void gotoJobDefinition() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-git\n" + - " type: git\n" + - "jobs:\n" + - "- name: prepare-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " - task: preparations\n" + - " file: my-git/ci/tasks/preparations.yml\n" + - "- name: do-stuff\n" + - " plan:\n" + - " - get: my-git\n" + - " passed:\n" + - " - prepare-stuff\n" - ); - editor.assertGotoDefinition(editor.positionOf("- prepare-stuff", "prepare-stuff"), - editor.rangeOf("- name: prepare-stuff", "prepare-stuff") - ); - } - - @Test - public void gotoResourceTypeDefinition() throws Exception { - Editor editor = harness.newEditor( - "resource_types:\n" + - "- name: slack-notification\n" + - " type: docker-image\n" + - "resources:\n" + - "- name: zazazee\n" + - " type: slack-notification\n" - ); - editor.assertGotoDefinition(editor.positionOf("type: slack-notification", "slack-notification"), - editor.rangeOf("- name: slack-notification", "slack-notification") - ); - } - - @Test public void reconcileResourceTypeNames() throws Exception { - String userDefinedResourceTypesSnippet = - "resource_types:\n" + - "- name: s3-multi\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/s3-resource-simple\n" + - "- name: slack-notification\n" + - " type: docker-image\n" + - " source:\n" + - " repository: cfcommunity/slack-notification-resource\n" + - " tag: latest\n"; - String[] goodNames = { - //user-defined: - "s3-multi", "slack-notification", - //built-in: - "git", "hg", "time", "s3", - "archive", "semver", "github-release", - "docker-image", "tracker", "pool", "cf", "bosh-io-release", - "bosh-io-stemcell", "bosh-deployment", "vagrant-cloud" - }; - String[] badNames = { - "bogus", "wrong", "not-defined-resource-type" - }; - - //All the bad names are detected and flagged: - for (String badName : badNames) { - Editor editor = harness.newEditor( - userDefinedResourceTypesSnippet + - "resources:\n" + - "- name: the-resource\n" + - " type: "+badName - ); - editor.assertProblems( - "the-resource|Unused 'Resource'", - badName+"|Resource Type does not exist" - ); - } - - //All the good names are accepted: - for (String goodName : goodNames) { - Editor editor = harness.newEditor( - userDefinedResourceTypesSnippet + - "resources:\n" + - "- name: the-resource\n" + - " type: "+goodName - ); - editor.assertProblems(/*None*/ - "the-resource|Unused 'Resource'" - ); - } - } - - @Test public void contentAssistResourceTypeNames() throws Exception { - String[] goodNames = { - //user-defined: - "s3-multi", "slack-notification", - //built-in: - "git", "hg", "time", "s3", - "archive", "semver", "github-release", - "docker-image", "tracker", "pool", "cf", "bosh-io-release", - "bosh-io-stemcell", "bosh-deployment", "vagrant-cloud" - }; - Arrays.sort(goodNames); - - String context = - "resource_types:\n" + - "- name: s3-multi\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/s3-resource-simple\n" + - "- name: slack-notification\n" + - " type: docker-image\n" + - " source:\n" + - " repository: cfcommunity/slack-notification-resource\n" + - " tag: latest\n" + - "resources:\n" + - "- type: <*>\n" + - " source:\n"; - - //All the good names are accepted: - String[] expectedCompletions = new String[goodNames.length]; - for (int i = 0; i < expectedCompletions.length; i++) { - expectedCompletions[i] = goodNames[i] +"<*>"; - } - - assertContextualCompletions(context, - "<*>" - , // ===> - expectedCompletions - ); - } - - @Test public void reconcileTaskFileToplevelProperties() throws Exception { - Editor editor; - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "rootfs_uri: some-image" - ); - editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required"); - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "platform: a-platform\n" + - "image_resource:\n" + - " name: should-not-be-here\n" + - " type: docker-image\n" + - " source:\n" + - " bogus-source-prop: bad\n" + - " repository: ruby\n" + - " tag: '2.1'\n" + - "rootfs_uri: some-image\n" + - "inputs:\n" + - "- path: path/to/input\n" + - "outputs:\n" + - "- path: path/to/output\n" + - "run:\n" + - " path: my-app/scripts/test\n" + - "params: the-params\n" - ); - editor.assertProblems( - "image_resource|Only one of [image_resource, rootfs_uri, image] should be defined", - "name|Unknown property", - "bogus-source-prop|Unknown property", - "rootfs_uri|Only one of [image_resource, rootfs_uri, image] should be defined", - "-^ path: path/to/input|'name' is required", - "-^ path: path/to/output|'name' is required", - "the-params|Expecting a 'Map'" - ); - } - - @Test public void taskFileMissingToplevelPropertiesUnderlinesLastNonWhitespaceChar() throws Exception { - Editor editor; - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "rootfs_uri: some-image" - ); - editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required"); - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "rootfs_uri: some-image\n" + - " \n" - ); - editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required"); - - } - - @Test public void contentAssistTaskFileToplevelProperties() throws Exception { - assertTaskCompletions( - "<*>" - , // ==> - "platform: <*>" - , - "run:\n" + - " <*>" - ); - - assertContextualTaskCompletions( - "run: {}\n" + - "platform: linux\n" + - "<*>" - , - "<*>" - , // ==> - "image_resource:\n" + - " <*>" - , - "inputs:\n" + - "- name: <*>" - , - "outputs:\n" + - "- name: <*>" - , - "params:\n" + - " <*>" - , - "rootfs_uri: <*>" - , - "image: <*>" - ); - - assertTaskCompletions( - "platform: <*>" - , //=> - "platform: darwin<*>", - "platform: linux<*>", - "platform: windows<*>" - ); - } - - @Test public void hoversForTaskFileToplevelProperties() throws Exception { - Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "image: some-image\n" + - "image_resource:\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/sts4-build-env\n" + - "inputs: []\n" + - "outputs: []\n" + - "params: {}\n" + - "platform: linux\n" + - "run:\n" + - " path: sts4/concourse/tasks/build-vscode-extensions.sh" - ); - - editor.assertHoverContains("platform", "The platform the task should run on"); - editor.assertHoverContains("image_resource", "The base image of the container"); - editor.assertHoverContains("image", "A string specifying the rootfs of the container"); - editor.assertHoverContains("inputs", "The expected set of inputs for the task"); - editor.assertHoverContains("outputs", "The artifacts produced by the task"); - editor.assertHoverContains("run", "Note that this is *not* provided as a script blob"); - editor.assertHoverContains("params", "A key-value mapping of values that are exposed to the task via environment variables"); - editor.assertHoverContains("repository", "The name of the repository"); - - editor.assertHoverContains("platform", "The platform the task should run on"); - } - - @Test public void reconcileEmbeddedTaskConfig() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: foo\n" + - " plan:\n" + - " - task: the-task\n" + - " config:\n" + - " platform: a-platform\n" + - " image_resource:\n" + - " name: should-not-be-here\n" + - " type: docker-image\n" + - " source:\n" + - " bogus-source-prop: bad\n" + - " repository: ruby\n" + - " tag: '2.1'\n" + - " rootfs_uri: some-image\n" + - " inputs:\n" + - " - path: path/to/input\n" + - " outputs:\n" + - " - path: path/to/output\n" + - " run:\n" + - " path: my-app/scripts/test\n" + - " params: the-params" - ); - editor.assertProblems( - "image_resource|Only one of [image_resource, rootfs_uri, image] should be defined", - "name|Unknown property", - "bogus-source-prop|Unknown property", - "rootfs_uri|Only one of [image_resource, rootfs_uri, image] should be defined", - "-^ path: path/to/input|'name' is required", - "-^ path: path/to/output|'name' is required", - "the-params|Expecting a 'Map'" - ); - } - - @Test public void taskRunPropertiesValidationAndHovers() throws Exception { - Editor editor; - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "inputs:\n" + - "- name: sts4\n" + - "outputs:\n" + - "- name: vsix-files\n" + - "platform: linux\n" + - "image_resource:\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/sts4-build-env\n" + - "run:\n" + - " path: sts4/concourse/tasks/build-vscode-extensions.sh\n" + - " args: the-args\n" + - " user: admin\n" + - " dir: the-dir\n" + - " bogus: bad\n" - ); - editor.assertProblems( - "the-args|Expecting a 'Sequence'", - "bogus|Unknown property" - ); - - editor.assertHoverContains("path", "The command to execute, relative to the task's working directory"); - editor.assertHoverContains("args", "Arguments to pass to the command"); - editor.assertHoverContains("dir", "A directory, relative to the initial working directory, to set as the working directory"); - editor.assertHoverContains("user", "Explicitly set the user to run as"); - - editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "inputs:\n" + - "- name: sts4\n" + - "outputs:\n" + - "- name: vsix-files\n" + - "platform: linux\n" + - "image_resource:\n" + - " type: docker-image\n" + - " source:\n" + - " repository: kdvolder/sts4-build-env\n" + - "run:\n" + - " user: admin\n" - ); - editor.assertProblems("run|'path' is required"); - } - - @Test public void nameAndPathHoversInTaskInputsAndOutputs() throws Exception { - Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "inputs:\n" + - "- name: sts4\n" + - " path: botk\n" + - "outputs:\n" + - "- name: vsix-files\n" + - " path: zaza" - ); - editor.assertHoverContains("name", 1, "The logical name of the input"); - editor.assertHoverContains("name", 2, "The logical name of the output"); - editor.assertHoverContains("path", 1, "The path where the input will be placed"); - editor.assertHoverContains("path", 2, "The path to a directory where the output will be taken from"); - } - - @Test public void PT_140711495_triple_dash_at_start_of_file_disrupts_content_assist() throws Exception { - assertContextualCompletions( - "#leading comment\n" + - "---\n" + - "resources:\n" + - "- name: my-repo\n" + - " type: git\n" + - " source:\n" + - " uri: https://github.com/spring-projects/sts4.git\n" + - " <*>" - , // ================== - "bra<*>" - , // ==> - "branch: <*>" - ); - - assertContextualCompletions( - "---\n" + - "resources:\n" + - "- name: my-repo\n" + - " type: git\n" + - " source:\n" + - " uri: https://github.com/spring-projects/sts4.git\n" + - " <*>" - , // ================== - "bra<*>" - , // ==> - "branch: <*>" - ); - - assertContextualCompletions( -// "---\n" + - "resources:\n" + - "- name: my-repo\n" + - " type: git\n" + - " source:\n" + - " uri: https://github.com/spring-projects/sts4.git\n" + - " <*>" - , // ================== - "bra<*>" - , // ==> - "branch: <*>" - ); - } - - @Test public void PT_141050891_language_server_crashes_on_CA_before_first_document_marker() throws Exception { - Editor editor = harness.newEditor( - "%Y<*>\n" + - "#leading comment\n" + - "---\n" + - "resources:\n" + - "- name: my-repo\n" + - " type: git\n" + - " source:\n" + - " uri: https://github.com/spring-projects/sts4.git\n" + - " <*>" - ); - //We don't expect completions, but this should at least not crash! - editor.assertCompletions(/*NONE*/); - } - - @Test public void resourceInEmbeddedTaskConfigNotRequiredIfSpecifiedInTask() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: docker-image\n" + - " type: docker-image\n" + - " source:\n" + - " username: {{docker_hub_username}}\n" + - " password: {{docker_hub_password}}\n" + - " repository: kdvolder/sts3-build-env\n" + - "jobs:\n" + - "- name: build-commons-update-site\n" + - " plan:\n" + - " - task: hello-world\n" + - " image: docker-image\n" + //Given here! So not required in config! - " config:\n" + - " inputs:\n" + - " - name: commons-git\n" + - " platform: linux\n" + - " run:\n" + - " path: which\n" + - " args:\n" + - " - mvn" - ); - editor.assertProblems(/*none*/); - - editor = harness.newEditor( - "resources:\n" + - "- name: docker-image\n" + - " type: docker-image\n" + - " source:\n" + - " username: {{docker_hub_username}}\n" + - " password: {{docker_hub_password}}\n" + - " repository: kdvolder/sts3-build-env\n" + - "jobs:\n" + - "- name: build-commons-update-site\n" + - " plan:\n" + - " - task: hello-world\n" + - " config:\n" + - " inputs:\n" + - " - name: commons-git\n" + - " platform: linux\n" + - " run:\n" + - " path: which\n" + - " args:\n" + - " - mvn" - ); - - editor.assertProblems( - "docker-image|Unused", - "config|One of [image_resource, rootfs_uri, image] is required" - ); - } - - @Test public void resourceInTaskConfigFileNotRequired() throws Exception { - Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, - "inputs:\n" + - "- name: commons-git\n" + - "platform: linux\n" + - "run:\n" + - " path: which\n" + - " args:\n" + - " - mvn" - ); - editor.assertProblems(/*NONE*/); - } - - @Test public void resourceInEmbeddedTaskConfigDeprecated() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - "- name: my-docker-image\n" + - " type: docker-image\n" + - " source:\n" + - " username: {{docker_hub_username}}\n" + - " password: {{docker_hub_password}}\n" + - " repository: kdvolder/sts3-build-env\n" + - "jobs:\n" + - "- name: build-commons-update-site\n" + - " plan:\n" + - " - task: hello-world\n" + - " image: my-docker-image\n" + - " config:\n" + - " rootfs_uri: blah\n" + - " image_resource:\n" + - " type: docker-image\n" + - " inputs:\n" + - " - name: commons-git\n" + - " platform: linux\n" + - " run:\n" + - " path: which\n" + - " args:\n" + - " - mvn" - ); - List problems = editor.assertProblems( - "rootfs_uri|Deprecated", - "image_resource|Deprecated" - ); - for (Diagnostic d : problems) { - assertEquals(DiagnosticSeverity.Warning, d.getSeverity()); - } - } - - @Test public void relaxedIndentContextMoreSpaces() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " <*>" - ); - editor.assertCompletionLabels( - //For the 'exact' context: - "check_every", - "webhook_token", - //"name", exists - //"source", exists - //"type", exists - //For the nested context: - "→ uri", - // For the top-level context: - "← groups", - "← jobs", - "← resource_types", - // For the 'next job' context: - "← - name" - ); - - editor.assertCompletionWithLabel("check_every", - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " check_every: <*>" - ); - - editor.assertCompletionWithLabel("→ uri", - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " uri: <*>" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " <*>" - ); - editor.assertCompletionWithLabel("→ commit_verification_key_ids", - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " commit_verification_key_ids:\n" + - " - <*>" - ); - } - - @Test public void relaxedIndentContextMoreSpaces2() throws Exception { - assertContextualCompletions(INDENTED_COMPLETION, - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " <*>" - , // ========= - "ur" - , //=> - " uri: <*>" - ); - - assertContextualCompletions(INDENTED_COMPLETION, - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " <*>" - , // ========= - "bra" - , //=> - " branch: <*>" - ); - - assertContextualCompletions( - "resources:\n" + - "- name: foo\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " <*>" - , // ========= - "comverids<*>" - , //=> - " commit_verification_key_ids:\n" + - " - <*>" - ); - } - - @Test public void jobPropertyHovers() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - " - name: job\n" + - " serial: true\n" + - " build_logs_to_retain: 10\n" + - " serial_groups: []\n" + - " max_in_flight: 3\n" + - " public: false\n" + - " disable_manual_trigger: true\n" + - " interruptible: true\n" + - " plan:\n" + - " - get: code\n" + - " on_failure:\n" + - " put: code\n" + - " on_success:\n" + - " put: code\n" + - " ensure:\n" + - " put: code\n" + - "resources:\n" + - "- name: code\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " branch: master\n" - ); - editor.assertProblems(/*NONE*/); - editor.assertHoverContains("name", "The name of the job"); - editor.assertHoverContains("serial", "execute one-by-one"); - editor.assertHoverContains("build_logs_to_retain", "only the last specified number of builds"); - editor.assertHoverContains("serial_groups", "referencing the same tags will be serialized"); - editor.assertHoverContains("max_in_flight", "maximum number of builds to run at a time"); - editor.assertHoverContains("public", "build log of this job will be viewable"); - editor.assertHoverContains("disable_manual_trigger", "manual triggering of the job"); - editor.assertHoverContains("interruptible", "worker will not wait on the builds"); - editor.assertHoverContains("on_success", "Step to execute when the job succeeds"); - editor.assertHoverContains("on_failure", "Step to execute when the job fails"); - editor.assertHoverContains("ensure", "Step to execute regardless"); - } - - @Test public void jobPropertyReconcile() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - " - name: job\n" + - " serial: isSerial\n" + - " build_logs_to_retain: retainers\n" + - " serial_groups: no-list\n" + - " max_in_flight: flying-number\n" + - " public: publicize\n" + - " disable_manual_trigger: nomanual\n" + - " interruptible: nointerrupt\n" + - " plan:\n" + - " - get: a-resource\n" + - " on_failure:\n" + - " put: b-resource\n" + - " on_success:\n" + - " put: a-resource\n" + - " ensure:\n" + - " put: c-resource\n" + - "resources:\n" + - "- name: b-resource\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - "- name: code\n" + - " type: git\n" + - " source:\n" + - " uri: blah\n" + - " branch: master\n" - ); - editor.assertProblems( - "isSerial|boolean", - "retainers|Number", - "no-list|Expecting a 'Sequence'", - "flying-number|Number", - "publicize|boolean", - "nomanual|boolean", - "nointerrupt|boolean", - "a-resource|resource does not exist", - "b-resource|should define 'branch'", - "a-resource|resource does not exist", - "c-resource|resource does not exist", - "code|Unused" - ); - } - - @Test public void relaxedIndentContextMoreSpaces3() throws Exception { - Editor editor = harness.newEditor( - "jobs:\n" + - "- name: job-hello-world\n" + - " public: true\n" + - " plan:\n" + - " - get: resource-tutorial\n" + - " - task: hello-world\n" + - " <*>" - ); - - editor.assertCompletionLabels( - //completions for current (i.e Job) context: - "build_logs_to_retain", - "disable_manual_trigger", - "ensure", - "interruptible", - "max_in_flight", - "on_failure", - "on_success", - "serial", - "serial_groups", - //"name", exists - //"plan", exists - //"public", exists - //Completions for nested context (i.e. task step) - "→ attempts", - "→ config", - "→ ensure", - "→ file", - "→ image", - "→ input_mapping", - "→ on_failure", - "→ on_success", - "→ output_mapping", - "→ params", - "→ privileged", - "→ tags", - "→ timeout", - //Completions with '-' - "- aggregate", - "- do", - "- get", - "- put", - "- task", - "- try", - //Dedented completions - "← groups", - "← resource_types", - "← resources", - "← - name" - ); - } - - @Test public void gotoSymbolInPipeline() throws Exception { - Editor editor = harness.newEditor( - "resource_types:\n" + - "- name: some-resource-type\n" + - "resources:\n" + - "- name: foo-resource\n" + - "- name: bar-resource\n" + - "jobs:\n" + - "- name: do-some-stuff\n" + - "- name: do-more-stuff\n" - ); - - editor.assertDocumentSymbols( - "some-resource-type|ResourceType", - "foo-resource|Resource", - "bar-resource|Resource", - "do-some-stuff|Job", - "do-more-stuff|Job" - ); - } - - @Test public void reconcilerRaceCondition() throws Exception { - SynchronizationPoint reconcilerThreadStart = harness.reconcilerThreadStart(); - Editor editor = harness.newEditor("garbage"); - - reconcilerThreadStart.reached(); // Blocks until the reconciler thread is reached. - try { - String editorContents = editor.getRawText(); - for (int i = 0; i < 4; i++) { - editorContents = "\n" +editorContents; - editor.setText(editorContents); - } - } finally { - reconcilerThreadStart.unblock(); - } - - editor.assertRawText( - "\n" + - "\n" + - "\n" + - "\n" + - "garbage" - ); - editor.assertProblems("garbage|Expecting a 'Map'"); - } - - @Test public void noAutoInsertRequiredSourcePropertiesIfPresent() throws Exception { - Editor editor; - - //Most common case - editor = harness.newEditor( - "resources:\n" + - "- name: source-repo\n" + - " type: <*>\n"+ - " source:" - ); - editor.assertCompletionWithLabel((l) -> l.startsWith("pool"), - "resources:\n" + - "- name: source-repo\n" + - " type: pool<*>\n" + - " source:" - ); - - } - - @Test public void autoInsertRequiredSourceProperties() throws Exception { - Editor editor; - - //Most common case - editor = harness.newEditor( - "resources:\n" + - "- name: source-repo\n" + - " type: <*>" - ); - editor.assertCompletionWithLabel((l) -> l.startsWith("pool"), - "resources:\n" + - "- name: source-repo\n" + - " type: pool\n" + - " source:\n" + - " uri: $1\n" + - " branch: $2\n" + - " pool: $3<*>" - ); - - // What if we use somewhat different indentation style? - editor = harness.newEditor( - "resources:\n" + - " - name: source-repo\n" + - " type: <*>" - ); - editor.assertCompletionWithLabel((l) -> l.startsWith("pool"), - "resources:\n" + - " - name: source-repo\n" + - " type: pool\n" + - " source:\n" + - " uri: $1\n" + - " branch: $2\n" + - " pool: $3<*>" - ); - } - - @Ignore - @Test public void autoInsertRequiredSourceProperties3() throws Exception { - //This case can not be implemented correctly because of the magic indentations that vscode - // automatically applies. The magic indents will allways indent the extra lines we insert after - // the value to be indented to the level of that value. So it is impossible to create an edit - // where the text on the lines following it is indented *less* than that value, which is what - // is required to implement this case correctly. - - //What if the type was on a new line (this is odd, but anyhow) - Editor editor = harness.newEditor( - "resources:\n" + - "- name: source-repo\n" + - " type: \n" + - " <*>" - ); - editor.assertCompletionWithLabel((l) -> l.startsWith("pool"), - "resources:\n" + - "- name: source-repo\n" + - " type: \n" + - " pool\n" + - " source:\n" + - " uri: $1\n" + - " branch: $2\n" + - " pool: $3<*>" - ); - } - - - - @Test public void reconcilerJobFromPassedAttributeMustInteractWithResource() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - aggregate:\n" + - " # - put: version\n" + - " - get: source-repo\n" + - "- name: test-it\n" + - " plan:\n" + - " - get: source-repo\n" + - " passed:\n" + - " - build-it # <- good\n" + - " - get: version\n" + - " passed:\n" + - " - build-it # <- bad\n" - ); - editor.assertProblems( - "build-it^ # <- bad|Job 'build-it' does not interact with resource 'version'" - ); - - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - aggregate:\n" + - " - put: version\n" + - " # - get: source-repo\n" + - "- name: test-it\n" + - " plan:\n" + - " - get: source-repo\n" + - " passed:\n" + - " - build-it # <- bad\n" + - " - get: version\n" + - " passed:\n" + - " - build-it # <- good\n" - ); - editor.assertProblems( - "build-it^ # <- bad|Job 'build-it' does not interact with resource 'source-repo'" - ); - - //Check that we find interactions in steps that are at the top-level of the plan: - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - aggregate:\n" + - " - put: version\n" + - " - get: source-repo\n" + - "- name: test-it\n" + - " plan:\n" + - " - get: source-repo\n" + - " passed:\n" + - " - build-it\n" + - " - get: version\n" + - " passed:\n" + - " - build-it\n" - ); - editor.assertProblems(/*NONE*/); - - //Check that we find interactions in steps that are nested in other steps - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - put: version\n" + - " - get: source-repo\n" + - "- name: test-it\n" + - " plan:\n" + - " - get: source-repo\n" + - " passed:\n" + - " - build-it\n" + - " - get: version\n" + - " passed:\n" + - " - build-it\n" - ); - editor.assertProblems(/*NONE*/); - - } - - @Test public void reconcilerSkipInteractsWithChecckedForNonExistantResource() throws Exception { - //See: https://www.pivotaltracker.com/story/show/144217965 - Editor editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - aggregate:\n" + - " - put: version\n" + - " - get: source-repo\n" + - "- name: test-it\n" + - " plan:\n" + - " - get: source-repo\n" + - " passed:\n" + - " - build-it\n" + - " - get: versi\n" + - " passed:\n" + - " - build-it" - ); - - editor.assertProblems("get: ^versi^|resource does not exist"); - } - - @Test public void relaxedContentAssistContextForListItem_sameLine() throws Exception { - Editor editor; - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " plan: <*>\n" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " plan: \n" + - " - put: <*>\n" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " plan: pu<*>\n" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " plan: \n" + - " - put: <*>\n" - ); - } - - @Test public void relaxedContentAssistContextForListItem_indented() throws Exception { - Editor editor; - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " <*>" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " - put: <*>" - ); - } - @Test public void relaxedContentAssistContextForListItem_not_indented() throws Exception { - Editor editor; - - //Note: this is a tricky case because when <*> lines up with 'plan' it will not be considered - // to be a child of 'plan' but a child of the 'job' instead. - // However, for hypothetical '- ' completions we'd have to treat as a child of plan instead! - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " <*>" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " - put: <*>" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " <*>" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - put: <*>" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " pu<*>" - ); - editor.assertCompletionWithLabel("- put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - put: <*>" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " ag" - ); - editor.assertCompletionWithLabel("- aggregate", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - aggregate:\n" + - " - <*>" - ); - } - - @Test public void relaxedContentAssist_primary_properties() throws Exception{ - //See https://www.pivotaltracker.com/story/show/144584163 - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: docker-git\n" + - "<*>" - ); - editor.assertCompletionLabels( - "groups", - "jobs", - "resource_types", - "→ type", - "- name" - ); - } - - @Test public void relaxedContentAssistLessSpaces() throws Exception { - Editor editor; - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " <*>" - ); - editor.assertCompletionWithLabel("← - put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " - put: <*>" - ); - - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " pu<*>" - ); - editor.assertCompletionWithLabel("← - put", - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " trigger: true\n" + - " - put: <*>" - ); - - // De-indentation relaxation should not be allowed if they cause the context node to be split. - // So in this example de-indented completions shouldn't be suggested. - editor = harness.newEditor( - "jobs:\n" + - "- name: build-docker-image\n" + - " serial: true\n" + - " plan:\n" + - " - get: docker-git\n" + - " <*>\n" + - " trigger: true\n" - ); - editor.assertNoCompletionsWithLabel(label -> label.startsWith(Unicodes.LEFT_ARROW+" "));; - } - - @Test public void reconcileUnusedResources() throws Exception { - Editor editor; - - editor = harness.newEditor( - "resources:\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - get: version\n" - ); - Diagnostic p = editor.assertProblems("source-repo|Unused 'Resource'").get(0); - assertEquals(DiagnosticSeverity.Error, p.getSeverity()); - - editor = harness.newEditor( - "resources:\n" + - "- name: not-used\n" + - " type: pool\n" + - "- name: version\n" + - " type: semver\n" + - "- name: source-repo\n" + - " type: git\n" + - " source:\n" + - " branch: master\n" + - " uri: git@github.com/blah\n" + - "jobs:\n" + - "- name: build-it\n" + - " plan:\n" + - " - aggregate:\n" + - " - get: not-used\n" + // <-- This isn't a real use but looks like one! - " resource: version\n" + - " - put: source-repo\n" - ); - editor.assertProblems( - "not-used|Unused 'Resource'" - ); - } - - @Test public void gitResourceFetchParameter() throws Exception { - Editor editor = harness.newEditor( - "resources:\n" + - " - name: cf-networking-dev\n" + - " type: git\n" + - " source:\n" + - " uri: git@github.com:cloudfoundry-incubator/cf-networking-release.git\n" + - " branch: develop\n" + - " ignore_paths:\n" + - " - docs\n" + - " private_key: {{cf-networking-deploy-key}}\n" + - "jobs:\n" + - "- name: foo\n" + - " plan:\n" + - " - get: cf-networking-dev\n" + - " params:\n" + - " fetch: [master]\n" + - " submodules: none\n" - ); - editor.assertProblems(/*NONE*/); - } - - ////////////////////////////////////////////////////////////////////////////// - - private void assertContextualCompletions(String conText, String textBefore, String... textAfter) throws Exception { - assertContextualCompletions((c) -> true, conText, textBefore, textAfter); - } - - private void assertContextualCompletions(Predicate isInteresting, String conText, String textBefore, String... textAfter) throws Exception { - assertContextualCompletions(LanguageId.CONCOURSE_PIPELINE, isInteresting, conText, textBefore, textAfter); - } - - private void assertContextualCompletions(LanguageId language, Predicate isInteresting, String conText, String textBefore, String... textAfter) throws Exception { - Editor editor = harness.newEditor(language, conText); - editor.reconcile(); //this ensures the conText is parsed and its AST is cached (will be used for - //dynamic CA when the conText + textBefore is not parsable. - assertContains(CURSOR, conText); - textBefore = conText.replace(CURSOR, textBefore); - textAfter = Arrays.stream(textAfter) - .map((String t) -> conText.replace(CURSOR, t)) - .collect(Collectors.toList()).toArray(new String[0]); - editor.setText(textBefore); - editor.assertCompletions(isInteresting, textAfter); - } - - private void assertCompletions(String textBefore, String... textAfter) throws Exception { - Editor editor = harness.newEditor(textBefore); - editor.assertCompletions(textAfter); - } - - private void assertTaskCompletions(String textBefore, String... textAfter) throws Exception { - Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, textBefore); - editor.assertCompletions(textAfter); - } - - private void assertContextualTaskCompletions(String conText, String textBefore, String... textAfter) throws Exception { - assertContextualCompletions(LanguageId.CONCOURSE_TASK, c -> true, conText, textBefore, textAfter); - } - - public static final Predicate RELAXED_COMPLETION - = c -> c.getLabel().startsWith("- ") - || c.getLabel().startsWith(Unicodes.LEFT_ARROW+" ") - || c.getLabel().startsWith(Unicodes.RIGHT_ARROW+" ") - ; - - public static final Predicate PLAIN_COMPLETION = c -> !RELAXED_COMPLETION.test(c); - public static final Predicate DEDENTED_COMPLETION = c -> c.getLabel().startsWith(Unicodes.LEFT_ARROW+" "); - public static final Predicate INDENTED_COMPLETION = c -> c.getLabel().startsWith(Unicodes.RIGHT_ARROW+" "); - -} diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/DurationParserTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/DurationParserTest.java deleted file mode 100644 index ed252117b..000000000 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/DurationParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import static org.junit.Assert.fail; - -import org.junit.Test; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; -import org.springframework.ide.vscode.commons.util.ValueParser; - -import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.*; - -public class DurationParserTest { - - private ValueParser parser = ConcourseValueParsers.DURATION; - - @Test - public void goodExamples() throws Exception { - parser.parse("1h40m"); - parser.parse("1.5h"); - parser.parse("23h59m59s99ms200µs100ns"); - } - - @Test - public void badExamples() { - does_not_parse("1h:40m"); - does_not_parse("15h 30m"); - does_not_parse("23hours"); - } - - private void does_not_parse(String string) { - try { - parser.parse(string); - fail("Should have failed parsing!"); - } catch (Exception e) { - assertContains("Duration", ExceptionUtil.getMessage(e)); - } - } - -} diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/TimeOfDayParserTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/TimeOfDayParserTest.java deleted file mode 100644 index 446dce071..000000000 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/TimeOfDayParserTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse; - -import static org.junit.Assert.fail; -import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains; - -import org.junit.Test; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; -import org.springframework.ide.vscode.commons.util.ValueParser; - -public class TimeOfDayParserTest { - - private ValueParser parser = ConcourseValueParsers.TIME_OF_DAY; - - @Test - public void goodExamples() throws Exception { - String[] examples = { - "3:04 PM -0700", - "3:04 PM +0700", - "3:04 AM +0700", - "00:00 AM +0700", - "23:59 PM +0800", - - "3PM -0700", - "0AM +0800", - "24AM +0800", - - "3 PM -0700", - "0 AM -0700", - "24 PM -1234", - - "15:04 -0700", - "0:00 -0700", - "23:59 -0700", - - "304 -0700", - "1504 -0700", - "0004 -0700", - "2359 -0700", - - "3:04 PM", - "0:00 AM", - "11:59 PM", - - "3PM", - "1AM", - "23PM", - - "3 PM", - "1 AM", - "23 PM", - - "15:04", - "0:00", - "00:00", - "23:59", - - "1504", - "0000", - "2359" - }; - for (String string : examples) { - parser.parse(string); - } - } - - @Test - public void badExamples() { - does_not_parse("arbirary garbage"); - does_not_parse("3:04 PM -0700 extra"); - does_not_parse("extra 3:04 PM -0700 extra"); - does_not_parse("extra 3:04 PM -0700"); - } - - private void does_not_parse(String string) { - try { - parser.parse(string); - fail("Should have failed parsing!"); - } catch (Exception e) { - assertContains("Time", ExceptionUtil.getMessage(e)); - } - } - -} diff --git a/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/completion/VscodeCompletionEngineAdapter.java b/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/completion/VscodeCompletionEngineAdapter.java index 933acbe02..b4e466f66 100644 --- a/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/completion/VscodeCompletionEngineAdapter.java +++ b/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/completion/VscodeCompletionEngineAdapter.java @@ -109,7 +109,7 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine { this.resolver = resolver; } - public void setMaxCompletionsNumber(int maxCompletions) { + public void setMaxCompletions(int maxCompletions) { this.maxCompletions = maxCompletions; } diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/CollectorUtil.java similarity index 97% rename from headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java rename to headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/CollectorUtil.java index 2ce3160f7..f08cfb56e 100644 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java +++ b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/CollectorUtil.java @@ -8,7 +8,7 @@ * Contributors: * Pivotal, Inc. - initial API and implementation *******************************************************************************/ -package org.springframework.ide.vscode.concourse.util; +package org.springframework.ide.vscode.commons.util; import java.util.Set; import java.util.function.BiConsumer; diff --git a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java index 3e4c9e621..d3f987773 100644 --- a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java +++ b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseLanguageServer.java @@ -79,7 +79,7 @@ public class ConcourseLanguageServer extends SimpleLanguageServer { } public void setMaxCompletions(int max) { - completionEngine.setMaxCompletionsNumber(max); + completionEngine.setMaxCompletions(max); } } diff --git a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java index 84448ff71..71ac7530b 100644 --- a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java +++ b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/ConcourseModel.java @@ -27,6 +27,7 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemC import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; import org.springframework.ide.vscode.commons.languageserver.util.SnippetBuilder; import org.springframework.ide.vscode.commons.util.Assert; +import org.springframework.ide.vscode.commons.util.CollectorUtil; import org.springframework.ide.vscode.commons.util.Log; import org.springframework.ide.vscode.commons.util.StringUtil; import org.springframework.ide.vscode.commons.util.text.IDocument; @@ -51,7 +52,6 @@ import org.springframework.ide.vscode.commons.yaml.schema.YTypedProperty; import org.springframework.ide.vscode.commons.yaml.schema.YValueHint; import org.springframework.ide.vscode.commons.yaml.util.Streams; import org.springframework.ide.vscode.concourse.ASTTypeCache.NodeTypes; -import org.springframework.ide.vscode.concourse.util.CollectorUtil; import org.springframework.ide.vscode.concourse.util.StaleFallbackCache; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; diff --git a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java b/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java deleted file mode 100644 index 2ce3160f7..000000000 --- a/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/util/CollectorUtil.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.concourse.util; - -import java.util.Set; -import java.util.function.BiConsumer; -import java.util.function.BinaryOperator; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collector; -import java.util.stream.Collectors; - -import com.google.common.collect.HashMultiset; -import com.google.common.collect.ImmutableMultiset; -import com.google.common.collect.ImmutableSet; - -/** - * Stuff missing from {@link Collectors} that we implement ourself. - */ -public class CollectorUtil { - - /** - * Collects elements into a ImmutableMutiset (the set is converted to an immutable one - * at the end. Accumulating / combining is done with a mutable Multiset because that involves - * less copying.) - */ - public static Collector, ImmutableMultiset> toMultiset() { - return new Collector, ImmutableMultiset>() { - - @Override - public Supplier> supplier() { - return HashMultiset::create; - } - - @Override - public BiConsumer, T> accumulator() { - return (a, e) -> a.add(e); - } - - @Override - public BinaryOperator> combiner() { - return (a1, a2) -> { - a1.addAll(a2); - return a1; - }; - } - @Override - public Function, ImmutableMultiset> finisher() { - return ImmutableMultiset::copyOf; - } - - @Override - public Set characteristics() { - return ImmutableSet.of(Collector.Characteristics.UNORDERED); - } - }; - } - -} diff --git a/vscode-extensions/vscode-bosh/lib/Main.ts b/vscode-extensions/vscode-bosh/lib/Main.ts index 67b75429d..ce00b67e9 100644 --- a/vscode-extensions/vscode-bosh/lib/Main.ts +++ b/vscode-extensions/vscode-bosh/lib/Main.ts @@ -13,8 +13,7 @@ import {TextDocument, OutputChannel} from 'vscode'; var log_output : OutputChannel = null; -const PIPELINE_LANGUAGE_ID = "concourse-pipeline-yaml"; -const TASK_LANGUAGE_ID = "concourse-task-yaml"; +const BOSH_DEPLOYMENT_LANGUAGE_ID = "bosh-deployment-manifest"; function log(msg : string) { if (log_output) { @@ -33,11 +32,11 @@ export function activate(context: VSCode.ExtensionContext) { let options : commons.ActivatorOptions = { DEBUG : false, CONNECT_TO_LS: false, - extensionId: 'vscode-concourse', + extensionId: 'vscode-bosh', fatJarFile: 'jars/language-server.jar', jvmHeap: "48m", clientOptions: { - documentSelector: [ PIPELINE_LANGUAGE_ID, TASK_LANGUAGE_ID ] + documentSelector: [ BOSH_DEPLOYMENT_LANGUAGE_ID ] } }; let clientPromise = commons.activate(options, context); diff --git a/vscode-extensions/vscode-bosh/scripts/preinstall.sh b/vscode-extensions/vscode-bosh/scripts/preinstall.sh index a7fb9223b..a0e1dc152 100755 --- a/vscode-extensions/vscode-bosh/scripts/preinstall.sh +++ b/vscode-extensions/vscode-bosh/scripts/preinstall.sh @@ -11,7 +11,7 @@ curl https://raw.githubusercontent.com/textmate/yaml.tmbundle/master/Syntaxes/YA npm install ../commons-vscode # Use maven to build fat jar of the language server -cd ../../headless-services/concourse-language-server +cd ../../headless-services/bosh-language-server ./build.sh mkdir -p ${workdir}/jars