├── .circleci └── config.yml ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .java-version ├── .mvn ├── jvm.config └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── runtime ├── codecoverage │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── codecoverage │ │ │ ├── CodeCoverage.java │ │ │ ├── CodecoverageModule.java │ │ │ ├── LcovReportProducer.java │ │ │ ├── StepInfo.java │ │ │ └── StepsRecorder.java │ │ └── test │ │ └── resources │ │ └── gen_html.bash └── opentelemetry │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── opentelemetry │ │ ├── ConcordSpan.java │ │ ├── ConcordSpanBuilder.java │ │ ├── ConcordSpanData.java │ │ ├── FlowSteps.java │ │ ├── OpentelemetryModule.java │ │ ├── StepId.java │ │ ├── StepInfo.java │ │ ├── TelemetryCollector.java │ │ ├── TelemetryExporter.java │ │ └── TelemetryParams.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── opentelemetry │ │ ├── FlowStepsSerializationTest.java │ │ └── TelemetryExporterTest.java │ └── resources │ └── logback.xml └── tasks ├── akeyless ├── README.md ├── akeyless-open-api.yaml ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── akeyless │ │ │ ├── AkeylessCommon.java │ │ │ ├── AkeylessTaskResult.java │ │ │ ├── SecretExporter.java │ │ │ ├── Util.java │ │ │ ├── model │ │ │ ├── Secret.java │ │ │ ├── SecretCache.java │ │ │ ├── SecretCacheImpl.java │ │ │ ├── SecretCacheNoop.java │ │ │ ├── TaskParams.java │ │ │ ├── TaskParamsImpl.java │ │ │ └── auth │ │ │ │ ├── ApiKeyAuth.java │ │ │ │ └── LdapAuth.java │ │ │ ├── v1 │ │ │ ├── AkeylessTask.java │ │ │ └── SecretExporterV1.java │ │ │ └── v2 │ │ │ ├── AkeylessTask.java │ │ │ └── SecretExporterV2.java │ └── test │ │ ├── filtered-resources │ │ └── version.properties │ │ ├── java │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── akeyless │ │ │ ├── CommonTest.java │ │ │ ├── TaskParamsImplTest.java │ │ │ └── it │ │ │ ├── AbstractIT.java │ │ │ ├── CommonIT.java │ │ │ ├── MockContext.java │ │ │ └── TaskIT.java │ │ └── resources │ │ ├── com │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── akeyless │ │ │ └── it │ │ │ ├── runtimeV1 │ │ │ └── concord.yml │ │ │ └── runtimeV2 │ │ │ └── concord.yml │ │ └── logback-test.xml ├── testPayload.sh ├── testPayloadV1.yml ├── testPayloadV2.yml └── testV2.yml ├── argocd ├── README.md ├── argocd.yml ├── local_argo │ ├── .gitignore │ ├── docker-compose.yml │ ├── install_argo.sh │ └── playbook │ │ ├── inventory.yml │ │ ├── main.yml │ │ └── roles │ │ └── argocd │ │ ├── files │ │ └── test_deployment.yaml │ │ ├── tasks │ │ └── main.yml │ │ └── templates │ │ ├── git_manifest.yaml │ │ └── oldap_manifest.yaml ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── argocd │ │ ├── ArgoCdClient.java │ │ ├── ArgoCdConstants.java │ │ ├── ArgoCdTask.java │ │ ├── AzureAuthCache.java │ │ ├── AzureAuthHandler.java │ │ ├── BasicAuthHandler.java │ │ ├── CallRetry.java │ │ ├── LdapAuthHandler.java │ │ ├── MapUtils.java │ │ ├── NoopTrustManager.java │ │ ├── ObjectMapper.java │ │ ├── RecordEvents.java │ │ ├── TaskParams.java │ │ ├── TaskParamsImpl.java │ │ ├── TokenAuthHandler.java │ │ ├── WaitWatchParams.java │ │ └── model │ │ ├── EventStatus.java │ │ ├── HealthStatus.java │ │ ├── HttpExecutor.java │ │ └── SyncStatus.java │ └── test │ ├── filtered-resources │ └── version.properties │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── argocd │ │ ├── ArgoCdClientIT.java │ │ ├── ArgoCdClientTest.java │ │ ├── CallRetryTest.java │ │ ├── MapUtilsTest.java │ │ ├── TaskParamsImplTest.java │ │ └── it │ │ ├── ArgoIT.java │ │ └── ArgoK3sIT.java │ └── resources │ ├── com │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── argocd │ │ ├── emptyResponse.json │ │ ├── it │ │ ├── full │ │ │ └── concord.yml │ │ └── runtimeV2 │ │ │ └── concord.yml │ │ └── model │ │ └── application.json │ ├── example-flow │ ├── concord.yml │ └── run.sh │ └── logback-test.xml ├── aws ├── examples │ └── ecr │ │ └── concord.yml ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── aws │ │ └── EcrTask.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── aws │ │ ├── EcrTaskTest.java │ │ └── MockContext.java │ └── resources │ └── logback.xml ├── confluence ├── examples │ ├── README.md │ ├── concord.yml │ ├── content.mustache │ ├── path │ │ └── toMy │ │ │ └── myFile.ini │ └── run.sh ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── walmartlabs │ └── concord │ └── plugins │ └── confluence │ ├── ConfluenceClient.java │ ├── ConfluenceTask.java │ ├── ConfluenceTaskCommon.java │ ├── Constants.java │ ├── Result.java │ ├── TaskParams.java │ ├── Utils.java │ └── v2 │ └── ConfluenceTaskV2.java ├── git ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── git │ │ ├── GitCliClient.java │ │ ├── GitClient.java │ │ ├── GitClientFactory.java │ │ ├── GitHubTask.java │ │ ├── GitSecretService.java │ │ ├── GitTask.java │ │ ├── JGitClient.java │ │ ├── TokenSecret.java │ │ ├── Utils.java │ │ ├── v1 │ │ ├── GitHubTaskV1.java │ │ └── GitTaskV1.java │ │ └── v2 │ │ ├── GitTaskV2.java │ │ └── GithubTaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── git │ │ ├── GitHubCommonTest.java │ │ └── v2 │ │ ├── CommitTest.java │ │ ├── GitTaskV2Test.java │ │ ├── IssueTest.java │ │ ├── PullRequestTest.java │ │ └── RepoTest.java │ └── resources │ ├── logback.xml │ └── wiremock │ ├── commit │ ├── __files │ │ ├── create_status.json │ │ ├── get.json │ │ ├── get_repo.json │ │ └── list_statuses.json │ └── mappings │ │ ├── create_status.json │ │ ├── get.json │ │ ├── get_repo.json │ │ └── list_statuses.json │ ├── issue │ ├── __files │ │ └── get_or_create.json │ └── mappings │ │ └── create.json │ ├── pullRequest │ ├── __files │ │ ├── comment_pr.json │ │ ├── get_commit_list.json │ │ ├── get_files.json │ │ ├── get_or_create_pr.json │ │ ├── list_prs.json │ │ └── merge_pr.json │ └── mappings │ │ ├── close_pr.json │ │ ├── comment_pr.json │ │ ├── create_pr.json │ │ ├── get_commit_list.json │ │ ├── get_files.json │ │ ├── get_pr.json │ │ ├── list_prs.json │ │ └── merge_pr.json │ └── repo │ ├── __files │ ├── contents.json │ ├── create.json │ ├── create_hook.json │ ├── create_ref.json │ ├── create_tag.json │ ├── fork.json │ ├── get.json │ ├── list_branches.json │ └── list_tags.json │ └── mappings │ ├── contents.json │ ├── create.json │ ├── create_hook.json │ ├── create_ref.json │ ├── create_tag.json │ ├── delete.json │ ├── delete_branch.json │ ├── delete_tag.json │ ├── fork.json │ ├── get_error.json │ ├── get_for_create.json │ ├── get_for_delete.json │ ├── list_branches.json │ ├── list_tags.json │ └── merge.json ├── gremlin ├── examples │ ├── README.md │ ├── concord.yml │ └── run.sh ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── gremlin │ │ ├── AttackResult.java │ │ ├── Constants.java │ │ ├── GremlinClient.java │ │ ├── GremlinClientParams.java │ │ ├── GremlinTask.java │ │ ├── GremlinTaskCommon.java │ │ ├── K8SAttackResult.java │ │ ├── NetworkAttacks.java │ │ ├── ResourceAttacks.java │ │ ├── StateAttacks.java │ │ ├── TaskParams.java │ │ ├── Utils.java │ │ ├── Version.java │ │ └── v2 │ │ └── GremlinTaskV2.java │ └── resources │ └── version.properties ├── hashivault ├── README.md ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── hashivault │ │ │ ├── HashiVaultTaskCommon.java │ │ │ ├── HashiVaultTaskException.java │ │ │ ├── HashiVaultTaskResult.java │ │ │ ├── TaskParams.java │ │ │ ├── v1 │ │ │ └── HashiVaultTask.java │ │ │ └── v2 │ │ │ └── HashiVaultTask.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── hashivault │ │ │ ├── AbstractVaultTest.java │ │ │ ├── UnitTest.java │ │ │ ├── v1 │ │ │ └── HashiVaultTaskV1Test.java │ │ │ └── v2 │ │ │ └── HashiVaultTaskV2Test.java │ │ └── resources │ │ ├── ca.pem │ │ ├── cert.ext │ │ ├── logback-test.xml │ │ ├── nginx.conf │ │ ├── server.crt │ │ ├── server.key │ │ └── vault.conf ├── testCLI.sh ├── testCLI.yml ├── testPayload.sh ├── testPayloadV1.yml └── testPayloadV2.yml ├── jenkins ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jenkins │ │ ├── Constants.java │ │ ├── JenkinsClient.java │ │ ├── JenkinsConfiguration.java │ │ ├── JenkinsTask.java │ │ ├── JenkinsTaskCommon.java │ │ ├── Utils.java │ │ ├── model │ │ ├── BuildInfo.java │ │ ├── Executable.java │ │ └── QueueItem.java │ │ └── v2 │ │ └── JenkinsTaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jenkins │ │ └── JenkinsTaskTest.java │ └── resources │ └── logback.xml ├── jira ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jira │ │ ├── Constants.java │ │ ├── JiraClientCfg.java │ │ ├── JiraCredentials.java │ │ ├── JiraHttpClient.java │ │ ├── JiraSecretService.java │ │ ├── JiraTask.java │ │ ├── JiraTaskCommon.java │ │ ├── NativeJiraHttpClient.java │ │ ├── TaskParams.java │ │ └── v2 │ │ └── JiraTaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jira │ │ ├── AbstractWiremockTest.java │ │ ├── CommonClientLoaderTest.java │ │ ├── CommonTest.java │ │ ├── JiraTaskTest.java │ │ ├── NativeJiraHttpClientTest.java │ │ ├── TaskParamsTest.java │ │ └── v2 │ │ └── JiraTaskV2Test.java │ └── resources │ ├── logback-test.xml │ └── sample.txt ├── jsonpath ├── examples │ └── todos │ │ ├── README.md │ │ ├── concord.yml │ │ └── run.sh ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jsonpath │ │ ├── JsonPathTask.java │ │ ├── JsonPathTaskCommon.java │ │ ├── TaskParams.java │ │ └── v2 │ │ └── JsonPathTaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── jsonpath │ │ └── JsonPathTest.java │ └── resources │ └── logback.xml ├── ldap ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── walmartlabs │ └── concord │ └── plugins │ └── ldap │ ├── LdapConnectionCfg.java │ ├── LdapSearchParams.java │ ├── LdapTask.java │ ├── LdapTaskCommon.java │ ├── TaskParams.java │ └── v2 │ └── LdapTaskV2.java ├── msteams ├── .gitignore ├── examples │ ├── minimal │ │ ├── README.md │ │ ├── concord.yml │ │ └── run.sh │ ├── msteamsV2 │ │ ├── README.md │ │ ├── concord.yml │ │ └── run.sh │ └── usingSectionsActions │ │ ├── README.md │ │ ├── concord.yml │ │ └── run.sh ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── msteams │ │ ├── Constants.java │ │ ├── ContextVariables.java │ │ ├── Result.java │ │ ├── TeamsClient.java │ │ ├── TeamsClientV2.java │ │ ├── TeamsConfiguration.java │ │ ├── TeamsTask.java │ │ ├── TeamsTaskCommon.java │ │ ├── TeamsTaskParams.java │ │ ├── TeamsTaskV2.java │ │ ├── TeamsV2Configuration.java │ │ ├── TeamsV2TaskCommon.java │ │ ├── TeamsV2TaskParams.java │ │ ├── Utils.java │ │ └── v2 │ │ ├── TeamsTaskV2.java │ │ └── TeamsV2TaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── msteams │ │ ├── CommonV1Test.java │ │ ├── CommonV2Test.java │ │ ├── TeamsTaskTest.java │ │ ├── TeamsTaskV2Test.java │ │ ├── it │ │ ├── AbstractIT.java │ │ ├── MSTeamsV1IT.java │ │ └── MSTeamsV2IT.java │ │ └── v2 │ │ ├── TeamsTaskV2Test.java │ │ └── TeamsV2TaskV2Test.java │ └── resources │ └── logback.xml ├── packer ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── packer │ │ │ ├── PackerTask.java │ │ │ └── commands │ │ │ ├── Build.java │ │ │ └── Version.java │ └── resources │ │ └── packer │ │ └── descriptor.yml │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── packer │ │ ├── PackerTaskExecutionTest.java │ │ └── PackerTaskTest.java │ ├── packer │ └── packer-test.json │ └── resources │ └── logback.xml ├── puppet ├── README.md ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── puppet │ │ │ ├── Constants.java │ │ │ ├── IgnoringTrustManager.java │ │ │ ├── PuppetClient.java │ │ │ ├── PuppetTask.java │ │ │ ├── PuppetTaskV2.java │ │ │ ├── Utils.java │ │ │ ├── UtilsV2.java │ │ │ └── model │ │ │ ├── PuppetResult.java │ │ │ ├── SecretExporter.java │ │ │ ├── cfg │ │ │ ├── DbQueryCfg.java │ │ │ ├── PuppetConfiguration.java │ │ │ └── RbacCfg.java │ │ │ ├── dbquery │ │ │ └── DbQueryPayload.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── ConfigException.java │ │ │ ├── InvalidValueException.java │ │ │ └── MissingParameterException.java │ │ │ └── token │ │ │ ├── TokenPayload.java │ │ │ └── TokenResult.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── puppet │ │ │ ├── AbstractApiTest.java │ │ │ ├── ApiExceptionTest.java │ │ │ ├── ConfigurationTest.java │ │ │ ├── IgnoringTrustManagerTest.java │ │ │ ├── PuppetClientTest.java │ │ │ ├── PuppetConfigurationTest.java │ │ │ ├── PuppetTaskTest.java │ │ │ ├── PuppetTaskV2Test.java │ │ │ └── UtilsTest.java │ │ └── resources │ │ ├── logback.xml │ │ ├── simpleQueryResult.json │ │ └── tokenCreate.json ├── test.sh ├── test.yml ├── testV2.yml └── wiremock_cert │ ├── ca.pem │ ├── cert.ext │ ├── server.crt │ └── server.key ├── s3 ├── examples │ └── put_get │ │ └── concord.yml ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── s3 │ │ ├── Constants.java │ │ ├── ErrorResult.java │ │ ├── GetObjectResult.java │ │ ├── PutObjectResult.java │ │ ├── Result.java │ │ ├── S3Task.java │ │ ├── S3TaskCommon.java │ │ ├── TaskParams.java │ │ └── v2 │ │ └── S3TaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── s3 │ │ ├── S3TaskTest.java │ │ └── S3TaskV2Test.java │ └── resources │ └── logback-test.xml ├── terraform ├── README.md ├── examples │ ├── README.md │ ├── approval │ │ ├── concord.yml │ │ ├── example.tf │ │ ├── forms │ │ │ └── approvalForm │ │ │ │ ├── data.js │ │ │ │ └── index.html │ │ └── run.sh │ ├── azure-ansible │ │ ├── concord.yml │ │ ├── example.tf │ │ ├── playbook.yml │ │ └── run.sh │ ├── azure-minimal │ │ ├── concord.yml │ │ ├── example.tf │ │ └── run.sh │ ├── gcp-minimal │ │ ├── README.md │ │ ├── concord.yml │ │ ├── example.tf │ │ └── run.sh │ ├── minimal │ │ ├── concord.yml │ │ ├── example.tf │ │ └── run.sh │ └── output │ │ ├── concord.yml │ │ ├── example.tf │ │ └── run.sh ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── terraform │ │ │ ├── Action.java │ │ │ ├── GitSshWrapper.java │ │ │ ├── TaskConstants.java │ │ │ ├── Terraform.java │ │ │ ├── TerraformArgs.java │ │ │ ├── TerraformBinaryResolver.java │ │ │ ├── TerraformDockerService.java │ │ │ ├── TerraformExecutable.java │ │ │ ├── TerraformTask.java │ │ │ ├── TerraformTaskCommon.java │ │ │ ├── TerraformTaskV2.java │ │ │ ├── Utils.java │ │ │ ├── VersionUtils.java │ │ │ ├── actions │ │ │ ├── Action.java │ │ │ ├── ApplyAction.java │ │ │ ├── DestroyAction.java │ │ │ ├── OutputAction.java │ │ │ ├── PlanAction.java │ │ │ └── TerraformActionResult.java │ │ │ ├── backend │ │ │ ├── Backend.java │ │ │ ├── BackendFactory.java │ │ │ ├── BackendFactoryV1.java │ │ │ ├── BackendFactoryV2.java │ │ │ ├── CommonBackend.java │ │ │ ├── ConcordV1Backend.java │ │ │ ├── ConcordV2Backend.java │ │ │ ├── DummyBackend.java │ │ │ └── RemoteBackend.java │ │ │ └── commands │ │ │ ├── ApplyCommand.java │ │ │ ├── DestroyCommand.java │ │ │ ├── InitCommand.java │ │ │ ├── OutputCommand.java │ │ │ └── PlanCommand.java │ └── test │ │ ├── filtered-resources │ │ └── version.properties │ │ ├── java │ │ └── com │ │ │ └── walmartlabs │ │ │ └── concord │ │ │ └── plugins │ │ │ └── terraform │ │ │ ├── AbstractTerraformTest.java │ │ │ ├── TerraformTaskIT.java │ │ │ ├── TerraformTaskTest.java │ │ │ ├── TerraformTaskV2Test.java │ │ │ ├── backend │ │ │ └── BackendManagerTest.java │ │ │ └── docker │ │ │ ├── DockerContainerSpecV1Compat.java │ │ │ └── DockerService.java │ │ ├── resources │ │ ├── com │ │ │ └── walmartlabs │ │ │ │ └── concord │ │ │ │ └── plugins │ │ │ │ └── terraform │ │ │ │ ├── it │ │ │ │ └── main.tf │ │ │ │ ├── runtimeV1 │ │ │ │ └── concord.yml │ │ │ │ └── runtimeV2 │ │ │ │ └── concord.yml │ │ └── logback.xml │ │ └── terraform │ │ ├── main.tf │ │ ├── minimal_aws │ │ └── main.tf │ │ ├── minimal_azure │ │ └── main.tf │ │ ├── terraform.tfstate │ │ ├── varfile0.tfvars │ │ └── varfile1.tfvars ├── testPayload.sh ├── testPayloadV1.yml └── testPayloadV2.yml ├── xml ├── examples │ └── maven │ │ ├── README.md │ │ ├── concord.yml │ │ └── pom.xml ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── xmlutils │ │ ├── XmlUtilsTask.java │ │ ├── XmlUtilsTaskCommon.java │ │ └── v2 │ │ └── XmlUtilsTaskV2.java │ └── test │ ├── java │ └── com │ │ └── walmartlabs │ │ └── concord │ │ └── plugins │ │ └── xmlutils │ │ ├── XmlUtilsTaskTest.java │ │ └── XmlUtilsTaskV2Test.java │ └── resources │ ├── test.xml │ ├── test2.xml │ └── test_external.xml └── zoom ├── examples └── send_message │ ├── README.md │ ├── concord.yml │ └── run.sh ├── pom.xml └── src └── main └── java └── com └── walmartlabs └── concord └── plugins └── zoom ├── Constants.java ├── Result.java ├── TaskParams.java ├── ZoomClient.java ├── ZoomConfiguration.java ├── ZoomTask.java ├── ZoomTaskCommon.java └── v2 └── ZoomTaskV2.java /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | executorType: machine 3 | jobs: 4 | build: 5 | steps: 6 | - checkout 7 | 8 | - restore_cache: 9 | key: concord-plugins-{{ checksum "pom.xml" }} 10 | 11 | - run: ./mvnw -B dependency:go-offline > /dev/null 12 | 13 | - save_cache: 14 | paths: 15 | - ~/.m2 16 | key: concord-plugins-{{ checksum "pom.xml" }} 17 | 18 | - run: ./mvnw -B clean install 19 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [ 'master' ] 6 | pull_request: 7 | branches: [ 'master' ] 8 | 9 | concurrency: 10 | group: ${{ github.ref }}-build 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build: 15 | strategy: 16 | matrix: 17 | jdk_version: ['17'] 18 | fail-fast: false 19 | 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - name: Clear old Docker resources 24 | run: | 25 | docker rm -f $(docker ps -aq) || true 26 | docker system prune -af || true 27 | docker image prune -af || true 28 | docker volume prune -f || true 29 | 30 | - uses: actions/checkout@v3 31 | 32 | - name: Set up JDK 33 | uses: actions/setup-java@v3 34 | with: 35 | java-version: '${{ matrix.jdk_version }}' 36 | distribution: 'temurin' 37 | 38 | - name: Remove old Concord artifacts 39 | run: | 40 | rm -rf ~/.m2/repository/com/walmartlabs/concord 41 | rm -rf ~/actions-runner/.m2/repository/com/walmartlabs/concord 42 | 43 | - name: Build and test with Maven 44 | run: ./mvnw -B clean install 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ipr 3 | *.iws 4 | target/ 5 | pom.xml.versionsBackup 6 | .idea 7 | .*.swp 8 | .*.swo 9 | .project 10 | .classpath 11 | .settings 12 | .pmdruleset.xml 13 | .pmd 14 | .arcconfig 15 | nohup.out 16 | nb-configuration.xml 17 | pom.xml.bak 18 | jmeter.log 19 | .terraform/ -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 17.0 2 | -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Dorg.slf4j.simpleLogger.log.org.openapitools.codegen=warn 2 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/concord-plugins/739608a0dea7f7317a8ae494c05c09c5eb479b39/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | 5 | cache: 6 | directories: 7 | - $HOME/.m2 8 | 9 | script: 10 | - mvn -U -B clean package 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-present, Walmart Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License." 14 | -------------------------------------------------------------------------------- /runtime/codecoverage/README.md: -------------------------------------------------------------------------------- 1 | # codecoverage 2 | 3 | A plugin for Concord runtime-v2 that adds code coverage capabilities. 4 | 5 | ## Usage 6 | 7 | To use the plugin, add the following dependency to your Concord process: 8 | 9 | ```yaml 10 | configuration: 11 | dependencies: 12 | - mvn://com.walmartlabs.concord.plugins:codecoverage: 13 | ``` 14 | 15 | ## Generating HTML report with LCOV 16 | 17 | The plugin produces a file in [the LCOV format](https://github.com/linux-test-project/lcov). 18 | 19 | 1. Download coverage info: `/api/v1/process/${INSTANCE_ID}/attachment/coverage.info` 20 | 2. Download and unzip process flows: `/api/v1/process/${INSTANCE_ID}/attachment/flows.zip` 21 | 3. Generate HTML with: `genhtml "coverage.info" --output-directory "html"` 22 | -------------------------------------------------------------------------------- /runtime/codecoverage/src/main/java/com/walmartlabs/concord/plugins/codecoverage/CodecoverageModule.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.codecoverage; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.google.inject.Binder; 24 | import com.google.inject.Module; 25 | import com.google.inject.multibindings.Multibinder; 26 | import com.walmartlabs.concord.svm.ExecutionListener; 27 | 28 | import javax.inject.Named; 29 | 30 | @Named 31 | public class CodecoverageModule implements Module { 32 | 33 | @Override 34 | public void configure (Binder binder){ 35 | var executionListeners = Multibinder.newSetBinder(binder, ExecutionListener.class); 36 | executionListeners.addBinding().to(CodeCoverage.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /runtime/codecoverage/src/main/java/com/walmartlabs/concord/plugins/codecoverage/StepInfo.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.codecoverage; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 24 | import com.fasterxml.jackson.annotation.JsonInclude; 25 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 26 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 27 | import org.immutables.value.Value; 28 | 29 | import javax.annotation.Nullable; 30 | 31 | @Value.Immutable 32 | @Value.Style(jdkOnly = true) 33 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonSerialize(as = ImmutableStepInfo.class) 36 | @JsonDeserialize(as = ImmutableStepInfo.class) 37 | public interface StepInfo { 38 | 39 | String fileName(); 40 | 41 | int line(); 42 | 43 | @Nullable 44 | String processDefinitionId(); 45 | 46 | @Nullable 47 | String flowCallName(); 48 | 49 | static ImmutableStepInfo.Builder builder() { 50 | return ImmutableStepInfo.builder(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /runtime/codecoverage/src/test/resources/gen_html.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $# -lt 3 ]]; then 4 | echo "Usage: $0 " 5 | exit 1 6 | fi 7 | 8 | BASE_URL=$1 9 | INSTANCE_ID=$2 10 | TOKEN=$3 11 | 12 | OUTPUT_DIR="./code-coverage" 13 | 14 | FILES=("coverage.info" "flows.zip") 15 | UNZIP_DIR="${OUTPUT_DIR}" 16 | 17 | mkdir -p "$OUTPUT_DIR" "$UNZIP_DIR" 18 | 19 | download_file() { 20 | local file_name=$1 21 | local download_url="${BASE_URL}/api/v1/process/${INSTANCE_ID}/attachment/${file_name}" 22 | local output_file="${OUTPUT_DIR}/${file_name}" 23 | 24 | echo "Downloading ${file_name} from ${download_url}..." 25 | 26 | if curl -H "Authorization: ${TOKEN}" -o "${output_file}" -L "${download_url}"; then 27 | echo "File downloaded successfully: ${output_file}" 28 | else 29 | echo "Failed to download the file: ${download_url}" 30 | exit 1 31 | fi 32 | } 33 | 34 | for file in "${FILES[@]}"; do 35 | download_file "$file" 36 | done 37 | 38 | ZIP_FILE="${OUTPUT_DIR}/flows.zip" 39 | 40 | echo "Unzipping ${ZIP_FILE} into ${UNZIP_DIR}..." 41 | 42 | if unzip -o "$ZIP_FILE" -d "$UNZIP_DIR"; then 43 | echo "File unzipped successfully to: ${UNZIP_DIR}" 44 | else 45 | echo "Failed to unzip file: ${ZIP_FILE}" 46 | exit 1 47 | fi 48 | 49 | if (cd "${OUTPUT_DIR}" && genhtml "coverage.info" --output-directory "html"); then 50 | echo "HTML report generated successfully in: ${OUTPUT_DIR}/html" 51 | else 52 | echo "Failed to generate HTML report" 53 | exit 1 54 | fi 55 | -------------------------------------------------------------------------------- /runtime/opentelemetry/README.md: -------------------------------------------------------------------------------- 1 | # opentelemetry 2 | 3 | A plugin for Concord runtime-v2 that adds tracing capabilities using OpenTelemetry. 4 | Process traces are collected after the process finishes and are sent to a configured collector. 5 | 6 | ## Usage 7 | 8 | To use the plugin, add the following dependency to your Concord process: 9 | 10 | ```yaml 11 | configuration: 12 | dependencies: 13 | - mvn://com.walmartlabs.concord.plugins:opentelemetry: 14 | ``` 15 | 16 | The plugin is configured using `defaultTaskVariables`. For example, using 17 | [project-level configuration](https://concord.walmartlabs.com/docs/getting-started/projects.html#configuration): 18 | 19 | ```yaml 20 | 21 | ```json 22 | { 23 | "defaultTaskVariables": { 24 | "opentelemetry": { 25 | "enabled": true, 26 | "endpoint": "http://localhost:4318/v1/traces" 27 | } 28 | } 29 | } 30 | ``` 31 | 32 | The `endpoint` is the address of the OpenTelemetry collector that will receive the traces. 33 | 34 | Once the plugin is configured, the traces will be sent to the collector after any process finishes (or fails). 35 | -------------------------------------------------------------------------------- /runtime/opentelemetry/src/main/java/com/walmartlabs/concord/plugins/opentelemetry/ConcordSpanData.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.opentelemetry; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import io.opentelemetry.sdk.trace.data.SpanData; 24 | import org.immutables.value.Value; 25 | 26 | @Value.Immutable 27 | @Value.Style(jdkOnly = true) 28 | public abstract class ConcordSpanData implements SpanData { 29 | 30 | static ImmutableConcordSpanData.Builder builder() { 31 | return ImmutableConcordSpanData.builder(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /runtime/opentelemetry/src/main/java/com/walmartlabs/concord/plugins/opentelemetry/OpentelemetryModule.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.opentelemetry; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.google.inject.Binder; 24 | import com.google.inject.multibindings.Multibinder; 25 | import com.walmartlabs.concord.svm.ExecutionListener; 26 | 27 | import javax.inject.Named; 28 | 29 | @Named 30 | public class OpentelemetryModule implements com.google.inject.Module { 31 | 32 | @Override 33 | public void configure (Binder binder){ 34 | Multibinder taskProviders = Multibinder.newSetBinder(binder, ExecutionListener.class); 35 | taskProviders.addBinding().to(TelemetryCollector.class); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /runtime/opentelemetry/src/main/java/com/walmartlabs/concord/plugins/opentelemetry/StepId.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.opentelemetry; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 25 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 26 | import org.immutables.value.Value; 27 | 28 | import javax.annotation.Nullable; 29 | import java.io.Serial; 30 | import java.io.Serializable; 31 | import java.util.UUID; 32 | 33 | @Value.Immutable 34 | @Value.Style(jdkOnly = true) 35 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 36 | @JsonSerialize(as = ImmutableStepId.class) 37 | @JsonDeserialize(as = ImmutableStepId.class) 38 | public interface StepId extends Serializable { 39 | 40 | @Serial 41 | long serialVersionUID = 1L; 42 | 43 | @Value.Parameter 44 | UUID correlationId(); 45 | 46 | @Nullable 47 | @Value.Parameter 48 | Integer loopIndex(); 49 | 50 | static StepId from(UUID correlationId) { 51 | return ImmutableStepId.of(correlationId, null); 52 | } 53 | 54 | static StepId from(UUID correlationId, Integer loopIndex) { 55 | return ImmutableStepId.of(correlationId, loopIndex); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /runtime/opentelemetry/src/test/java/com/walmartlabs/concord/plugins/opentelemetry/TelemetryExporterTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.opentelemetry; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import org.junit.jupiter.api.Disabled; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import java.util.List; 27 | import java.util.UUID; 28 | 29 | @Disabled() 30 | public class TelemetryExporterTest { 31 | 32 | @Test 33 | public void test() { 34 | TelemetryExporter exporter = new TelemetryExporter("http://localhost:64318/v1/traces"); 35 | 36 | FlowSteps steps = new FlowSteps(UUID.randomUUID(), "fake-test-entrypoint", System.currentTimeMillis(), List.of()); 37 | 38 | steps.onStepStart(StepId.from(UUID.randomUUID()), "test-step", null, "test.concord.yaml", 1, "my-test-flow"); 39 | 40 | String traceId = exporter.sendTelemetry(steps, true); 41 | 42 | System.out.println(traceId); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /runtime/opentelemetry/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/AkeylessTaskResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.Map; 24 | 25 | public class AkeylessTaskResult { 26 | private final Boolean ok; 27 | private final String error; 28 | private final Map data; 29 | 30 | public AkeylessTaskResult(Boolean ok, Map data, String error) { 31 | this.ok = ok; 32 | this.error = error; 33 | this.data = data; 34 | } 35 | 36 | public static AkeylessTaskResult of(boolean ok, Map data, String error) { 37 | return new AkeylessTaskResult(ok, data, error); 38 | } 39 | 40 | public Boolean getOk() { 41 | return ok; 42 | } 43 | 44 | public String getError() { 45 | return error; 46 | } 47 | 48 | public Map getData() { 49 | return data; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/SecretExporter.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.akeyless.model.Secret; 24 | 25 | public interface SecretExporter { 26 | void initCache(String salt, boolean debug); 27 | Secret.StringSecret exportAsString(String orgName, String secretName, String password); 28 | Secret.CredentialsSecret exportCredentials(String orgName, String secretName, String password); 29 | } 30 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/model/Secret.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | /** 24 | * Marker interface (no methods) for indicating a type which is a secret 25 | */ 26 | public interface Secret { 27 | 28 | class CredentialsSecret implements Secret { 29 | private final String username; 30 | private final String password; 31 | 32 | public CredentialsSecret(String username, String password) { 33 | this.username = username; 34 | this.password = password; 35 | } 36 | 37 | public String getUsername() { 38 | return username; 39 | } 40 | 41 | public String getPassword() { 42 | return password; 43 | } 44 | } 45 | 46 | class StringSecret implements Secret { 47 | private final String data; 48 | 49 | public StringSecret(String data) { 50 | this.data = data; 51 | } 52 | 53 | public String getValue() { 54 | return data; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/model/SecretCache.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.function.Supplier; 24 | 25 | public interface SecretCache { 26 | T get(String org, String name, Supplier lookup); 27 | void put(String org, String name, T value); 28 | } 29 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/model/SecretCacheNoop.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.function.Supplier; 24 | 25 | public class SecretCacheNoop implements SecretCache { 26 | 27 | private static final SecretCacheNoop stringCache = new SecretCacheNoop<>(); 28 | private static final SecretCacheNoop credentialCache = new SecretCacheNoop<>(); 29 | 30 | public static SecretCache getStringCache() { 31 | return stringCache; 32 | } 33 | 34 | public static SecretCache getCredentialCache() { 35 | return credentialCache; 36 | } 37 | 38 | @Override 39 | public T get(String org, String name, Supplier lookup) { 40 | return lookup.get(); 41 | } 42 | 43 | @Override 44 | public void put(String org, String name, Secret value) { 45 | // no cache in noop 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tasks/akeyless/src/main/java/com/walmartlabs/concord/plugins/akeyless/model/auth/ApiKeyAuth.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless.model.auth; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.akeyless.SecretExporter; 24 | import com.walmartlabs.concord.plugins.akeyless.model.Auth; 25 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 26 | 27 | import static com.walmartlabs.concord.plugins.akeyless.Util.stringOrSecret; 28 | 29 | public class ApiKeyAuth { 30 | private static final String ACCESS_ID_KEY = "accessId"; 31 | private static final String ACCESS_KEY_KEY = "accessKey"; 32 | 33 | public static Auth of(Variables vars, SecretExporter secretExporter) { 34 | return new Auth() 35 | .accessId(stringOrSecret(vars.get(ACCESS_ID_KEY), secretExporter)) 36 | .accessKey(stringOrSecret(vars.get(ACCESS_KEY_KEY), secretExporter)); 37 | } 38 | 39 | private ApiKeyAuth() { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tasks/akeyless/src/test/filtered-resources/version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} -------------------------------------------------------------------------------- /tasks/akeyless/src/test/java/com/walmartlabs/concord/plugins/akeyless/TaskParamsImplTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.akeyless; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.akeyless.model.TaskParams; 24 | import com.walmartlabs.concord.plugins.akeyless.model.TaskParamsImpl; 25 | import org.junit.jupiter.api.Test; 26 | 27 | import java.util.*; 28 | 29 | import static org.junit.jupiter.api.Assertions.assertEquals; 30 | 31 | class TaskParamsImplTest { 32 | 33 | @Test 34 | void testGetSecretsParams() { 35 | Map cfg = new HashMap<>(); 36 | cfg.put("txId", UUID.randomUUID().toString()); 37 | cfg.put("action", "getSecrets"); 38 | List paths = new ArrayList<>(2); 39 | paths.add("/firstPath"); 40 | paths.add("/second/path"); 41 | cfg.put("paths", paths); 42 | 43 | TaskParams params = TaskParamsImpl.of(cfg, Collections.emptyMap(), Collections.emptyMap()); 44 | assertEquals(TaskParams.Action.GETSECRETS, params.action()); 45 | 46 | TaskParams.GetSecretsParams getSecretsParams = (TaskParams.GetSecretsParams) params; 47 | assertEquals(2, getSecretsParams.paths().size()); 48 | assertEquals("/second/path", getSecretsParams.paths().get(1)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tasks/akeyless/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tasks/argocd/local_argo/.gitignore: -------------------------------------------------------------------------------- 1 | playbook/roles/argocd/files/generated 2 | *venv 3 | -------------------------------------------------------------------------------- /tasks/argocd/local_argo/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # to run define K3S_TOKEN, K3S_VERSION is optional, eg: 2 | # K3S_TOKEN=${RANDOM}${RANDOM}${RANDOM} docker-compose up 3 | 4 | services: 5 | 6 | server: 7 | image: "rancher/k3s:${K3S_VERSION:-latest}" 8 | command: server 9 | tmpfs: 10 | - /run 11 | - /var/run 12 | ulimits: 13 | nproc: 65535 14 | nofile: 15 | soft: 65535 16 | hard: 65535 17 | privileged: true 18 | restart: always 19 | environment: 20 | - K3S_TOKEN=${K3S_TOKEN:?err} 21 | - K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml 22 | - K3S_KUBECONFIG_MODE=666 23 | volumes: 24 | - k3s-server:/var/lib/rancher/k3s 25 | # This is just so that we get the kubeconfig file out 26 | - ./playbook/roles/argocd/files/generated:/output 27 | ports: 28 | - 6443:6443 # Kubernetes API Server 29 | - 80:80 # Ingress controller port 80 30 | - 443:443 # Ingress controller port 443 31 | - 8080:8080 # port forward TODO be smarter (set up ingress to argo through ^^443^^) 32 | networks: 33 | - argo-net 34 | 35 | agent: 36 | image: "rancher/k3s:${K3S_VERSION:-latest}" 37 | tmpfs: 38 | - /run 39 | - /var/run 40 | ulimits: 41 | nproc: 65535 42 | nofile: 43 | soft: 65535 44 | hard: 65535 45 | privileged: true 46 | restart: always 47 | environment: 48 | - K3S_URL=https://server:6443 49 | - K3S_TOKEN=${K3S_TOKEN:?err} 50 | volumes: 51 | - k3s-agent:/var/lib/rancher/k3s 52 | networks: 53 | - argo-net 54 | 55 | volumes: 56 | k3s-server: {} 57 | k3s-agent: {} 58 | 59 | networks: 60 | argo-net: 61 | ipam: 62 | config: 63 | - ip_range: "192.168.90.0/24" 64 | subnet: "192.168.90.0/24" 65 | gateway: "192.168.90.1" 66 | -------------------------------------------------------------------------------- /tasks/argocd/local_argo/playbook/inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | local: 3 | hosts: 4 | k3s: 5 | ansible_host: localhost 6 | kubconfig_path: roles/argocd/files/generated/kubeconfig.yaml 7 | k8s_ca_cert: roles/argocd/files/generated/k3s_server_ca.crt 8 | ansible_connection: local 9 | k8s_ns: argocd 10 | -------------------------------------------------------------------------------- /tasks/argocd/local_argo/playbook/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Main playbook 3 | hosts: all 4 | gather_facts: false 5 | roles: 6 | - role: argocd 7 | -------------------------------------------------------------------------------- /tasks/argocd/local_argo/playbook/roles/argocd/files/test_deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: nginx-cm 6 | name: nginx-cm 7 | data: 8 | index.html: "hello world" 9 | --- 10 | apiVersion: apps/v1 11 | kind: Deployment 12 | metadata: 13 | name: nginx 14 | labels: 15 | app: nginx 16 | spec: 17 | replicas: 1 18 | selector: 19 | matchLabels: 20 | app: nginx 21 | template: 22 | metadata: 23 | labels: 24 | app: nginx 25 | spec: 26 | volumes: 27 | - name: nginx-static-volume 28 | configMap: 29 | name: nginx-cm 30 | items: 31 | - key: "index.html" 32 | path: "index.html" 33 | containers: 34 | - name: nginx 35 | image: library/nginx:latest 36 | startupProbe: 37 | httpGet: 38 | path: / 39 | port: 80 40 | initialDelaySeconds: 15 # force a slow-ish startup, useful for testing timeouts 41 | periodSeconds: 5 42 | ports: 43 | - containerPort: 80 44 | volumeMounts: 45 | - name: nginx-static-volume 46 | mountPath: "/usr/share/nginx/html" 47 | readOnly: true 48 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/ArgoCdConstants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.*; 24 | 25 | public class ArgoCdConstants { 26 | 27 | static final List FINALIZERS = Collections.singletonList("resources-finalizer.argocd.argoproj.io"); 28 | 29 | static final String CREATE_NAMESPACE_OPTION = "CreateNamespace=true"; 30 | 31 | static final Map SYNC_POLICY = Map.of("automated", Map.of( 32 | "prune", true, 33 | "selfHeal", true 34 | )); 35 | 36 | static final String ARGOCD_NAMESPACE = "argocd"; 37 | 38 | static final List DEFAULT_SOURCE_REPOS = Collections.singletonList("*"); 39 | 40 | static final List> DEFAULT_DESTINATIONS; 41 | 42 | static { 43 | Map m = new HashMap<>(); 44 | m.put("name", "*"); 45 | m.put("server", "*"); 46 | m.put("namespace", "*"); 47 | DEFAULT_DESTINATIONS = Collections.singletonList(m); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/AzureAuthCache.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2023 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.microsoft.aad.msal4j.IAccount; 24 | import com.microsoft.aad.msal4j.PublicClientApplication; 25 | 26 | import java.util.HashSet; 27 | import java.util.Set; 28 | 29 | public class AzureAuthCache { 30 | 31 | private final Set accountsInCache; 32 | private PublicClientApplication pca; 33 | 34 | private static final AzureAuthCache azureAuthCache = new AzureAuthCache(); 35 | 36 | 37 | public static AzureAuthCache getInstance() { 38 | return azureAuthCache; 39 | } 40 | 41 | private AzureAuthCache() { 42 | accountsInCache = new HashSet<>(); 43 | pca = null; 44 | } 45 | 46 | public void putIAccounts(Set accounts) { 47 | accountsInCache.addAll(accounts); 48 | } 49 | 50 | public Set getIAccounts() { 51 | return accountsInCache; 52 | } 53 | 54 | public void setPca(PublicClientApplication pca) { 55 | this.pca = pca; 56 | } 57 | 58 | public PublicClientApplication getPca() { 59 | return this.pca; 60 | } 61 | 62 | public void clear() { 63 | accountsInCache.clear(); 64 | pca = null; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/TokenAuthHandler.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class TokenAuthHandler { 24 | 25 | public static String auth(TaskParams.TokenAuth auth) { 26 | return auth.token(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/WaitWatchParams.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import org.immutables.value.Value; 24 | 25 | @Value.Immutable 26 | @Value.Style(jdkOnly = true) 27 | public interface WaitWatchParams { 28 | 29 | @Value.Default 30 | default boolean watchSync() { 31 | return true; 32 | } 33 | 34 | @Value.Default 35 | default boolean watchSuspended() { 36 | return false; 37 | } 38 | 39 | @Value.Default 40 | default boolean watchHealth() { 41 | return false; 42 | } 43 | 44 | @Value.Default 45 | default boolean watchOperation() { 46 | return false; 47 | } 48 | 49 | static ImmutableWaitWatchParams.Builder builder() { 50 | return ImmutableWaitWatchParams.builder(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/model/EventStatus.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2023 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public enum EventStatus { 24 | START, 25 | COMPLETE, 26 | FAIL 27 | } -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/model/HealthStatus.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public enum HealthStatus { 24 | 25 | // Indicates that health assessment failed and actual health status is unknown 26 | UNKNOWN("Unknown"), 27 | // Progressing health status means that resource is not healthy but still have a chance to reach healthy state 28 | PROGRESSING("Progressing"), 29 | // Resource is 100% healthy 30 | HEALTHY("Healthy"), 31 | // Assigned to resources that are suspended or paused. The typical example is a 32 | // [suspended](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#suspend) CronJob. 33 | SUSPENDED("Suspended"), 34 | // Degrade status is used if resource status indicates failure or resource could not reach healthy state 35 | // within some timeout. 36 | DEGRADED("Degraded"), 37 | // Indicates that resource is missing in the cluster. 38 | MISSING("Missing"); 39 | 40 | private final String value; 41 | 42 | HealthStatus(String value) { 43 | this.value = value; 44 | } 45 | 46 | public String value() { 47 | return value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/model/HttpExecutor.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2025 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.argocd.openapi.ApiException; 24 | 25 | import java.io.IOException; 26 | import java.io.InputStream; 27 | import java.net.http.HttpRequest; 28 | 29 | public interface HttpExecutor { 30 | InputStream execute(HttpRequest request) throws ApiException, IOException, InterruptedException; 31 | } 32 | -------------------------------------------------------------------------------- /tasks/argocd/src/main/java/com/walmartlabs/concord/plugins/argocd/model/SyncStatus.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.argocd.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public enum SyncStatus { 24 | 25 | // SyncStatusCodeUnknown indicates that the status of a sync could not be reliably determined 26 | UNKNOWN("Unknown"), 27 | // SyncStatusCodeOutOfSync indicates that desired and live states match 28 | SYNCED("Synced"), 29 | // SyncStatusCodeOutOfSync indicates that there is a drift beween desired and live states 30 | OUT_OF_SYNC("OutOfSync"); 31 | 32 | private final String value; 33 | 34 | SyncStatus(String value) { 35 | this.value = value; 36 | } 37 | 38 | public String value() { 39 | return value; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tasks/argocd/src/test/filtered-resources/version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} -------------------------------------------------------------------------------- /tasks/argocd/src/test/resources/com/walmartlabs/concord/plugins/argocd/emptyResponse.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/concord-plugins/739608a0dea7f7317a8ae494c05c09c5eb479b39/tasks/argocd/src/test/resources/com/walmartlabs/concord/plugins/argocd/emptyResponse.json -------------------------------------------------------------------------------- /tasks/argocd/src/test/resources/com/walmartlabs/concord/plugins/argocd/it/runtimeV2/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | runtime: "concord-v2" 3 | dependencies: 4 | - "mvn://com.walmartlabs.concord.plugins:argocd-task:%%version%%" 5 | 6 | flows: 7 | default: 8 | - log: "Hello world" 9 | - task: argocd 10 | in: 11 | action: get 12 | baseUrl: "${argoBaseUrl}" 13 | app: "test" 14 | auth: 15 | ldap: 16 | username: user 17 | password: password 18 | out: result 19 | - log: "${resource.prettyPrintJson(result)}" 20 | - log: "got app status: ${result.app.status.health.status}" 21 | -------------------------------------------------------------------------------- /tasks/argocd/src/test/resources/example-flow/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | #read -p "Username: " CURL_USER 11 | #curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | 13 | curl -u myuser:q1 -F org=Default -F project=brig -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process -------------------------------------------------------------------------------- /tasks/argocd/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/aws/examples/ecr/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | runtime: concord-v2 3 | dependencies: 4 | - mvn://com.walmartlabs.concord.plugins:aws-tasks:2.3.1 5 | 6 | flows: 7 | default: 8 | - task: awsEcr 9 | in: 10 | action: describe-images 11 | region: us-east-1 12 | repositoryName: foo 13 | maxResults: 1 14 | out: result 15 | - log: "Image Details: ${resource.prettyPrintJson(result.imageDetails)}" 16 | -------------------------------------------------------------------------------- /tasks/aws/src/test/java/com/walmartlabs/concord/plugins/aws/EcrTaskTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.aws; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.databind.ObjectMapper; 24 | import com.walmartlabs.concord.runtime.v2.sdk.MapBackedVariables; 25 | import com.walmartlabs.concord.runtime.v2.sdk.TaskResult; 26 | import org.junit.jupiter.api.Disabled; 27 | import org.junit.jupiter.api.Test; 28 | 29 | import java.util.Map; 30 | 31 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; 32 | import static org.junit.jupiter.api.Assertions.assertNotNull; 33 | 34 | @Disabled("requires AWS credentials") 35 | public class EcrTaskTest { 36 | 37 | @Test 38 | public void testDescribeImages() { 39 | var task = new EcrTask(new MockContext(), new ObjectMapper()); 40 | var input = new MapBackedVariables(Map.of( 41 | "action", "describe-images", 42 | "region", "us-east-1", 43 | "repositoryName", "foo" 44 | )); 45 | var result = task.execute(input); 46 | assertInstanceOf(TaskResult.SimpleResult.class, result); 47 | assertNotNull(((TaskResult.SimpleResult) result).toMap().get("data")); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tasks/aws/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tasks/confluence/examples/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh http://concordhost:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/confluence/examples/content.mustache: -------------------------------------------------------------------------------- 1 | 2 |

Hello, {{initiator.displayName}}

3 |

Hello, {{templateParams.myVariable1}}

4 |

Hello, {{templateParams.myVariable2}}

5 |

Hello, {{templateParams.myVariable3}}

6 |

This is my first paragraph

7 |

This is my second paragraph

8 | To add or remove subscribers create a pull request against the file 9 | -------------------------------------------------------------------------------- /tasks/confluence/examples/path/toMy/myFile.ini: -------------------------------------------------------------------------------- 1 | This is my confluence page attachment. -------------------------------------------------------------------------------- /tasks/confluence/examples/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml test.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/confluence/src/main/java/com/walmartlabs/concord/plugins/confluence/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.confluence; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class Constants { 24 | 25 | public static final long CONNECTION_TIMEOUT = 30L; 26 | public static final long READ_TIMEOUT = 30L; 27 | public static final long WRITE_TIMEOUT = 30L; 28 | 29 | public static final String CONFLUENCE_ENTITY_TITLE = "title"; 30 | public static final String CONFLUENCE_ENTITY_SPACEKEY = "spaceKey"; 31 | public static final String CONFLUENCE_ENTITY_TYPE_PAGE = "page"; 32 | public static final String CONFLUENCE_ENTITY_TYPE_FILE = "file"; 33 | public static final String CONFLUENCE_ENTITY_TYPE_COMMENT = "comment"; 34 | public static final String CONFLUENCE_ENTITY_REPRESENTATION = "storage"; 35 | public static final String CONFLUENCE_ENTITY_TOKEN_KEY = "X-Atlassian-Token"; 36 | public static final String CONFLUENCE_ENTITY_TOKEN_VALUE = "no-check"; 37 | public static final String CLIENT_MEDIATYPE_JSON = "application/json; charset=utf-8"; 38 | public static final String CLIENT_HEADER_AUTH = "Authorization"; 39 | public static final String CLIENT_HEADER_ACCEPT = "Accept"; 40 | 41 | private Constants() { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tasks/confluence/src/main/java/com/walmartlabs/concord/plugins/confluence/Result.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.confluence; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.io.Serializable; 24 | 25 | public class Result implements Serializable { 26 | 27 | public static Result ok(Long pageId, Long childId, String data) { 28 | return new Result(true, pageId, childId, data, null); 29 | } 30 | 31 | public static Result error(String error) { 32 | return new Result(false, null, null, null, error); 33 | } 34 | 35 | public final boolean ok; 36 | public final Long pageId; 37 | public final Long childId; 38 | public final String data; 39 | public final String error; 40 | 41 | public Result(boolean ok, Long pageId, Long childId, String data, String error) { 42 | this.ok = ok; 43 | this.pageId = pageId; 44 | this.childId = childId; 45 | this.data = data; 46 | this.error = error; 47 | } 48 | 49 | public boolean isOk() { 50 | return ok; 51 | } 52 | 53 | public Long getpageId() { 54 | return pageId; 55 | } 56 | 57 | public Long getChildId() { 58 | return childId; 59 | } 60 | 61 | public String getData() { 62 | return data; 63 | } 64 | 65 | public String getError() { 66 | return error; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/GitClient.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.sdk.Secret; 24 | 25 | import java.nio.file.Path; 26 | 27 | public interface GitClient { 28 | 29 | void cloneRepo(String uri, String branchName, Secret secret, Path dst) throws Exception; 30 | } 31 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/GitClientFactory.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.sdk.MapUtils; 24 | 25 | import java.util.Map; 26 | 27 | public final class GitClientFactory { 28 | 29 | public static GitClient create(Map in) { 30 | boolean useJGit = MapUtils.getBoolean(in, "useJGit", true); 31 | if (useJGit) { 32 | return new JGitClient(); 33 | } 34 | 35 | return new GitCliClient(isShallowClone(in)); 36 | } 37 | 38 | private static boolean isShallowClone(Map in) { 39 | return MapUtils.getBoolean(in, "shallow", false); 40 | } 41 | 42 | private GitClientFactory() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/GitSecretService.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.nio.file.Path; 24 | 25 | public interface GitSecretService { 26 | 27 | Path exportPrivateKeyAsFile(String orgName, String secretName, String pwd) throws Exception; 28 | } 29 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/TokenSecret.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.sdk.Secret; 24 | 25 | public class TokenSecret implements Secret { 26 | 27 | private final String token; 28 | 29 | public TokenSecret(String token) { 30 | this.token = token; 31 | } 32 | 33 | public String getToken() { 34 | return token; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/v1/GitHubTaskV1.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git.v1; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.git.GitHubTask; 24 | import com.walmartlabs.concord.sdk.Context; 25 | import com.walmartlabs.concord.sdk.InjectVariable; 26 | import com.walmartlabs.concord.sdk.Task; 27 | 28 | import javax.inject.Inject; 29 | import javax.inject.Named; 30 | import java.util.Map; 31 | 32 | @Named("github") 33 | public class GitHubTaskV1 implements Task { 34 | 35 | private final GitHubTask delegate; 36 | 37 | @InjectVariable("githubParams") 38 | private Map defaults; 39 | 40 | @Inject 41 | public GitHubTaskV1() { 42 | this.delegate = new GitHubTask(); 43 | } 44 | 45 | @Override 46 | public void execute(Context ctx) { 47 | Map result = delegate.execute(ctx.toMap(), defaults); 48 | result.forEach(ctx::setVariable); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tasks/git/src/main/java/com/walmartlabs/concord/plugins/git/v2/GithubTaskV2.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git.v2; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.git.GitHubTask; 24 | import com.walmartlabs.concord.runtime.v2.sdk.*; 25 | 26 | import javax.inject.Inject; 27 | import javax.inject.Named; 28 | import java.util.Map; 29 | 30 | @Named("github") 31 | @SuppressWarnings("unused") 32 | @DryRunReady 33 | public class GithubTaskV2 implements Task { 34 | 35 | private final GitHubTask delegate; 36 | 37 | private final Map defaults; 38 | 39 | @Inject 40 | public GithubTaskV2(Context ctx) { 41 | this.defaults = ctx.defaultVariables().toMap(); 42 | this.delegate = new GitHubTask(ctx.processConfiguration().dryRun()); 43 | } 44 | 45 | @Override 46 | public TaskResult execute(Variables input) { 47 | Map result = delegate.execute(input.toMap(), defaults); 48 | return TaskResult.success().values(result); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tasks/git/src/test/java/com/walmartlabs/concord/plugins/git/GitHubCommonTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.git; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import org.eclipse.egit.github.core.client.GitHubClient; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.junit.jupiter.api.Assertions.assertNotNull; 27 | 28 | class GitHubCommonTest { 29 | 30 | @Test 31 | void testCreateClient() { 32 | GitHubClient client = GitHubTask.createClient("https://mock.github.local"); 33 | 34 | assertNotNull(client); 35 | } 36 | 37 | @Test 38 | void testCreateClientWithPort() { 39 | GitHubClient client = GitHubTask.createClient("https://mock.github.local:8080"); 40 | 41 | assertNotNull(client); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/commit/__files/create_status.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", 3 | "avatar_url": "https://github.com/images/error/hubot_happy.gif", 4 | "id": 1, 5 | "node_id": "MDY6U3RhdHVzMQ==", 6 | "state": "success", 7 | "description": "Build has completed successfully", 8 | "target_url": "https://ci.example.com/1000/output", 9 | "context": "continuous-integration/jenkins", 10 | "created_at": "2012-07-20T01:19:13Z", 11 | "updated_at": "2012-07-20T01:19:13Z", 12 | "creator": { 13 | "login": "octocat", 14 | "id": 1, 15 | "node_id": "MDQ6VXNlcjE=", 16 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 17 | "gravatar_id": "", 18 | "url": "https://api.github.com/users/octocat", 19 | "html_url": "https://github.com/octocat", 20 | "followers_url": "https://api.github.com/users/octocat/followers", 21 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 22 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 23 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 24 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 25 | "organizations_url": "https://api.github.com/users/octocat/orgs", 26 | "repos_url": "https://api.github.com/users/octocat/repos", 27 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 28 | "received_events_url": "https://api.github.com/users/octocat/received_events", 29 | "type": "User", 30 | "site_admin": false 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/commit/__files/list_statuses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://api.github.com/repos/octocat/mock-repo/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", 4 | "avatar_url": "https://github.com/images/error/hubot_happy.gif", 5 | "id": 1, 6 | "node_id": "MDY6U3RhdHVzMQ==", 7 | "state": "success", 8 | "description": "Build has completed successfully", 9 | "target_url": "https://ci.example.com/1000/output", 10 | "context": "continuous-integration/jenkins", 11 | "created_at": "2012-07-20T01:19:13Z", 12 | "updated_at": "2012-07-20T01:19:13Z", 13 | "creator": { 14 | "login": "octocat", 15 | "id": 1, 16 | "node_id": "MDQ6VXNlcjE=", 17 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 18 | "gravatar_id": "", 19 | "url": "https://api.github.com/users/octocat", 20 | "html_url": "https://github.com/octocat", 21 | "followers_url": "https://api.github.com/users/octocat/followers", 22 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", 23 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 24 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 25 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 26 | "organizations_url": "https://api.github.com/users/octocat/orgs", 27 | "repos_url": "https://api.github.com/users/octocat/repos", 28 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", 29 | "received_events_url": "https://api.github.com/users/octocat/received_events", 30 | "type": "User", 31 | "site_admin": false 32 | } 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/pullRequest/__files/get_files.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sha": "bbcd538c8e72b8c175046e27cc8f907076331401", 4 | "filename": "file1.txt", 5 | "status": "added", 6 | "additions": 103, 7 | "deletions": 21, 8 | "changes": 124, 9 | "blob_url": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", 10 | "raw_url": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", 11 | "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e", 12 | "patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/pullRequest/__files/merge_pr.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 3 | "merged": true, 4 | "message": "Pull Request successfully merged" 5 | } 6 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "file", 3 | "encoding": "base64", 4 | "size": 17, 5 | "name": "README.md", 6 | "path": "README.md", 7 | "content": "IyBtb2NrLXJlcG8=\n", 8 | "sha": "3d21ec53a331a6f037a91c368710b99387d012c1", 9 | "url": "https://api.github.com/repos/octokit/mock-repo/contents/README.md", 10 | "git_url": "https://api.github.com/repos/octokit/mock-repo/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", 11 | "html_url": "https://github.com/octokit/mock-repo/blob/master/README.md", 12 | "download_url": "https://raw.githubusercontent.com/octokit/mock-repo/master/README.md", 13 | "_links": { 14 | "git": "https://api.github.com/repos/octokit/mock-repo/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", 15 | "self": "https://api.github.com/repos/octokit/mock-repo/contents/README.md", 16 | "html": "https://github.com/octokit/mock-repo/blob/master/README.md" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/create_hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "Repository", 3 | "id": 12345678, 4 | "name": "web", 5 | "active": true, 6 | "events": [ 7 | "push", 8 | "pull_request" 9 | ], 10 | "config": { 11 | "content_type": "json", 12 | "insecure_ssl": "0", 13 | "url": "https://example.com/webhook" 14 | }, 15 | "updated_at": "2019-06-03T00:57:16Z", 16 | "created_at": "2019-06-03T00:57:16Z", 17 | "url": "https://api.github.com/repos/octocat/mock-repo/hooks/12345678", 18 | "test_url": "https://api.github.com/repos/octocat/mock-repo/hooks/12345678/test", 19 | "ping_url": "https://api.github.com/repos/octocat/mock-repo/hooks/12345678/pings", 20 | "deliveries_url": "https://api.github.com/repos/octocat/mock-repo/hooks/12345678/deliveries", 21 | "last_response": { 22 | "code": null, 23 | "status": "unused", 24 | "message": null 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/create_ref.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/featureA", 3 | "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlQQ==", 4 | "url": "https://api.github.com/repos/octocat/mock-repo/git/refs/heads/featureA", 5 | "object": { 6 | "type": "commit", 7 | "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", 8 | "url": "https://api.github.com/repos/octocat/mock-repo/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/create_tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "node_id": "MDM6VGFnOTQwYmQzMzYyNDhlZmFlMGY5ZWU1YmM3YjJkNWM5ODU4ODdiMTZhYw==", 3 | "tag": "v0.0.1", 4 | "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac", 5 | "url": "https://api.github.com/repos/octocat/mock-repo/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac", 6 | "message": "initial version", 7 | "tagger": { 8 | "name": "Monalisa Octocat", 9 | "email": "octocat@github.com", 10 | "date": "2014-11-07T22:01:45Z" 11 | }, 12 | "object": { 13 | "type": "commit", 14 | "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", 15 | "url": "https://api.github.com/repos/octocat/mock-repo/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c" 16 | }, 17 | "verification": { 18 | "verified": false, 19 | "reason": "unsigned", 20 | "signature": null, 21 | "payload": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/list_branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "main", 4 | "commit": { 5 | "sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc", 6 | "url": "https://api.github.com/repos/octocat/mock-repo/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 7 | }, 8 | "protected": true, 9 | "protection": { 10 | "required_status_checks": { 11 | "enforcement_level": "non_admins", 12 | "contexts": [ 13 | "ci-test", 14 | "linter" 15 | ] 16 | } 17 | }, 18 | "protection_url": "https://api.github.com/repos/octocat/mock-repo/branches/main/protection" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/__files/list_tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "v0.1", 4 | "commit": { 5 | "sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc", 6 | "url": "https://api.github.com/repos/octocat/mock-repo/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 7 | }, 8 | "zipball_url": "https://github.com/octocat/mock-repo/zipball/v0.1", 9 | "tarball_url": "https://github.com/octocat/mock-repo/tarball/v0.1", 10 | "node_id": "MDQ6VXNlcjE=" 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /tasks/git/src/test/resources/wiremock/repo/mappings/get_error.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "4bcaaca9-73fa-443d-a8ef-ebbe5b4e63fb", 3 | "name": "github_task_test_repo_get_error", 4 | "request": { 5 | "url": "/api/v3/repos/octocat/error-repo", 6 | "method": "GET", 7 | "headers": { 8 | "Accept": { 9 | "equalTo": "application/vnd.github.v3.full+json" 10 | } 11 | } 12 | }, 13 | "response": { 14 | "status": 999, 15 | "body": "very unexpected error", 16 | "headers": { 17 | "Date": "Thu, 03 Oct 2019 21:18:41 GMT", 18 | "Content-Type": "application/json; charset=utf-8", 19 | "Server": "GitHub.com", 20 | "Status": "999 fake error", 21 | "X-RateLimit-Limit": "5000", 22 | "X-RateLimit-Remaining": "4907", 23 | "X-RateLimit-Reset": "1570140015" 24 | } 25 | }, 26 | "uuid": "97713e4c-d41c-41df-92b5-85263f798b17", 27 | "persistent": true, 28 | "insertionIndex": 4 29 | } 30 | -------------------------------------------------------------------------------- /tasks/gremlin/examples/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - create a Concord project. Enable "Allow payload archives" (not necessary for production usage); 4 | - update the credentials in `concord.yml`; 5 | - start the process by running: 6 | ``` 7 | $ ./run.sh http://concordhost:8001 orgName projectName 8 | ``` 9 | -------------------------------------------------------------------------------- /tasks/gremlin/examples/concord.yml: -------------------------------------------------------------------------------- 1 | flows: 2 | default: 3 | - task: gremlin 4 | in: 5 | action: cpu #Consumes CPU resources 6 | apiKey: myApiKey #Gremlin Api Key 7 | cores: 1 #The number of CPU cores to hog 8 | length: 15 #The length of the attack (seconds) 9 | targetType: Exact 10 | targetList: ["client1", "client2"] 11 | - log: "Gremling Attack Guid: ${attackGuid}" #The output (gremlin attack guid) is stored ${attackGuid} 12 | - call: sendSlackComm #Send Gremlin Report Url to Slack channel. 13 | in: 14 | attackType: "CPU" 15 | 16 | sendSlackComm: 17 | - task: slack 18 | in: 19 | channelId: ${channelName} 20 | text: "*Gremlin Attack Report - ${attackType}*" 21 | iconEmoji: ":gremlin:" 22 | attachments: 23 | - fallback: "Gremlin Attack Report Url ${gremlinAppUrl}/${attackGuid}" The output is stored in a result 24 | actions: 25 | - type: "button" 26 | text: "Click Here To Access Report" 27 | url: "${gremlinAppUrl}/${attackGuid}" 28 | 29 | configuration: 30 | dependencies: 31 | - "mvn://com.walmartlabs.concord.plugins:gremlin-task:1.32.0" 32 | arguments: 33 | channelName: "myChannel" 34 | gremlinAppUrl: "https://app.gremlin.com/attacks" 35 | -------------------------------------------------------------------------------- /tasks/gremlin/examples/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/AttackResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2021 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class AttackResult { 24 | 25 | private final String id; 26 | 27 | public AttackResult(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String id() { 32 | return id; 33 | } 34 | 35 | public String details(TaskParams.AttackParams in) { 36 | try { 37 | var map = new GremlinClient(in) 38 | .url("attacks/" + id) 39 | .successCode(200) 40 | .get(); 41 | 42 | return Utils.objectMapper().writeValueAsString(map); 43 | } catch (Exception e) { 44 | throw new RuntimeException("Error occurred while getting attack details", e); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.Arrays; 24 | import java.util.List; 25 | 26 | public class Constants { 27 | 28 | public static final List GREMLIN_VALID_PROTOCOLS = Arrays.asList("TCP", "UDP", "ICMP"); 29 | public static final String GREMLIN_DEFAULT_TARGET_TYPE = "Exact"; 30 | public static final List GREMLIN_VALID_UNIT_OPTION = Arrays.asList("GB", "MB", "PERCENT"); 31 | 32 | private Constants() { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/GremlinClientParams.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public interface GremlinClientParams { 24 | 25 | String apiUrl(); 26 | String apiKey(); 27 | String teamId(); 28 | boolean debug(); 29 | 30 | long connectTimeout(); 31 | long readTimeout(); 32 | long writeTimeout(); 33 | 34 | boolean useProxy(); 35 | 36 | String proxyHost(); 37 | int proxyPort(); 38 | } 39 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/K8SAttackResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2021 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class K8SAttackResult extends AttackResult { 24 | 25 | public K8SAttackResult(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public String details(TaskParams.AttackParams in) { 31 | try { 32 | var map = new GremlinClient(in) 33 | .url("kubernetes/attacks/" + id()) 34 | .successCode(200) 35 | .get(); 36 | 37 | return Utils.objectMapper().writeValueAsString(map); 38 | } catch (Exception e) { 39 | throw new RuntimeException("Error occurred while getting attack details", e); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/Version.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.util.Properties; 26 | 27 | 28 | public final class Version { 29 | private static final String VERSION; 30 | 31 | static { 32 | Properties props = new Properties(); 33 | try { 34 | InputStream in = Version.class.getClassLoader().getResourceAsStream("version.properties"); 35 | props.load(in); 36 | } catch (IOException e) { 37 | throw new RuntimeException(e); 38 | } 39 | VERSION = props.getProperty("version"); 40 | } 41 | 42 | public static String getVersion() { 43 | return VERSION; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/java/com/walmartlabs/concord/plugins/gremlin/v2/GremlinTaskV2.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.gremlin.v2; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.gremlin.GremlinTaskCommon; 24 | import com.walmartlabs.concord.plugins.gremlin.TaskParams; 25 | import com.walmartlabs.concord.runtime.v2.sdk.Context; 26 | import com.walmartlabs.concord.runtime.v2.sdk.Task; 27 | import com.walmartlabs.concord.runtime.v2.sdk.TaskResult; 28 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 29 | 30 | import javax.inject.Inject; 31 | import javax.inject.Named; 32 | import java.util.Map; 33 | 34 | @Named("gremlin") 35 | public class GremlinTaskV2 implements Task { 36 | 37 | private final Context context; 38 | private final GremlinTaskCommon delegate = new GremlinTaskCommon(); 39 | 40 | @Inject 41 | public GremlinTaskV2(Context context) { 42 | this.context = context; 43 | } 44 | 45 | @Override 46 | public TaskResult execute(Variables input) { 47 | Map result = delegate.execute(TaskParams.of(input, context.defaultVariables().toMap())); 48 | return TaskResult.success() 49 | .values(result); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tasks/gremlin/src/main/resources/version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} 2 | -------------------------------------------------------------------------------- /tasks/hashivault/src/main/java/com/walmartlabs/concord/plugins/hashivault/HashiVaultTaskException.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.hashivault; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2021 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class HashiVaultTaskException extends RuntimeException { 24 | public HashiVaultTaskException(String msg) { 25 | super(msg); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC/jCCAeYCCQCv9U0hsjboWjANBgkqhkiG9w0BAQsFADBAMQswCQYDVQQGEwJV 3 | UzELMAkGA1UECAwCQVIxEDAOBgNVBAoMB1dhbG1hcnQxEjAQBgNVBAMMCWxvY2Fs 4 | aG9zdDAgFw0yMjAxMDUyMDAyMzVaGA8yMjk1MTAyMDIwMDIzNVowQDELMAkGA1UE 5 | BhMCVVMxCzAJBgNVBAgMAkFSMRAwDgYDVQQKDAdXYWxtYXJ0MRIwEAYDVQQDDAls 6 | b2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2gLwyfjnk 7 | BxfYZQ8Q9xwIM1yQGfKZLpWqjG4R7kHx508e7ba4zRGUVYc36R5Ya2BP9Si262BT 8 | LnWCULzKHDoCIyyIBr9dZCDA+mIrkMbl4xSWM2nrucQd1+14TBjOIzsD9IZyIr5x 9 | b7yR/pJ6e2iavzBQGkWxKok7gYKHVug5nOA74XIwse9lm+tglQKVSOBhuTiFagP2 10 | um42ZO3ipJ2stWI1SSybWJb3u0DEeznh1+/2ndhXGV5TWXnvIpdna1NwgbC3EfLJ 11 | 1LP29p4cpni6sK9Hy5a4s2JVGVvPlbfb87aUd5NhGW0H10Y0tiIHb2aAQxgRgA6G 12 | WOkz6ga6JrGzAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAJIu65uDlhnXzmvBnKIc 13 | 5QAHvuyr71aFGUh/UQDjgCvDjWr+v/Hwoi5UZSSLVg6D9sZzImAZA8qXX4ID+xyX 14 | sUm1f52ZNYxN6FlqxaylDWJ8wtagWcFTcSe1epa6Hp01c7VcKKq1a3IJx0nl8voJ 15 | 5L1mEIZ/Rywp9rFHqPeWWAEZPN5oYfs7viSQt9GCiVVufA9oaVKUFteECeBpB8Fm 16 | ScrjSWNQaQcsbB/q/eQbXBCRHo9qn2uF/amoPYqmOmuQF3F0y8WeDoBQwNEySXPv 17 | Okl+2kBU0mSV05PrZ5Lo25gEJW74T1bpL+HzzmbFlbpEDXrdf8eZxd8WQp0nWzwv 18 | +bc= 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/cert.ext: -------------------------------------------------------------------------------- 1 | authorityKeyIdentifier=keyid,issuer 2 | basicConstraints=CA:FALSE 3 | keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment 4 | subjectAltName = @alt_names 5 | 6 | [alt_names] 7 | IP.1 = 127.0.0.1 8 | DNS.1 = localhost 9 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | listen 443 ssl; 5 | server_name localhost; 6 | ssl_certificate /etc/nginx/certs/server.crt; 7 | ssl_certificate_key /etc/nginx/certs/server.key; 8 | 9 | location / { 10 | proxy_pass ${VAULT_ENDPOINT}; 11 | error_log /var/log/front_end_errors.log; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDmTCCAoGgAwIBAgIJAPBGGpUTv0d5MA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV 3 | BAYTAlVTMQswCQYDVQQIDAJBUjEQMA4GA1UECgwHV2FsbWFydDESMBAGA1UEAwwJ 4 | bG9jYWxob3N0MCAXDTIyMDEwNTIwMTgyNloYDzIyOTUxMDIwMjAxODI2WjBAMQsw 5 | CQYDVQQGEwJVUzELMAkGA1UECAwCQVIxEDAOBgNVBAoMB1dhbG1hcnQxEjAQBgNV 6 | BAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALBY 7 | iWOfVAUZi9XlkaToT6UqMiZcJ/ivMF5scKbFAR8ps5/l6tXkqXc71Bmj8MyU7HSt 8 | /LN34aO2t4nviC8GUIz8RVQDbx3DKGufH5Ztox1TIGuH04Sij6tAS2RcvTALAxeo 9 | CLrGsvc2QPPPXabAnJeBUlhcwWUiW3UFhPYmK3J6Lbr+jYmxyOLxkOnSfYIGapV0 10 | /c24kQU1a6TzvqKaLrrPT4mS+JQaalhTipu2mxuNxKmR0DQdCAA0aRGBrSZ9VYi+ 11 | X0ZdKWykpqCtD/AI6bBY4YTQcf0Dt50hD4WXT5Eo3cOlBITMyK+vbPDWnyiR4rZg 12 | Z1nnxIC+2BAsaPwwwC0CAwEAAaOBkzCBkDBaBgNVHSMEUzBRoUSkQjBAMQswCQYD 13 | VQQGEwJVUzELMAkGA1UECAwCQVIxEDAOBgNVBAoMB1dhbG1hcnQxEjAQBgNVBAMM 14 | CWxvY2FsaG9zdIIJAK/1TSGyNuhaMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgTwMBoG 15 | A1UdEQQTMBGHBH8AAAGCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAQEAX+2g 16 | RXEbp1213B15EH+VYt01XqHJuNphfHvuLW5t34Tsff3XOyqUa/GpaHAp/QwiB4ye 17 | TlpvW/kZ3D6K7vPSqbR0TsJFv0/4hX20cztuBOPxvJSM1n5wtbz+KGUYClO3fQZo 18 | /uIdAarycZ7LN8tDIdwaCXIRJ0t7eH8CdFM4gSHrPwFsX8qehnUZxmau39c3RwkB 19 | YIlwq3kts5qXQfzl1k92XVh+6mPH9M5GNVqqgU7uE5AUXavMZMXETNB8mkgpk7Ef 20 | 2hojnh1Poc7pkTQPxBwbKxDIgjgkQLRrQJb+ug3EJVnRKeqMq5Jiptp3w9+ypMFl 21 | dk+tPYq+CEEqxq0Mng== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAsFiJY59UBRmL1eWRpOhPpSoyJlwn+K8wXmxwpsUBHymzn+Xq 3 | 1eSpdzvUGaPwzJTsdK38s3fho7a3ie+ILwZQjPxFVANvHcMoa58flm2jHVMga4fT 4 | hKKPq0BLZFy9MAsDF6gIusay9zZA889dpsCcl4FSWFzBZSJbdQWE9iYrcnotuv6N 5 | ibHI4vGQ6dJ9ggZqlXT9zbiRBTVrpPO+opouus9PiZL4lBpqWFOKm7abG43EqZHQ 6 | NB0IADRpEYGtJn1ViL5fRl0pbKSmoK0P8AjpsFjhhNBx/QO3nSEPhZdPkSjdw6UE 7 | hMzIr69s8NafKJHitmBnWefEgL7YECxo/DDALQIDAQABAoIBADbM7LUGuEd1bt0j 8 | oCUNBGMhP8Bn9wvy9ScCr+dDZVvXy7gu7NFXY8pnzzvAlH4e8XQ49USYRohnqZW1 9 | 2C402idV5f17q7YmBZOcOWa3326nfHWuGe8nzVm8ezFPGIOriGR7lWrlgIwOUhTy 10 | JfpB9OeoCnznJjpVePJeqrkLl4jVJvMU0HDbCoCsEsUCbqLIkJzSkdeyOVxSrC9Z 11 | Hkwq5y/NoR0c/hH/JMpjOB5d8e4FvR+N3hLEW9lfGxw+MYq/6zKH5fO5APMDdkCq 12 | uyE7FHy/wa3Hyvo6GjhV3WdN2rAMAtHl3k9xhORC9EH8DvpCkFZJ6ED68T5LMCkv 13 | oQStqgECgYEA2hUh6t/ZZmu1YvgevpqmXUsXo0GQ1fhyNKXk5d15cZ0KLDEAIEtw 14 | 08KYnrM5fPJcK0EX14diDs0+l2nG1H/Ev6wgzp7toWqN+qmoMUZgf2Du6FsVf6f+ 15 | K8wTbIB4eRu+YltO9q2vQQLBvWFzASs05E2/QmOXRNhroCZixMOaJu0CgYEAzwGz 16 | dlIdBlTcjd1S3GCvegDXMtkiAreJqcKHn5xcZ2fFlD14rzfHPlMPFWtd0JrHuHb+ 17 | sJcuFNs8J4qZ90j0shaZfH8f1EhTCr2pltahbg7m3PY5pHLGFlt5A0QhZvBquPn2 18 | kei3J+uUQalhPe0Nnpb1lSaK/xn6MTI37YZ2lkECgYAC+ZLS32bZzNJWnUfeFcH7 19 | N9EEuxo8sPzt1u1+bT0A3cGLxMdZqW3Klbb7Qzqfh7bWKDcpC4G87fPSoPDDaVLH 20 | wpNX/jcDoq55IuNWeL1MP4hCxytN6H7BHjGNo1sBW+2G7fPvzYK8gkseSDwHYg2A 21 | p8baIv2nRMSDFML4KCrsKQKBgQCv6CcjlbWaasSdPQUrxnF3QH2edQtEucie3HK5 22 | fHq9WF56kR4b7089tAEuV3V6Tf0H0P6u+1kqWf6tL0eU7ocZSsEVHUXj8621g+Q4 23 | DJ1TVBB0ljv3dZzE5OhZkSy9N/HIzIjuBo6VusfaYGAE6otXR7rbCsy06NNFuQHz 24 | sv7UwQKBgCwSBiduP7hgyhqdfzAxLv44Yn/5W0nQkJqJLb2zUIk4WDlEMX/8Wtqe 25 | p52PSqgInKzOURDw1GOuA7qjGlP1BoOA71Cg7EH8eRIULva2I1LmuicjlSUvAuhh 26 | 53cH06mgyM0ZSCDe28odVbpMn7tlxRcKyUjup42YkxLkWls/Q4Qa 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /tasks/hashivault/src/test/resources/vault.conf: -------------------------------------------------------------------------------- 1 | listener "tcp" { 2 | address = "127.0.0.1:9201" 3 | tls_disable = 0 4 | tls_cert_file = "/vault/config/server.crt" 5 | tls_key_file = "/vault/config/server.key" 6 | } 7 | -------------------------------------------------------------------------------- /tasks/hashivault/testCLI.yml: -------------------------------------------------------------------------------- 1 | # testCLI.sh script will replace version with current pom.xml version 2 | configuration: 3 | dependencies: 4 | - mvn://com.walmartlabs.concord.plugins:hashivault-task:LOCAL_VERSION 5 | arguments: 6 | hashivaultParams: 7 | baseUrl: "${vaultBaseUrl}" 8 | debug: true 9 | runtime: concord-v2 10 | 11 | flows: 12 | default: 13 | - log: "Executing process with plugin: hashivault-task:LOCAL_VERSION" 14 | - task: hashivault 15 | in: 16 | baseUrl: "${vaultBaseUrl}" 17 | path: "${vaultPath}" 18 | namespace: "${vaultNs}" 19 | apiToken: "${vaultToken}" 20 | out: result 21 | error: 22 | - log: "Vault error: ${lastError.cause}" 23 | - log: ${resource.prettyPrintJson(result)} 24 | - log: "ok: ${result.ok}" 25 | - log: "data: ${resource.prettyPrintJson(result.data)}" 26 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public final class Constants { 24 | 25 | public static final String API_TOKEN_KEY = "apiToken"; 26 | public static final String BASE_URL_KEY = "baseUrl"; 27 | public static final String CONNECTION_TIMEOUT_KEY = "connectTimeout"; 28 | public static final String DEBUG_KEY = "debug"; 29 | public static final String JOB_NAME_KEY = "jobName"; 30 | public static final String JOB_TIMEOUT_KEY = "jobTimeout"; 31 | public static final String PARAMETERS_KEY = "parameters"; 32 | public static final String READ_TIMEOUT_KEY = "readTimeout"; 33 | public static final String SYNC_KEY = "sync"; 34 | public static final String USERNAME_KEY = "username"; 35 | public static final String WRITE_TIMEOUT_KEY = "writeTimeout"; 36 | 37 | public static final String[] ALL_IN_PARAMS = {API_TOKEN_KEY, BASE_URL_KEY, CONNECTION_TIMEOUT_KEY, DEBUG_KEY, 38 | READ_TIMEOUT_KEY, WRITE_TIMEOUT_KEY, JOB_NAME_KEY, JOB_TIMEOUT_KEY, PARAMETERS_KEY, SYNC_KEY, USERNAME_KEY}; 39 | 40 | private Constants() { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/Utils.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.runtime.v2.sdk.MapBackedVariables; 24 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 25 | 26 | import java.util.Collections; 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public final class Utils { 31 | 32 | public static String normalizeUrl(String url) { 33 | if (url.endsWith("/")) { 34 | return url.substring(0, url.length() - 1); 35 | } 36 | return url; 37 | } 38 | 39 | public static Variables merge(Variables variables, Map defaults) { 40 | Map variablesMap = new HashMap<>(defaults != null ? defaults : Collections.emptyMap()); 41 | variablesMap.putAll(variables.toMap()); 42 | return new MapBackedVariables(variablesMap); 43 | } 44 | 45 | private Utils() { 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/model/BuildInfo.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonCreator; 24 | import com.fasterxml.jackson.annotation.JsonProperty; 25 | 26 | public class BuildInfo { 27 | 28 | private final boolean building; 29 | 30 | private final String result; 31 | 32 | @JsonCreator 33 | public BuildInfo(@JsonProperty("building") boolean building, 34 | @JsonProperty("result") String result) { 35 | 36 | this.building = building; 37 | this.result = result; 38 | } 39 | 40 | public boolean isBuilding() { 41 | return building; 42 | } 43 | 44 | public String getResult() { 45 | return result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/model/Executable.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonCreator; 24 | import com.fasterxml.jackson.annotation.JsonProperty; 25 | 26 | public class Executable { 27 | 28 | private final long number; 29 | 30 | private final String url; 31 | 32 | @JsonCreator 33 | public Executable(@JsonProperty("number") long number, 34 | @JsonProperty("url") String url) { 35 | this.number = number; 36 | this.url = url; 37 | } 38 | 39 | public long getNumber() { 40 | return number; 41 | } 42 | 43 | public String getUrl() { 44 | return url; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/model/QueueItem.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonCreator; 24 | import com.fasterxml.jackson.annotation.JsonProperty; 25 | 26 | public class QueueItem { 27 | 28 | private final String why; 29 | 30 | private final boolean cancelled; 31 | 32 | private final Executable executable; 33 | 34 | @JsonCreator 35 | public QueueItem(@JsonProperty("why") String why, 36 | @JsonProperty("cancelled") boolean cancelled, 37 | @JsonProperty("executable") Executable executable) { 38 | this.why = why; 39 | this.cancelled = cancelled; 40 | this.executable = executable; 41 | } 42 | 43 | public String getWhy() { 44 | return why; 45 | } 46 | 47 | public boolean isCancelled() { 48 | return cancelled; 49 | } 50 | 51 | public Executable getExecutable() { 52 | return executable; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tasks/jenkins/src/main/java/com/walmartlabs/concord/plugins/jenkins/v2/JenkinsTaskV2.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jenkins.v2; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.jenkins.JenkinsConfiguration; 24 | import com.walmartlabs.concord.plugins.jenkins.JenkinsTaskCommon; 25 | import com.walmartlabs.concord.runtime.v2.sdk.Context; 26 | import com.walmartlabs.concord.runtime.v2.sdk.Task; 27 | import com.walmartlabs.concord.runtime.v2.sdk.TaskResult; 28 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 29 | 30 | import javax.inject.Inject; 31 | import javax.inject.Named; 32 | import java.util.Map; 33 | 34 | @Named("jenkins") 35 | public class JenkinsTaskV2 implements Task { 36 | 37 | private final Context context; 38 | private final JenkinsTaskCommon delegate = new JenkinsTaskCommon(); 39 | 40 | @Inject 41 | public JenkinsTaskV2(Context context) { 42 | this.context = context; 43 | } 44 | 45 | @Override 46 | public TaskResult execute(Variables input) throws Exception { 47 | Map result = delegate.execute(JenkinsConfiguration.of(input, context.defaultVariables().toMap())); 48 | return TaskResult.success() 49 | .values(result); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tasks/jenkins/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tasks/jira/src/main/java/com/walmartlabs/concord/plugins/jira/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jira; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.UUID; 24 | 25 | public class Constants { 26 | 27 | private Constants() { 28 | throw new IllegalStateException("instantiation is not allowed"); 29 | } 30 | 31 | static final String BOUNDARY = UUID.randomUUID().toString(); 32 | public static final String PARAMS_KEY = "jiraParams"; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tasks/jira/src/main/java/com/walmartlabs/concord/plugins/jira/JiraCredentials.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jira; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.Base64; 24 | 25 | public class JiraCredentials { 26 | 27 | private final String username; 28 | private final String password; 29 | 30 | public JiraCredentials(String username, String password) { 31 | this.username = username; 32 | this.password = password; 33 | } 34 | 35 | public String username() { 36 | return username; 37 | } 38 | 39 | public String password() { 40 | return password; 41 | } 42 | 43 | public String authHeaderValue() { 44 | return "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tasks/jira/src/main/java/com/walmartlabs/concord/plugins/jira/JiraSecretService.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jira; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public interface JiraSecretService { 24 | 25 | JiraCredentials exportCredentials(String orgName, String secretName, String password) throws Exception; 26 | } 27 | -------------------------------------------------------------------------------- /tasks/jira/src/test/java/com/walmartlabs/concord/plugins/jira/NativeJiraHttpClientTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jira; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2024 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | class NativeJiraHttpClientTest extends AbstractWiremockTest { 24 | 25 | @Override 26 | JiraHttpClient getClient(JiraClientCfg cfg) { 27 | return new NativeJiraHttpClient(cfg); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /tasks/jira/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tasks/jira/src/test/resources/sample.txt: -------------------------------------------------------------------------------- 1 | Sample file -------------------------------------------------------------------------------- /tasks/jsonpath/examples/todos/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh http://concordhost:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/jsonpath/examples/todos/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | runtime: concord-v2 3 | dependencies: 4 | - "mvn://com.walmartlabs.concord.plugins:jsonpath-task:1.32.0" 5 | 6 | flows: 7 | default: 8 | # inline 9 | - log: "Inline result: ${jsonPath.readJson(http.asString('https://jsonplaceholder.typicode.com/todos'), '$.[:10].title')}" 10 | 11 | # using the task syntax 12 | - task: jsonPath 13 | in: 14 | action: "readJson" 15 | src: "${http.asString('https://jsonplaceholder.typicode.com/todos')}" 16 | path: "$.[:10].title" 17 | out: result 18 | 19 | - log: "Task syntax result: ${result}" 20 | -------------------------------------------------------------------------------- /tasks/jsonpath/examples/todos/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/jsonpath/src/main/java/com/walmartlabs/concord/plugins/jsonpath/TaskParams.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jsonpath; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 24 | 25 | import java.util.Arrays; 26 | 27 | public class TaskParams { 28 | 29 | private static final String ACTION_KEY = "action"; 30 | private static final String PATH_KEY = "path"; 31 | private static final String SRC_KEY = "src"; 32 | 33 | protected final Variables variables; 34 | 35 | public TaskParams(Variables variables) { 36 | this.variables = variables; 37 | } 38 | 39 | public Action action() { 40 | String action = variables.assertString(ACTION_KEY); 41 | try { 42 | return Action.valueOf(action.trim().toUpperCase()); 43 | } catch (IllegalArgumentException e) { 44 | throw new RuntimeException("Unknown action: '" + action + "'. Available actions: " + Arrays.toString(Action.values())); 45 | } 46 | } 47 | 48 | public String jsonPath() { 49 | return variables.assertString(PATH_KEY); 50 | } 51 | 52 | public Object src() { 53 | return variables.get(SRC_KEY); 54 | } 55 | 56 | public enum Action { 57 | READ, 58 | READJSON, 59 | READFILE 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tasks/jsonpath/src/test/java/com/walmartlabs/concord/plugins/jsonpath/JsonPathTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.jsonpath; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | import java.util.Map; 26 | 27 | import static java.util.Collections.singletonMap; 28 | import static org.junit.jupiter.api.Assertions.assertEquals; 29 | import static org.junit.jupiter.api.Assertions.assertNull; 30 | 31 | public class JsonPathTest { 32 | 33 | @Test 34 | public void test() throws Exception { 35 | Map json = singletonMap("x", singletonMap("y", 123)); 36 | 37 | JsonPathTask t = new JsonPathTask(); 38 | assertEquals(123, t.read(json, "$.x.y")); 39 | assertNull(t.read(json, "$.x.z")); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tasks/jsonpath/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tasks/ldap/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | com.walmartlabs.concord.plugins 7 | concord-plugins-parent 8 | 2.8.1-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 12 | ldap-task 13 | jar 14 | 15 | 16 | 17 | com.walmartlabs.concord 18 | concord-sdk 19 | provided 20 | 21 | 22 | com.walmartlabs.concord.runtime.v2 23 | concord-runtime-sdk-v2 24 | provided 25 | 26 | 27 | com.walmartlabs.concord 28 | concord-common 29 | provided 30 | 31 | 32 | javax.inject 33 | javax.inject 34 | provided 35 | 36 | 37 | org.slf4j 38 | slf4j-api 39 | provided 40 | 41 | 42 | 43 | 44 | 45 | 46 | dev.ybrig.concord 47 | concord-maven-plugin 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tasks/ldap/src/main/java/com/walmartlabs/concord/plugins/ldap/LdapConnectionCfg.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.ldap; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.util.Map; 24 | 25 | public interface LdapConnectionCfg { 26 | 27 | String ldapAdServer(); 28 | 29 | String bindUserDn(); 30 | 31 | String bindPassword(); 32 | 33 | Map dnsSrvRr(); 34 | } 35 | -------------------------------------------------------------------------------- /tasks/ldap/src/main/java/com/walmartlabs/concord/plugins/ldap/LdapSearchParams.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.ldap; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public interface LdapSearchParams extends LdapConnectionCfg { 24 | 25 | String searchBase(); 26 | } 27 | -------------------------------------------------------------------------------- /tasks/msteams/.gitignore: -------------------------------------------------------------------------------- 1 | it_vars/ 2 | -------------------------------------------------------------------------------- /tasks/msteams/examples/minimal/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh concord.example.com:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/msteams/examples/minimal/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:msteams-task:1.32.0" 4 | 5 | flows: 6 | default: 7 | - task: msteams 8 | in: 9 | action: sendMessage 10 | teamId: "6d97d054-8882-48f8-be19-052934402f06" 11 | webhookId: "ec83079e7d2b480886b1138966c25d9c" 12 | title: "My Message title" 13 | text: "My Message text" 14 | ignoreErrors: true 15 | - log: "Result status: ${result.ok}" 16 | - if: "${!result.ok}" 17 | then: 18 | - throw: "Error occured while sending a message: ${result.error}" 19 | else: 20 | - log: "Data: ${result.data}" -------------------------------------------------------------------------------- /tasks/msteams/examples/minimal/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/msteams/examples/msteamsV2/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh concord.example.com:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/msteams/examples/msteamsV2/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:msteams-task:1.32.0" 4 | 5 | flows: 6 | default: 7 | - task: msteamsV2 8 | in: 9 | action: createConversation 10 | activity: 11 | type: message 12 | text: "My First Message" 13 | channelId: "myChannelId" 14 | ignoreErrors: true 15 | 16 | - log: "Result status: ${result.ok}" 17 | - if: "${!result.ok}" 18 | then: 19 | - throw: "Error occurred while sending a message: ${result.error}" 20 | else: 21 | - log: "Data: ${result.data}" 22 | - log: "Conversation Id: ${result.conversationId}" 23 | 24 | - task: msteamsV2 25 | in: 26 | action: replyToConversation 27 | conversationId: ${result.conversationId} 28 | activity: 29 | type: message 30 | text: "This replies to a previously posted conversation" -------------------------------------------------------------------------------- /tasks/msteams/examples/msteamsV2/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/msteams/examples/usingSectionsActions/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh concord.example.com:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/msteams/examples/usingSectionsActions/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class Constants { 24 | 25 | public static final int DEFAULT_CONNECT_TIMEOUT = 30_000; 26 | public static final int DEFAULT_SO_TIMEOUT = 30_000; 27 | public static final int DEFAULT_RETRY_COUNT = 5; 28 | 29 | public static final String DEFAULT_THEME_COLOR = "11B00A"; 30 | public static final String VAR_ACCESS_TOKEN = "access_token"; 31 | 32 | public static final String API_BOT_FRAMEWORK_SCOPE = "https://api.botframework.com/.default"; 33 | public static final String API_BOT_FRAMEWORK_GRANT_TYPE = "client_credentials"; 34 | 35 | public static final int TOO_MANY_REQUESTS_ERROR = 429; 36 | public static final int TEAMS_SUCCESS_STATUS_CODE = 200; 37 | public static final int TEAMS_SUCCESS_STATUS_CODE_V2 = 201; 38 | public static final int DEFAULT_RETRY_AFTER = 1; 39 | public static final int DEFAULT_PROXY_PORT = 8080; 40 | 41 | private Constants() { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/ContextVariables.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 24 | import com.walmartlabs.concord.sdk.Context; 25 | 26 | import java.util.Map; 27 | 28 | public class ContextVariables implements Variables { 29 | 30 | private final Context context; 31 | 32 | public ContextVariables(Context context) { 33 | this.context = context; 34 | } 35 | 36 | @Override 37 | public Object get(String key) { 38 | return context.getVariable(key); 39 | } 40 | 41 | @Override 42 | public void set(String key, Object value) { 43 | throw new IllegalStateException("Unsupported"); 44 | } 45 | 46 | @Override 47 | public boolean has(String key) { 48 | return context.getVariable(key) != null; 49 | } 50 | 51 | @Override 52 | public Map toMap() { 53 | return context.toMap(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/TeamsConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2018 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public interface TeamsConfiguration { 24 | 25 | String teamId(); 26 | String tenantId(); 27 | String webhookTypeId(); 28 | String webhookId(); 29 | String webhookUrl(); 30 | String rootWebhookUrl(); 31 | 32 | String proxyAddress(); 33 | int proxyPort(); 34 | int connectTimeout(); 35 | int soTimeout(); 36 | 37 | int retryCount(); 38 | } 39 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/TeamsTask.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2018 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.sdk.Context; 24 | import com.walmartlabs.concord.sdk.InjectVariable; 25 | import com.walmartlabs.concord.sdk.Task; 26 | 27 | import javax.inject.Inject; 28 | import javax.inject.Named; 29 | import java.util.HashMap; 30 | import java.util.Map; 31 | 32 | @Named("msteams") 33 | @SuppressWarnings("unused") 34 | public class TeamsTask implements Task { 35 | 36 | @InjectVariable("msteamsParams") 37 | private Map defaults; 38 | 39 | private final TeamsTaskCommon delegate; 40 | 41 | @Inject 42 | public TeamsTask(TeamsTaskCommon delegate) { 43 | this.delegate = delegate; 44 | } 45 | 46 | @Override 47 | public void execute(Context ctx) { 48 | Result r = delegate.execute(TeamsTaskParams.of(new ContextVariables(ctx), defaults)); 49 | 50 | Map result = new HashMap<>(); 51 | result.put("ok", r.isOk()); 52 | result.put("error", r.getError()); 53 | result.put("data", r.getData()); 54 | ctx.setVariable("result", result); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/TeamsV2Configuration.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2018 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public interface TeamsV2Configuration { 24 | 25 | String rootApi(); 26 | 27 | String tenantId(); 28 | String accessTokenApi(); 29 | String clientId(); 30 | String clientSecret(); 31 | 32 | String proxyAddress(); 33 | int proxyPort(); 34 | boolean useProxy(); 35 | 36 | int connectTimeout(); 37 | int soTimeout(); 38 | int retryCount(); 39 | } 40 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/Utils.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.databind.ObjectMapper; 24 | import com.walmartlabs.concord.runtime.v2.sdk.MapBackedVariables; 25 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 26 | 27 | import java.util.Collections; 28 | import java.util.HashMap; 29 | import java.util.Map; 30 | 31 | public final class Utils { 32 | 33 | private static final ObjectMapper MAPPER = new ObjectMapper(); 34 | 35 | public static Variables merge(Variables variables, Map defaults) { 36 | Map variablesMap = new HashMap<>(defaults != null ? defaults : Collections.emptyMap()); 37 | variablesMap.putAll(variables.toMap()); 38 | return new MapBackedVariables(variablesMap); 39 | } 40 | 41 | public static ObjectMapper mapper() { 42 | return MAPPER; 43 | } 44 | 45 | private Utils() { 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tasks/msteams/src/main/java/com/walmartlabs/concord/plugins/msteams/v2/TeamsTaskV2.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.msteams.v2; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.msteams.Result; 24 | import com.walmartlabs.concord.plugins.msteams.TeamsTaskCommon; 25 | import com.walmartlabs.concord.plugins.msteams.TeamsTaskParams; 26 | import com.walmartlabs.concord.runtime.v2.sdk.Context; 27 | import com.walmartlabs.concord.runtime.v2.sdk.Task; 28 | import com.walmartlabs.concord.runtime.v2.sdk.TaskResult; 29 | import com.walmartlabs.concord.runtime.v2.sdk.Variables; 30 | 31 | import javax.inject.Inject; 32 | import javax.inject.Named; 33 | 34 | @Named("msteams") 35 | public class TeamsTaskV2 implements Task { 36 | 37 | private final Context context; 38 | 39 | private final TeamsTaskCommon delegate; 40 | 41 | @Inject 42 | public TeamsTaskV2(Context context, TeamsTaskCommon delegate) { 43 | this.context = context; 44 | this.delegate = delegate; 45 | } 46 | 47 | @Override 48 | public TaskResult execute(Variables input) { 49 | Result r = delegate.execute(TeamsTaskParams.of(input, context.defaultVariables().toMap())); 50 | 51 | return TaskResult.of(r.isOk(), r.getError()) 52 | .value("data", r.getData()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tasks/msteams/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/packer/src/main/java/com/walmartlabs/concord/plugins/packer/PackerTask.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.packer; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2018 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import ca.vanzyl.concord.plugins.tool.ToolCommand; 24 | import ca.vanzyl.concord.plugins.tool.ToolInitializer; 25 | import ca.vanzyl.concord.plugins.tool.ToolTaskSupport; 26 | import com.walmartlabs.concord.sdk.InjectVariable; 27 | 28 | import javax.inject.Inject; 29 | import javax.inject.Named; 30 | import java.util.Map; 31 | 32 | @Named("packer") 33 | public class PackerTask 34 | extends ToolTaskSupport { 35 | 36 | @InjectVariable("packer") 37 | private Map defaults; 38 | 39 | @Inject 40 | public PackerTask(Map commands, ToolInitializer toolInitializer) { 41 | super(commands, toolInitializer); 42 | } 43 | } -------------------------------------------------------------------------------- /tasks/packer/src/main/java/com/walmartlabs/concord/plugins/packer/commands/Version.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.packer.commands; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import ca.vanzyl.concord.plugins.tool.ToolCommandSupport; 24 | 25 | import javax.inject.Named; 26 | 27 | @Named("packer/version") 28 | public class Version 29 | extends ToolCommandSupport { 30 | } 31 | -------------------------------------------------------------------------------- /tasks/packer/src/main/resources/packer/descriptor.yml: -------------------------------------------------------------------------------- 1 | --- 2 | id: packer 3 | name: Packer 4 | executable: packer 5 | architecture: amd64 6 | namingStyle: LOWER 7 | packaging: ZIP 8 | defaultVersion: 1.5.5 9 | urlTemplate: https://releases.hashicorp.com/packer/{version}/packer_{version}_{os}_{arch}.zip 10 | -------------------------------------------------------------------------------- /tasks/packer/src/test/packer/packer-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "aws_access_key": "", 4 | "aws_secret_key": "" 5 | }, 6 | "builders": [ 7 | { 8 | "type": "amazon-ebs", 9 | "access_key": "{{user `aws_access_key`}}", 10 | "secret_key": "{{user `aws_secret_key`}}", 11 | "region": "us-east-1", 12 | "source_ami_filter": { 13 | "filters": { 14 | "virtualization-type": "hvm", 15 | "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", 16 | "root-device-type": "ebs" 17 | }, 18 | "owners": [ 19 | "099720109477" 20 | ], 21 | "most_recent": true 22 | }, 23 | "instance_type": "t2.micro", 24 | "ssh_username": "ubuntu", 25 | "ami_name": "packer-example {{timestamp}}" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /tasks/packer/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/PuppetResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.io.Serializable; 24 | 25 | public class PuppetResult implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | private final boolean ok; 30 | private final Object data; 31 | private final String error; 32 | 33 | public PuppetResult(boolean ok, Object data, String error) { 34 | this.ok = ok; 35 | this.data = data; 36 | this.error = error; 37 | } 38 | 39 | public boolean isOk() { 40 | return ok; 41 | } 42 | 43 | public Object getData() { 44 | return data; 45 | } 46 | 47 | public String getError() { 48 | return error; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/SecretExporter.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.nio.file.Path; 24 | 25 | public interface SecretExporter { 26 | 27 | Path export(String o, String n, String p) throws Exception; 28 | } 29 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/dbquery/DbQueryPayload.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model.dbquery; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.puppet.model.cfg.DbQueryCfg; 24 | 25 | public class DbQueryPayload { 26 | 27 | private String query; 28 | 29 | public DbQueryPayload(DbQueryCfg cfg) { 30 | this.query = cfg.getQueryString(); 31 | } 32 | 33 | public String getQuery() { 34 | return query; 35 | } 36 | 37 | public void setQuery(String query) { 38 | this.query = query; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/exception/ConfigException.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model.exception; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class ConfigException extends RuntimeException { 24 | 25 | public ConfigException(String msg) { 26 | super("Error setting up PuppetConfiguration: " + msg); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/exception/MissingParameterException.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model.exception; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | 24 | public class MissingParameterException extends RuntimeException { 25 | 26 | public MissingParameterException(String missingParamName) { 27 | super("Cannot find value for " + missingParamName); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/token/TokenPayload.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model.token; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | 24 | import com.fasterxml.jackson.annotation.JsonInclude; 25 | import com.walmartlabs.concord.plugins.puppet.model.cfg.RbacCfg; 26 | 27 | @JsonInclude(JsonInclude.Include.NON_NULL) 28 | public class TokenPayload { 29 | 30 | private String login; 31 | private String password; 32 | private String lifetime; // optional 33 | private String description; // optional 34 | private String label; // optional 35 | 36 | public TokenPayload(RbacCfg rbacCfg) { 37 | 38 | this.login = rbacCfg.getUsername(); 39 | this.password = rbacCfg.getPassword(); 40 | this.lifetime = rbacCfg.getTokenLifetime(); 41 | this.label = rbacCfg.getLabel(); 42 | this.description = rbacCfg.getDescription(); 43 | } 44 | 45 | public String getLogin() { 46 | return login; 47 | } 48 | 49 | public String getPassword() { 50 | return password; 51 | } 52 | 53 | public String getLifetime() { 54 | return lifetime; 55 | } 56 | 57 | public String getDescription() { 58 | return description; 59 | } 60 | 61 | public String getLabel() { 62 | return label; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tasks/puppet/src/main/java/com/walmartlabs/concord/plugins/puppet/model/token/TokenResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet.model.token; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.annotation.JsonProperty; 24 | 25 | public class TokenResult { 26 | private String token; 27 | 28 | public TokenResult(@JsonProperty("token") String token) { 29 | this.token = token; 30 | } 31 | 32 | public String getToken() { 33 | return token; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tasks/puppet/src/test/java/com/walmartlabs/concord/plugins/puppet/ApiExceptionTest.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.puppet; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.puppet.model.exception.ApiException; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.junit.jupiter.api.Assertions.assertEquals; 27 | 28 | class ApiExceptionTest { 29 | 30 | @Test 31 | void testWithStatusCode() { 32 | ApiException ex = ApiException.buildException(404, "not found"); 33 | assertEquals(404, ex.getCode()); 34 | assert(ex.getMessage().contains("404") && ex.getMessage().contains("not found")); 35 | 36 | ex = ApiException.buildException(504, "timeout"); 37 | assertEquals(504, ex.getCode()); 38 | assert(ex.getMessage().contains("Server error")); 39 | 40 | ex = ApiException.buildException(306, "unused"); 41 | assertEquals(306, ex.getCode()); 42 | assert(ex.getMessage().contains("Error occurred")); 43 | } 44 | 45 | 46 | @Test 47 | void testMessage() { 48 | ApiException ex = new ApiException("error occurred"); 49 | assertEquals("error occurred", ex.getMessage()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tasks/puppet/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tasks/puppet/src/test/resources/simpleQueryResult.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "certname": "host01" 4 | }, 5 | { 6 | "certname": "host02" 7 | }, 8 | { 9 | "certname": "host03" 10 | }, 11 | { 12 | "certname": "host04" 13 | }, 14 | { 15 | "certname": "host05" 16 | }, 17 | { 18 | "certname": "host06" 19 | }, 20 | { 21 | "certname": "host07" 22 | }, 23 | { 24 | "certname": "host08" 25 | }, 26 | { 27 | "certname": "host09" 28 | }, 29 | { 30 | "certname": "host10" 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /tasks/puppet/src/test/resources/tokenCreate.json: -------------------------------------------------------------------------------- 1 | { 2 | "token":"0vghixAlYQF2-aJPtDCGa_d4CbOadf23rSDRFwe3fMwY" 3 | } 4 | -------------------------------------------------------------------------------- /tasks/puppet/wiremock_cert/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDlzCCAn+gAwIBAgIUMEN1kvW7pfPjVZRnHp5wXipuBTowDQYJKoZIhvcNAQEL 3 | BQAwWjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkFSMRQwEgYDVQQHDAtCZW50b252 4 | aWxsZTEUMBIGA1UECgwLV2FsbWFydGxhYnMxEjAQBgNVBAMMCWxvY2FsaG9zdDAg 5 | Fw0yNDA2MjIxNjMyMjNaGA8yMjk4MDQwNjE2MzIyM1owWjELMAkGA1UEBhMCVVMx 6 | CzAJBgNVBAgMAkFSMRQwEgYDVQQHDAtCZW50b252aWxsZTEUMBIGA1UECgwLV2Fs 7 | bWFydGxhYnMxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQAD 8 | ggEPADCCAQoCggEBAL0J4BvFMeSbRaLGk2NMqOGgFVTMcInuUbdq4Wniifzf2GuT 9 | MPf0x/2pJCPd1WnZxQHIvWzqVVb8xen7dVTuo6l9IMpxjuSkBzmjAUfLx8Dc4MmK 10 | PffzSUBpMSH5MIZkobIJrPBogqjtXu8zIos6e4ME75Pm9pdYysvBQecsPw3TSY2t 11 | yG5ZMvhTFLiLMsdkfw4N2ucC3BKWi4yoUtZGk5oVItr2mZzq0VinEMKBHVkfAKCa 12 | czI5d9uWq1RTs8b6H4Pal59dzDmh8/DhaDPllmLQwbbS6kMwaBnUIke0ZV54TKDI 13 | BGx2IH0/fc4piSZlIlqsolNDx4r08CP6Oa4OhLsCAwEAAaNTMFEwHQYDVR0OBBYE 14 | FECnpv58kDlRtD8I99hV6AiISSfHMB8GA1UdIwQYMBaAFECnpv58kDlRtD8I99hV 15 | 6AiISSfHMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFWGRQua 16 | C4Kw72ZZd/rVSEIE4LTvljxyTqC8PRJYnAr5k+tNsc91c8iwleLWzzynp8HF2l33 17 | KS4+32dfxXcsE6Dhd+LjsVJ0bi2kAty2bI0laJGrZibF3iNEENKwSxKJYiAYJuzx 18 | MCcgkqs90ZZkHmicoAQb20dqQI3YtvLd9jiy2DlgOyDB6xfpuxVq1RydetDxLaOO 19 | 9BCQirSFjQ5M5qgeoexcKklFg1a6V1zfEZfwf962zS18YEcYv5JCx/nUHgUCWAAa 20 | 6f8smWqZe/G/DPZ5cyp7NMBEh0S/5fGSqE7F1rLBcOZ91KJmODV3lxzMXeltIkPI 21 | J7L5eRp+VDypj7w= 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tasks/puppet/wiremock_cert/cert.ext: -------------------------------------------------------------------------------- 1 | authorityKeyIdentifier=keyid,issuer 2 | basicConstraints=CA:FALSE 3 | keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment 4 | subjectAltName = @alt_names 5 | 6 | [alt_names] 7 | DNS.1 = localhost 8 | -------------------------------------------------------------------------------- /tasks/puppet/wiremock_cert/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDtDCCApygAwIBAgIUcA36VtWHBL7vc51TrdsWd7LiqFwwDQYJKoZIhvcNAQEL 3 | BQAwWjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkFSMRQwEgYDVQQHDAtCZW50b252 4 | aWxsZTEUMBIGA1UECgwLV2FsbWFydGxhYnMxEjAQBgNVBAMMCWxvY2FsaG9zdDAg 5 | Fw0yNDA2MjIxNjMyNTNaGA8yMjk4MDQwNjE2MzI1M1owWjELMAkGA1UEBhMCVVMx 6 | CzAJBgNVBAgMAkFSMRQwEgYDVQQHDAtCZW50b252aWxsZTEUMBIGA1UECgwLV2Fs 7 | bWFydGxhYnMxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQAD 8 | ggEPADCCAQoCggEBALRH0YxTX4aXWzSyZpfS1aKbs7SSI2MTChHKvE4jdjVWmJ9p 9 | jd08I5NA+43ypNmxePt4bdDwpAQMJiR8/KHIw8S7HK+vF0jwsQxjWiGv1RV/6LgI 10 | 0FhC0zD6hf2hUaOO1jCOWd9vdX+dZPDh8bWxkNbBnH5jyNPaAhTtIQl71Yru40Ah 11 | mlrWvcDBrRr5jnEyzmX0JKsdkrOh/FTy3FJC4etG/W3tFEN2mjgsQ9aSm2GYyT9F 12 | eFhk7XeJGExWdzyWwsd4AExgcttC+oMxN+6Z7w4ociZ4uxJk99WN1wcCoc7x5rv/ 13 | n31bCvRIqyXzU/FE0dDc0YWvMb4ZZhwEbN2AQwsCAwEAAaNwMG4wHwYDVR0jBBgw 14 | FoAUQKem/nyQOVG0Pwj32FXoCIhJJ8cwCQYDVR0TBAIwADALBgNVHQ8EBAMCBPAw 15 | FAYDVR0RBA0wC4IJbG9jYWxob3N0MB0GA1UdDgQWBBTq5U0I8I8q4qa/P0xdub+a 16 | Qovb7jANBgkqhkiG9w0BAQsFAAOCAQEACf9WL9eY/sNr/eFRwgdWjUbiC6w54ik4 17 | 3U1PSPxxGoGVncW/jxMmRQwwS+dgDR9Fyrj7VC4NEceVLWSjnsEJpbweBQgd27cj 18 | UkRgUSi2lLHeq3Og8R176sXgQa90mEz2FaeXGwhJHzvg7fSqLVs80sxlnj+LIUa7 19 | /rUeGOYKaXUFQWgaPlJcQJ0I3Oyqe+WcJe5ks1PrhAe8LZ3cLh+18aURg2ULsz3x 20 | QwsO5BkTn7ycL1Hfhuc0ByyuujlLkTLzjAPLYNgvXVqAeDZ+f2mH7RDw2CpTVG/M 21 | WGrkR/2EOAGWT04HKE4+JY/SZUJuSfJIwlg9SJaDZJA9xKz7UmsKQA== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tasks/puppet/wiremock_cert/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0R9GMU1+Gl1s0 3 | smaX0tWim7O0kiNjEwoRyrxOI3Y1VpifaY3dPCOTQPuN8qTZsXj7eG3Q8KQEDCYk 4 | fPyhyMPEuxyvrxdI8LEMY1ohr9UVf+i4CNBYQtMw+oX9oVGjjtYwjlnfb3V/nWTw 5 | 4fG1sZDWwZx+Y8jT2gIU7SEJe9WK7uNAIZpa1r3Awa0a+Y5xMs5l9CSrHZKzofxU 6 | 8txSQuHrRv1t7RRDdpo4LEPWkpthmMk/RXhYZO13iRhMVnc8lsLHeABMYHLbQvqD 7 | MTfume8OKHImeLsSZPfVjdcHAqHO8ea7/599Wwr0SKsl81PxRNHQ3NGFrzG+GWYc 8 | BGzdgEMLAgMBAAECggEADvNhymxjoKrOsokU/wRKGUkmVxRDgQTkMeOJSEWimPvM 9 | fnPngvBo1t5tvjDgQPl52gj7uncqcvd69k2zOcuHiLonv94aZT8ov6lBoUeOuVC5 10 | QQHiHV+1Wft8vzLwrUq8MpyrkV8R9HpeE6f5PqMyKs01qDmoPwF2aLvdoIa3h+Tx 11 | +IXMJYHJ4mvuBouWO6FBuw1JqXp8BKtfE3Of2791qTvCigANlxfgK38PCbQ41dFr 12 | w37rYyU5rF0zPtXJc91XC9DXOyNZ6N65fOif16gfOOOwybnwXQFQOmQHDmoAZFKr 13 | EpwduajkyqoQ1j8avSUAhjA1qJzZOc4GlCZjDhaIMQKBgQDu2jjRU+DF68kmsKQF 14 | FCGGz8uCIb+N6pQyBPIe518JsalB2m2TYcYddzcLf2l6knNQCWCyvW9zST4vi6Tl 15 | X+3R+5MzG+qWKuI8rxY68/1iBAx+kzrPnLgHjhxujb5G/rArVUVsXAFKtmyNDoOn 16 | OgMn4evCrkYRTkBhvQY9DRHBCQKBgQDBOSBJgeaACpTuHKJGwD3SPZsbRTQfG7Mh 17 | dbLdkhxxLhp4R05ZHtplU5N1QTLmZpFPVzWy5xgbGdszjJjf7TPZVQ95TSpO2qVO 18 | Kqx/lHLfCzJXFRFzfkNrOsKvb4+uHzJzyv+06DvR4O8fiXkklDmH3pwXzJmyVBe9 19 | MQXa0dEscwKBgAVmteY16V1QaaoQUIU04VU1GbsFnFlPNq6y4e7E+Kc1d0hf8h5l 20 | FZ/Q9FO0O+Rjr2vd6mvgUMbgnyFgHQh61NvsvnVnajSfH6KTqwMGRXKT+Nxb4/aR 21 | 6q9xDT+KwQTF+aHhOcKrifPwkB/Ydi2v6CZcu4IZgsgdZuNO7PcwdnhRAoGBAIBp 22 | 2dZgeXMRFUdmSkbhDnUCMmoeRPSDsToEgdoVd8eUT00ufphmE9kRgUeFDDHpapsj 23 | J3H9eZzRQ0fwIc14VGQUztLcAMklMIVRgRDM9MbdJxiOzOlHucCy7Z4wc3nSC/K+ 24 | r9BoIxFp/yGjeJph1BZDUNPUSzUkBB7dTLnPhceXAoGBAJMLACx2G6NpIu46mIF2 25 | RNTuhIXtzL/lIolpkXad2uCij9QJ68cp9N+zUoxFswp00ZUCctI5jepGoW4tB14p 26 | XYsEa+aKBNLw0LZZ+mZwRAju64UFr6L27BQfIQf0FbIrDhtq0PdF/RioKvaUGQkP 27 | 0xzn531BvgtJjB+QPEAv7QU4 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /tasks/s3/examples/put_get/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:s3-task:1.32.0" 4 | 5 | flows: 6 | # store an object 7 | - task: s3 8 | in: 9 | action: "putObject" 10 | endpoint: "http://s3.example.com" # optional 11 | region: "some-region" 12 | pathStyleAccess: true # optional, some S3 API implementations require it 13 | auth: 14 | basic: 15 | accessKey: "..." 16 | secretKey: "..." 17 | bucketName: "myBucket" 18 | objectKey: "myObject" 19 | src: "local.file" 20 | 21 | # retrieve an object 22 | - task: s3 23 | in: 24 | action: "getObject" 25 | region: "some-region" 26 | pathStyleAccess: true # optional, some S3 API implementations require it 27 | auth: 28 | basic: 29 | accessKey: "..." 30 | secretKey: "..." 31 | bucketName: "myBucket" 32 | objectKey: "myObject" 33 | 34 | - log: "Stored as ${result.path}" 35 | -------------------------------------------------------------------------------- /tasks/s3/src/main/java/com/walmartlabs/concord/plugins/s3/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.s3; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public final class Constants { 24 | 25 | public static final String ACTION_KEY = "action"; 26 | public static final String AUTH_KEY = "auth"; 27 | public static final String RESULT_KEY = "result"; 28 | 29 | private Constants() { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tasks/s3/src/main/java/com/walmartlabs/concord/plugins/s3/ErrorResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.s3; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class ErrorResult implements Result { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | private final boolean ok; 28 | private final String error; 29 | 30 | public ErrorResult(String error) { 31 | this.ok = false; 32 | this.error = error; 33 | } 34 | 35 | public boolean isOk() { 36 | return ok; 37 | } 38 | 39 | public String getError() { 40 | return error; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tasks/s3/src/main/java/com/walmartlabs/concord/plugins/s3/GetObjectResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.s3; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class GetObjectResult implements Result { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | private final boolean ok; 28 | private final String path; 29 | 30 | public GetObjectResult(String path) { 31 | this.ok = true; 32 | this.path = path; 33 | } 34 | 35 | public boolean isOk() { 36 | return ok; 37 | } 38 | 39 | public String getPath() { 40 | return path; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tasks/s3/src/main/java/com/walmartlabs/concord/plugins/s3/PutObjectResult.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.s3; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class PutObjectResult implements Result { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | private final boolean ok; 28 | private final String eTag; 29 | private final String contentMd5; 30 | 31 | public PutObjectResult(String eTag, String contentMd5) { 32 | this.ok = true; 33 | this.eTag = eTag; 34 | this.contentMd5 = contentMd5; 35 | } 36 | 37 | public boolean isOk() { 38 | return ok; 39 | } 40 | 41 | public String getTag() { 42 | return eTag; 43 | } 44 | 45 | public String getContentMd5() { 46 | return contentMd5; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tasks/s3/src/main/java/com/walmartlabs/concord/plugins/s3/Result.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.s3; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.io.Serializable; 24 | 25 | public interface Result extends Serializable { 26 | } 27 | -------------------------------------------------------------------------------- /tasks/s3/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tasks/terraform/examples/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - create a Concord project. Enable "Allow payload archives" (not necessary for production usage); 4 | - update the credentials and other parameters in `concord.yml` if necessary; 5 | - start the process by running: 6 | ``` 7 | $ ./run.sh http://concordhost:8001 orgName projectName 8 | ``` 9 | -------------------------------------------------------------------------------- /tasks/terraform/examples/approval/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - mvn://com.walmartlabs.concord.plugins:terraform-task:1.13.0 4 | 5 | flows: 6 | default: 7 | # run `terraform plan` in the process' working directory 8 | - task: terraform 9 | in: 10 | action: plan 11 | extraVars: 12 | aws_access_key: "AWS access key" # replace with the real values 13 | aws_secret_key: "AWS secret key" # or use Concord Secrets, `decryptString` etc 14 | 15 | - if: ${!result.hasChanges} 16 | then: 17 | - log: "No changes planned, stopping..." 18 | - exit 19 | 20 | # show the approval form 21 | - form: approvalForm 22 | fields: 23 | - plan: { type: "string", readonly: true, value: "${result.output}" } 24 | - approved: { type: "boolean" } 25 | values: 26 | processId: "${txId}" 27 | yield: true 28 | 29 | # stop the process if the plan wasn't approved 30 | - if: ${!approvalForm.approved} 31 | then: 32 | - throw: "The plan was not approved" 33 | 34 | # run `terraform apply` using the generated plan 35 | - task: terraform 36 | in: 37 | action: apply 38 | plan: "${result.planPath}" 39 | # when using a previously created plan file, no need to pass `extraVars` again 40 | -------------------------------------------------------------------------------- /tasks/terraform/examples/approval/example.tf: -------------------------------------------------------------------------------- 1 | variable "aws_access_key" {} 2 | variable "aws_secret_key" {} 3 | 4 | provider "aws" { 5 | access_key = "${var.aws_access_key}" 6 | secret_key = "${var.aws_secret_key}" 7 | region = "us-east-1" 8 | } 9 | 10 | resource "aws_instance" "example" { 11 | ami = "ami-2757f631" 12 | instance_type = "t2.micro" 13 | vpc_security_group_ids = ["sg-b92859c2"] 14 | subnet_id = "subnet-f04d4d86" 15 | } 16 | -------------------------------------------------------------------------------- /tasks/terraform/examples/approval/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf forms target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process 14 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-ansible/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:terraform-task:1.13.0" 4 | - "mvn://com.walmartlabs.concord.plugins.basic:ansible-tasks:1.26.0" 5 | 6 | flows: 7 | default: 8 | # apply the changes 9 | - task: terraform 10 | in: 11 | action: apply 12 | saveOutput: true 13 | extraVars: 14 | subscription_id: "azure subsciption id" # replace with the real values 15 | tenant_id: "azure tenant id" # or use Concord Secrets, `decryptString` etc 16 | client_id: "azure client id" 17 | client_secret: "azure client secret" 18 | ssh_public_key: "publis ssh key" # load it from a file or store as a Concord Secret 19 | 20 | - log: "Public IP: ${result.data.public_ip.value}" 21 | 22 | # deploy using Ansible 23 | - task: ansible 24 | in: 25 | playbook: playbook.yml 26 | user: "azureuser" # same as in example.tf 27 | privateKey: 28 | org: "myOrg" 29 | secretName: "mySecret" 30 | inventory: 31 | myHosts: 32 | hosts: 33 | - "${result.data.public_ip.value}" 34 | config: 35 | ssh_connection: 36 | retries: 10 # wait for SSH to come up 37 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-ansible/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myHosts 3 | tasks: 4 | - name: Install a package 5 | become: true 6 | apt: 7 | name: vim 8 | state: present 9 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-ansible/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf playbook.yml target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process 14 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-minimal/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - mvn://com.walmartlabs.concord.plugins:terraform-task:1.12.0 4 | 5 | flows: 6 | default: 7 | - task: terraform 8 | in: 9 | action: plan 10 | extraVars: 11 | subscription_id: "azure subsciption id" # replace with the real values 12 | tenant_id: "azure tenant id" # or use Concord Secrets, `decryptString` etc 13 | client_id: "azure client id" 14 | client_secret: "azure client secret" 15 | 16 | - task: terraform 17 | in: 18 | action: apply 19 | plan: "${result.planPath}" 20 | # when using a previously created plan file, no need to pass `extraVars` again 21 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-minimal/example.tf: -------------------------------------------------------------------------------- 1 | variable "client_id" {} 2 | variable "client_secret" {} 3 | variable "subscription_id" {} 4 | variable "tenant_id" {} 5 | 6 | provider "azurerm" { 7 | client_id = "${var.client_id}" 8 | client_secret = "${var.client_secret}" 9 | subscription_id = "${var.subscription_id}" 10 | tenant_id = "${var.tenant_id}" 11 | } 12 | 13 | resource "azurerm_resource_group" "example" { 14 | name = "example-azure" 15 | location = "southcentralus" 16 | } 17 | -------------------------------------------------------------------------------- /tasks/terraform/examples/azure-minimal/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process 14 | -------------------------------------------------------------------------------- /tasks/terraform/examples/gcp-minimal/README.md: -------------------------------------------------------------------------------- 1 | ### Getting GCP Project Credentials 2 | 3 | Set up a service account key, which Terraform will use to create and manage 4 | resources in your GCP project. Go to 5 | the [create service account key page](https://console.cloud.google.com/apis/credentials/serviceaccountkey). 6 | Select the default service account or create a new one, select JSON as the key 7 | type, and click Create. 8 | 9 | This downloads a JSON file with all the credentials that will be needed for 10 | Terraform to manage the resources. This file should be located in a secure 11 | place for production projects. 12 | 13 | In this example credentials file is uploaded as file secret via the Concord UI. 14 | Example file contents: 15 | ```yaml 16 | { 17 | "type": "service_account", 18 | "project_id": "myGcpProjectID", 19 | "private_key_id": "myPrivateKeyID", 20 | "private_key": "myPrivateKey", 21 | "client_email": "myClientEmail", 22 | "client_id": "myClientID", 23 | "auth_uri": "https://accounts.google.com/o/oauth2/auth", 24 | "token_uri": "https://oauth2.googleapis.com/token", 25 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", 26 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/{{client_email}}" 27 | } 28 | ``` 29 | 30 | Run the example using 31 | ``` 32 | $ ./run.sh concord.example.com:8001 myOrg myProject 33 | ``` -------------------------------------------------------------------------------- /tasks/terraform/examples/gcp-minimal/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - mvn://com.walmartlabs.concord.plugins:terraform-task:1.22.0 4 | 5 | flows: 6 | default: 7 | - task: terraform 8 | in: 9 | action: plan 10 | extraVars: 11 | # myGcpCreds contains the service account's credentials - refer to README.md for more details. 12 | credentials: "${crypto.exportAsFile('myOrg', 'myGcpCreds', 'myPassword')}" 13 | projectName: "concord-test" 14 | 15 | - task: terraform 16 | in: 17 | action: apply 18 | plan: "${result.planPath}" 19 | -------------------------------------------------------------------------------- /tasks/terraform/examples/gcp-minimal/example.tf: -------------------------------------------------------------------------------- 1 | variable "credentials" {} 2 | variable "projectName" {} 3 | 4 | provider "google" { 5 | credentials = "${var.credentials}" 6 | project = "${var.projectName}" 7 | region = "us-central1" 8 | zone = "us-central1-a" 9 | } 10 | 11 | resource "google_compute_network" "vpc_network" { 12 | name = "my-vpc-network" 13 | } 14 | 15 | resource "google_compute_instance" "vm_instance" { 16 | name = "my-vm-instance" 17 | 18 | machine_type = "f1-micro" 19 | zone = "us-central1-a" 20 | 21 | boot_disk { 22 | initialize_params { 23 | image = "debian-cloud/debian-9" 24 | } 25 | } 26 | 27 | network_interface { 28 | subnetwork = "${google_compute_network.vpc_network.name}" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tasks/terraform/examples/gcp-minimal/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process 14 | -------------------------------------------------------------------------------- /tasks/terraform/examples/minimal/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - mvn://com.walmartlabs.concord.plugins:terraform-task:1.12.0 4 | 5 | flows: 6 | default: 7 | - task: terraform 8 | in: 9 | action: apply 10 | extraVars: 11 | aws_access_key: "AWS access key" # replace with the real values 12 | aws_secret_key: "AWS secret key" # or use Concord Secrets, `decryptString` etc 13 | -------------------------------------------------------------------------------- /tasks/terraform/examples/minimal/example.tf: -------------------------------------------------------------------------------- 1 | variable "aws_access_key" {} 2 | variable "aws_secret_key" {} 3 | 4 | provider "aws" { 5 | access_key = "${var.aws_access_key}" 6 | secret_key = "${var.aws_secret_key}" 7 | region = "us-east-1" 8 | } 9 | 10 | resource "aws_instance" "example" { 11 | ami = "ami-2757f631" 12 | instance_type = "t2.micro" 13 | vpc_security_group_ids = [ 14 | "sg-b92859c2"] 15 | subnet_id = "subnet-f04d4d86" 16 | } 17 | -------------------------------------------------------------------------------- /tasks/terraform/examples/minimal/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process -------------------------------------------------------------------------------- /tasks/terraform/examples/output/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - mvn://com.walmartlabs.concord.plugins:terraform-task:1.12.0 4 | 5 | flows: 6 | default: 7 | - task: terraform 8 | in: 9 | action: apply 10 | saveOutput: true # run `terraform output` after apply and save the output 11 | extraVars: 12 | aws_access_key: "AWS access key" # replace with the real values 13 | aws_secret_key: "AWS secret key" # or use Concord Secrets, `decryptString` etc 14 | 15 | # `terraform output` can be executed as a separate action as well 16 | # - task: terraform 17 | # in: 18 | # action: output 19 | 20 | - log: "Output: ${result.data}" 21 | - log: "Public IP: ${result.data.public_instance_ip.value}" 22 | -------------------------------------------------------------------------------- /tasks/terraform/examples/output/example.tf: -------------------------------------------------------------------------------- 1 | variable "aws_access_key" {} 2 | variable "aws_secret_key" {} 3 | 4 | provider "aws" { 5 | access_key = "${var.aws_access_key}" 6 | secret_key = "${var.aws_secret_key}" 7 | region = "us-east-1" 8 | } 9 | 10 | resource "aws_instance" "example" { 11 | ami = "ami-2757f631" 12 | instance_type = "t2.micro" 13 | vpc_security_group_ids = [ 14 | "sg-b92859c2"] 15 | subnet_id = "subnet-f04d4d86" 16 | } 17 | 18 | output "public_instance_ip" { 19 | value = "${aws_instance.example.public_ip}" 20 | } 21 | -------------------------------------------------------------------------------- /tasks/terraform/examples/output/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | ORG_NAME="$2" 5 | PROJECT_NAME="$3" 6 | 7 | rm -rf target && mkdir target 8 | cp concord.yml example.tf target/ 9 | 10 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 11 | 12 | read -p "Username: " CURL_USER 13 | curl -u ${CURL_USER} -F archive=@target/payload.zip -F org=${ORG_NAME} -F project=${PROJECT_NAME} http://${SERVER_ADDR}/api/v1/process -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/Action.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public enum Action { 24 | APPLY, 25 | PLAN, 26 | OUTPUT, 27 | DESTROY; 28 | } 29 | -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/TerraformExecutable.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2022 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.nio.file.Path; 24 | 25 | /** 26 | * A Terraform executable file may exist in a number of contexts (local filesystem 27 | * vs container filesystem) and may be detected in a shell PATH or explicitly 28 | * added to a particular working directory. {@link TerraformExecutable} 29 | * encapsulates these properties to help make sense of them in downstream usage 30 | * of the executable 31 | */ 32 | public class TerraformExecutable { 33 | 34 | final private Path executablePath; 35 | final private boolean sourceInContainer; 36 | 37 | public TerraformExecutable(Path executablePath, boolean sourceInContainer) { 38 | this.executablePath = executablePath; 39 | this.sourceInContainer = sourceInContainer; 40 | } 41 | 42 | public boolean isSourceInContainer() { 43 | return sourceInContainer; 44 | } 45 | 46 | public Path getExecutablePath() { 47 | return executablePath; 48 | } 49 | 50 | public boolean hasPath() { 51 | return executablePath != null; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/Utils.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.sdk.MapUtils; 24 | 25 | import java.nio.file.Path; 26 | import java.nio.file.Paths; 27 | import java.util.Collections; 28 | import java.util.List; 29 | import java.util.Map; 30 | import java.util.stream.Collectors; 31 | 32 | public final class Utils { 33 | 34 | public static Path getPath(Map cfg, String k, Path defaultValue) { 35 | String v = MapUtils.getString(cfg, k); 36 | if (v == null) { 37 | return defaultValue; 38 | } 39 | 40 | return Paths.get(v); 41 | } 42 | 43 | public static Path getAbsolute(Path workDir, Path p) { 44 | if (p.isAbsolute()) { 45 | return p; 46 | } 47 | 48 | return workDir.resolve(p); 49 | } 50 | 51 | public static List resolve(Path dir, List paths) { 52 | if (paths == null) { 53 | return Collections.emptyList(); 54 | } 55 | 56 | return paths.stream().map(dir::resolve).collect(Collectors.toList()); 57 | } 58 | 59 | private Utils() { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/VersionUtils.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2021 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.fasterxml.jackson.core.Version; 24 | 25 | public final class VersionUtils { 26 | 27 | public static boolean ge(Terraform terraform, int major, int minor, int patchLevel) { 28 | Version v = new Version(major, minor, patchLevel, null, null, null); 29 | return terraform.version().compareTo(v) >= 0; 30 | } 31 | 32 | private VersionUtils() { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/backend/Backend.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform.backend; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.nio.file.Path; 24 | import java.util.Collections; 25 | import java.util.Map; 26 | 27 | public interface Backend { 28 | 29 | String getId(); 30 | 31 | void lock() throws Exception; 32 | 33 | void unlock() throws Exception; 34 | 35 | /** 36 | * Initialized the backend. 37 | * 38 | * @param tfDir a directory with Terraform files 39 | */ 40 | void init(Path tfDir) throws Exception; 41 | 42 | /** 43 | * Prepares the backend-specific environment variables. 44 | */ 45 | default Map prepareEnv(Map cfg) { 46 | return Collections.emptyMap(); 47 | } 48 | 49 | /** 50 | * @return if {@code true} the backend supports {@code -out} parameter 51 | * (can save output variables). Default is {@code true}. 52 | */ 53 | default boolean supportsOutFiles() { 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tasks/terraform/src/main/java/com/walmartlabs/concord/plugins/terraform/backend/DummyBackend.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.terraform.backend; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import java.nio.file.Path; 24 | 25 | public class DummyBackend implements Backend { 26 | 27 | public String getId() { 28 | return "dummy"; 29 | } 30 | 31 | @Override 32 | public void lock() { 33 | // do nothing 34 | } 35 | 36 | @Override 37 | public void unlock() { 38 | // do nothing 39 | } 40 | 41 | @Override 42 | public void init(Path tfDir) { 43 | // do nothing 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/filtered-resources/version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} -------------------------------------------------------------------------------- /tasks/terraform/src/test/resources/com/walmartlabs/concord/plugins/terraform/it/main.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | profile = "default" 3 | } 4 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/resources/com/walmartlabs/concord/plugins/terraform/runtimeV1/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | runtime: "concord-v1" 3 | dependencies: 4 | - "mvn://com.walmartlabs.concord.plugins:terraform-task:%%version%%" 5 | 6 | flows: 7 | default: 8 | # regular run 9 | - task: terraform 10 | in: 11 | action: plan 12 | 13 | # custom $PWD 14 | - task: terraform 15 | in: 16 | action: plan 17 | pwd: mydir 18 | 19 | # custom $PWD + [DIR] 20 | - task: terraform 21 | in: 22 | action: plan 23 | pwd: mydir 24 | dir: nested 25 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/resources/com/walmartlabs/concord/plugins/terraform/runtimeV2/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | runtime: "concord-v2" 3 | dependencies: 4 | - "mvn://com.walmartlabs.concord.plugins:terraform-task:%%version%%" 5 | 6 | flows: 7 | default: 8 | # regular run 9 | - task: terraform 10 | in: 11 | action: plan 12 | 13 | # custom $PWD 14 | - task: terraform 15 | in: 16 | action: plan 17 | pwd: mydir 18 | 19 | # custom $PWD + [DIR] 20 | - task: terraform 21 | in: 22 | action: plan 23 | pwd: mydir 24 | dir: nested 25 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/main.tf: -------------------------------------------------------------------------------- 1 | variable "aws_access_key" {} 2 | variable "aws_secret_key" {} 3 | 4 | terraform { 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = "~> 4.0" 9 | } 10 | } 11 | } 12 | 13 | provider "aws" { 14 | region = "us-west-2" 15 | } 16 | 17 | resource "aws_instance" "example" { 18 | ami = "${data.aws_ami.ubuntu.id}" 19 | instance_type = "t2.micro" 20 | vpc_security_group_ids = ["${aws_default_security_group.default.id}"] 21 | tags = { 22 | Name = "concord-test" 23 | } 24 | } 25 | 26 | data "aws_vpc" "default" { 27 | default = true 28 | } 29 | 30 | resource "aws_default_security_group" "default" { 31 | vpc_id = "${data.aws_vpc.default.id}" 32 | 33 | ingress { 34 | protocol = -1 35 | self = true 36 | from_port = 0 37 | to_port = 0 38 | } 39 | 40 | egress { 41 | from_port = 0 42 | to_port = 0 43 | protocol = "-1" 44 | cidr_blocks = ["0.0.0.0/0"] 45 | } 46 | } 47 | 48 | data "aws_ami" "ubuntu" { 49 | most_recent = true 50 | owners = ["099720109477"] # Canonical 51 | 52 | filter { 53 | name = "virtualization-type" 54 | values = ["hvm"] 55 | } 56 | 57 | filter { 58 | name = "architecture" 59 | values = ["x86_64"] 60 | } 61 | 62 | filter { 63 | name = "image-type" 64 | values = ["machine"] 65 | } 66 | 67 | filter { 68 | name = "name" 69 | values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"] 70 | } 71 | } 72 | 73 | output "message" { 74 | value = "hello!" 75 | } 76 | 77 | variable "name" {} 78 | variable "time" {} 79 | 80 | output "name_from_varfile0" { 81 | value = "${var.name}" 82 | } 83 | 84 | output "time_from_varfile1" { 85 | value = "${var.time}" 86 | } 87 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/minimal_aws/main.tf: -------------------------------------------------------------------------------- 1 | variable "aws_access_key" {} 2 | variable "aws_secret_key" {} 3 | 4 | terraform { 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = "~> 4.0" 9 | } 10 | } 11 | } 12 | 13 | provider "aws" { 14 | region = "us-west-2" 15 | access_key = var.aws_access_key 16 | secret_key = var.aws_secret_key 17 | } 18 | 19 | data "aws_vpc" "default" { 20 | default = true 21 | } 22 | 23 | resource "aws_key_pair" "deployer" { 24 | key_name = "concord-TF-ITs-key" 25 | public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOaV1IVyqzYbUXc6RAgVbVxrbNGMKEsLtLXW82FOBUI4x6+bBJVKNqa/c5cntFOQgRm2bs6CfQPmLJFAOlA1gbRXiOrfatX4WYt6p0Z54BqMCaXZ09zqLcInUPmP8eSTmxqKrefJQAsLqJi46knKxdnPqFxAqbfwed2THu3KokUmWoDceZFEuLb/gXkf6uXinFSV1Gp27ulzNFZpxxDUG9357kmJro0nXAObaOCpCCfb3gG2T/TXGaKtCk7tLIS+iSEzYxLWkmTnVciB9qOIRNrw4TmhEUrrcOz8W0e/WB/BtS4Y56y3cCcibx8WPbWMYSRCmOZPLWbY/x13nA92R9pW+j5dmcWjqsYypnZaQMSQumIUl2/TLOCF0/Fphlj8/G0ZMxIjYXEk5g3ZorTvUR1+TJ7Cbrwk4NIROFbpHVm60w+svnqDgNv+cRDDSOmhB5SDOjBvqiVAqtlb8lE8km5M3VbRZ+12QBDR3ILwPRcKoqK6HnVa4jiODweoOSXos= test@concord" 26 | } 27 | 28 | 29 | output "message" { 30 | value = "hello!" 31 | } 32 | 33 | variable "name" {} 34 | variable "time" {} 35 | 36 | output "default_vpc_id" { 37 | value = data.aws_vpc.default.id 38 | } 39 | 40 | output "name_from_varfile0" { 41 | value = var.name 42 | } 43 | 44 | output "time_from_varfile1" { 45 | value = var.time 46 | } 47 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/minimal_azure/main.tf: -------------------------------------------------------------------------------- 1 | variable "client_id" {} 2 | variable "client_secret" {} 3 | variable "subscription_id" {} 4 | variable "tenant_id" {} 5 | variable "name" {} 6 | variable "time" {} 7 | 8 | terraform { 9 | required_providers { 10 | azurerm = { 11 | source = "hashicorp/azurerm" 12 | version = "3.17.0" 13 | } 14 | } 15 | } 16 | 17 | provider "azurerm" { 18 | client_id = var.client_id 19 | client_secret = var.client_secret 20 | subscription_id = var.subscription_id 21 | tenant_id = var.tenant_id 22 | 23 | features {} 24 | } 25 | 26 | resource "azurerm_resource_group" "mygroup" { 27 | name = "concord-tf-test-resources" 28 | location = "southcentralus" 29 | 30 | lifecycle { 31 | ignore_changes = [ tags ] 32 | } 33 | } 34 | 35 | 36 | output "resource_group_info" { 37 | value = { 38 | name = azurerm_resource_group.mygroup.name, 39 | id = azurerm_resource_group.mygroup.id, 40 | location = azurerm_resource_group.mygroup.location 41 | } 42 | } 43 | 44 | output "name_from_varfile0" { 45 | value = var.name 46 | } 47 | 48 | output "time_from_varfile1" { 49 | value = var.time 50 | } 51 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/terraform.tfstate: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "terraform_version": "0.11.12", 4 | "serial": 2, 5 | "lineage": "ed17080c-d22c-0c55-d029-a589bcf9b365", 6 | "modules": [ 7 | { 8 | "path": [ 9 | "root" 10 | ], 11 | "outputs": { 12 | "image_id": { 13 | "sensitive": false, 14 | "type": "string", 15 | "value": "ami-07b4f3c02c7f83d59" 16 | } 17 | }, 18 | "depends_on": [] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/varfile0.tfvars: -------------------------------------------------------------------------------- 1 | name = "bob" 2 | -------------------------------------------------------------------------------- /tasks/terraform/src/test/terraform/varfile1.tfvars: -------------------------------------------------------------------------------- 1 | time = "now" 2 | -------------------------------------------------------------------------------- /tasks/xml/examples/maven/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | Demonstrates how to use the `xmlUtils` task to extract data from 4 | a Maven `pom.xml` file. 5 | 6 | ## Usage 7 | 8 | ``` 9 | curl -i -u username \ 10 | -F concord.yml=@concord.yml \ 11 | -F pom.xml=@pom.xml \ 12 | https://concord.example.com/api/v1/process 13 | ``` 14 | 15 | -------------------------------------------------------------------------------- /tasks/xml/examples/maven/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:xml-tasks:1.28.0" 4 | 5 | flows: 6 | default: 7 | - expr: "${xmlUtils.mavenGav('pom.xml')}" 8 | out: gav 9 | 10 | - log: "groupId: ${gav.groupId}" 11 | - log: "artifactId: ${gav.artifactId}" 12 | - log: "version: ${gav.version}" 13 | -------------------------------------------------------------------------------- /tasks/xml/examples/maven/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | com.walmartlabs.concord.plugins 7 | concord-plugins-parent 8 | 1.27.1-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 12 | xml-tasks 13 | jar 14 | 15 | 16 | 17 | com.walmartlabs.concord 18 | concord-sdk 19 | provided 20 | 21 | 22 | com.walmartlabs.concord.runtime.v2 23 | concord-runtime-sdk-v2 24 | provided 25 | 26 | 27 | javax.inject 28 | javax.inject 29 | provided 30 | 31 | 32 | com.fasterxml.jackson.core 33 | jackson-databind 34 | provided 35 | 36 | 37 | 38 | junit 39 | junit 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /tasks/xml/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | com.walmartlabs.concord.plugins 7 | concord-plugins-parent 8 | 2.8.1-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 12 | xml-tasks 13 | jar 14 | 15 | 16 | 17 | com.walmartlabs.concord 18 | concord-sdk 19 | provided 20 | 21 | 22 | com.walmartlabs.concord.runtime.v2 23 | concord-runtime-sdk-v2 24 | provided 25 | 26 | 27 | javax.inject 28 | javax.inject 29 | provided 30 | 31 | 32 | com.fasterxml.jackson.core 33 | jackson-databind 34 | provided 35 | 36 | 37 | 38 | org.junit.jupiter 39 | junit-jupiter-api 40 | test 41 | 42 | 43 | 44 | 45 | 46 | 47 | dev.ybrig.concord 48 | concord-maven-plugin 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tasks/xml/src/test/resources/test2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | com.walmartlabs.concord.plugins 7 | concord-plugins-parent 8 | 1.27.1-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 12 | xml-tasks 13 | jar 14 | 15 | 16 | 17 | com.walmartlabs.concord 18 | concord-sdk 19 | provided 20 | 21 | 22 | com.walmartlabs.concord.runtime.v2 23 | concord-runtime-sdk-v2 24 | provided 25 | 26 | 27 | javax.inject 28 | javax.inject 29 | provided 30 | 31 | 32 | com.fasterxml.jackson.core 33 | jackson-databind 34 | provided 35 | 36 | 37 | 38 | junit 39 | junit 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /tasks/xml/src/test/resources/test_external.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]> 5 | &xxe; 6 | -------------------------------------------------------------------------------- /tasks/zoom/examples/send_message/README.md: -------------------------------------------------------------------------------- 1 | # Running 2 | 3 | - start the process by running: 4 | ``` 5 | $ ./run.sh concord.example.com:8001 6 | ``` 7 | -------------------------------------------------------------------------------- /tasks/zoom/examples/send_message/concord.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | dependencies: 3 | - "mvn://com.walmartlabs.concord.plugins:zoom-task:1.18.0" 4 | 5 | flows: 6 | default: 7 | - task: zoom 8 | in: 9 | action: sendMessage 10 | channelId: "myZoomChannelId" 11 | headText: "Hello to concord world" 12 | bodyText: "Hello everyone" 13 | ignoreErrors: true 14 | 15 | - log: "Result status is ${result.ok}" 16 | - if: "${!result.ok}" 17 | then: 18 | - throw: "Error while sending a message: ${result.error}" 19 | else: 20 | - log: "Data: ${result.data}" 21 | -------------------------------------------------------------------------------- /tasks/zoom/examples/send_message/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVER_ADDR="$1" 4 | 5 | rm -rf target && mkdir target 6 | cp concord.yml test.yml target/ 7 | 8 | cd target && zip -r payload.zip ./* > /dev/null && cd .. 9 | 10 | read -p "Username: " CURL_USER 11 | curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR}/api/v1/process 12 | -------------------------------------------------------------------------------- /tasks/zoom/src/main/java/com/walmartlabs/concord/plugins/zoom/Constants.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.zoom; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2019 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | public class Constants { 24 | 25 | public static final int DEFAULT_CONNECT_TIMEOUT = 30_000; 26 | public static final int DEFAULT_SO_TIMEOUT = 30_000; 27 | public static final int DEFAULT_RETRY_COUNT = 5; 28 | 29 | public static final String VAR_ACCESS_TOKEN = "access_token"; 30 | public static final String CHAT_POST_MESSAGE_API = "im/chat/messages"; 31 | 32 | public static final int TOO_MANY_REQUESTS_ERROR = 429; 33 | public static final int ZOOM_SUCCESS_STATUS_CODE = 201; 34 | public static final int DEFAULT_RETRY_AFTER = 1; 35 | public static final int DEFAULT_PROXY_PORT = 9080; 36 | 37 | private Constants() { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tasks/zoom/src/main/java/com/walmartlabs/concord/plugins/zoom/ZoomConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.zoom; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2018 Walmart Inc. 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | 24 | public interface ZoomConfiguration { 25 | 26 | String clientId(); 27 | 28 | String clientSecret(); 29 | 30 | String accountId(); 31 | 32 | String robotJid(); 33 | 34 | String rootApi(); 35 | 36 | String accessTokenApi(); 37 | 38 | String proxyAddress(); 39 | 40 | int proxyPort(); 41 | 42 | int connectTimeout(); 43 | 44 | int soTimeout(); 45 | 46 | int retryCount(); 47 | } 48 | -------------------------------------------------------------------------------- /tasks/zoom/src/main/java/com/walmartlabs/concord/plugins/zoom/v2/ZoomTaskV2.java: -------------------------------------------------------------------------------- 1 | package com.walmartlabs.concord.plugins.zoom.v2; 2 | 3 | /*- 4 | * ***** 5 | * Concord 6 | * ----- 7 | * Copyright (C) 2017 - 2020 Walmart Inc., Concord Authors 8 | * ----- 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * ===== 21 | */ 22 | 23 | import com.walmartlabs.concord.plugins.zoom.Result; 24 | import com.walmartlabs.concord.plugins.zoom.TaskParams; 25 | import com.walmartlabs.concord.plugins.zoom.ZoomTaskCommon; 26 | import com.walmartlabs.concord.runtime.v2.sdk.*; 27 | 28 | import javax.inject.Inject; 29 | import javax.inject.Named; 30 | 31 | @Named("zoom") 32 | @DryRunReady 33 | public class ZoomTaskV2 implements Task { 34 | 35 | private final Context context; 36 | private final ZoomTaskCommon delegate; 37 | 38 | @Inject 39 | public ZoomTaskV2(Context context) { 40 | this.context = context; 41 | this.delegate = new ZoomTaskCommon(context.processConfiguration().dryRun()); 42 | } 43 | 44 | @Override 45 | public TaskResult execute(Variables input) { 46 | Result result = delegate.execute(TaskParams.of(input, context.defaultVariables().toMap())); 47 | return TaskResult.of(result.isOk(), result.getError()) 48 | .value("data", result.getData()); 49 | } 50 | } 51 | --------------------------------------------------------------------------------