### Local Development Setup Source: https://github.com/apache/devlake/blob/main/AGENTS.md Commands to start local dependencies (MySQL, Grafana) and the DevLake server and UI. ```bash docker-compose -f docker-compose-dev.yml up mysql grafana # Start deps make dev # Run server on :8080 cd config-ui && yarn && yarn start # UI on :4000 ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/apache/devlake/blob/main/config-ui/README.md Installs all necessary package dependencies for the project. This command must be run before starting the UI. ```bash yarn ``` -------------------------------- ### Copy Environment Example Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/Q_DEV_deploy_guide.md Copy the example environment configuration file to a local file named .env for customization. ```bash cp env.example .env ``` -------------------------------- ### GitHub Copilot Plugin Blueprint Example Source: https://github.com/apache/devlake/blob/main/backend/plugins/gh-copilot/README.md Example blueprint configuration for the GitHub Copilot plugin. Ensure 'connectionId' and 'scopeId' are set correctly for your setup. This blueprint should be run daily to keep metrics updated. ```json [ [ { "plugin": "gh-copilot", "options": { "connectionId": 1, "scopeId": "octodemo" } } ] ] ``` -------------------------------- ### Get All Blueprints Response Source: https://github.com/apache/devlake/blob/main/backend/server/api/README.md Example response when retrieving a list of all blueprints. Each blueprint object contains its configuration details. ```json { "id": 7, "createdAt": "2022-03-27T10:16:20.046+08:00", "updatedAt": "2022-03-27T10:16:20.046+08:00", "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "owner": "merico-dev", "repo": "lake" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` -------------------------------- ### Start DevLake Configuration UI Source: https://github.com/apache/devlake/wiki/QA-Release-Plan Start the configuration UI using Docker Compose to set up environment variables. ```sh docker-compose up config-ui ``` -------------------------------- ### Install Plugin Dependencies (RefDiff) Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/Q_DEV_deploy_guide.md Navigate to the backend directory and install Go packages required for plugins like RefDiff. ```bash cd backend go get cd .. ``` -------------------------------- ### Integration Testing Example Source: https://github.com/apache/devlake/blob/main/AGENTS.md Demonstrates how to set up an in-memory DevLake server for integration testing using the Go test client. ```go helper.ConnectLocalServer(t, &helper.LocalClientConfig{ ServerPort: 8080, DbURL: "mysql://merico:merico@127.0.0.1:3306/lake", CreateServer: true, Plugins: []plugin.PluginMeta{gitlab.Gitlab{}}, }) ``` -------------------------------- ### Plugin Structure Example Source: https://github.com/apache/devlake/blob/main/AGENTS.md Illustrates the typical directory layout for a Go plugin within the Apache DevLake backend. ```go api/ # REST endpoints (connections, scopes, scope-configs) impl/ # Plugin implementation (implements core interfaces) models/ # Tool layer models + migrationscripts/ tasks/ # Collectors, Extractors, Converters e2e/ # Integration tests with CSV fixtures ``` -------------------------------- ### Start Development Server Source: https://github.com/apache/devlake/blob/main/config-ui/README.md Starts the React development server. Ensure the DevLake API is running before executing this command to avoid offline mode. ```bash yarn start ``` -------------------------------- ### Subtask Registration Example Source: https://github.com/apache/devlake/blob/main/AGENTS.md Shows how to register a subtask within the plugin's task execution flow using the `init()` function and `plugin.SubTaskMeta`. ```go // 1. Register subtask in tasks/register.go via init() func init() { RegisterSubtaskMeta(&CollectIssuesMeta) } // 2. Define dependencies for execution order var CollectIssuesMeta = plugin.SubTaskMeta{ Name: "Collect Issues", Dependencies: []*plugin.SubTaskMeta{}, // or reference other metas } ``` -------------------------------- ### Install Python Dependencies with Poetry Source: https://github.com/apache/devlake/blob/main/backend/python/DevelopmentSetup.md Install project dependencies using Poetry. Run this command in the respective Python project directories. ```bash cd backend/python/pydevlake && poetry install ``` ```bash cd backend/python/plugins/azuredevops && poetry install ``` -------------------------------- ### Example Jira Sprint Value (Query String) Source: https://github.com/apache/devlake/wiki/Jira-Integration Presents a query string format for Jira sprint values, specifying parameters like name, start, and end dates. ```string jira.subdomain.sprint[name=sprint 1,start=2021-01-01,end=2021-01-10] ``` -------------------------------- ### Run DevLake and Config-UI in Development Mode Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/Q_DEV_deploy_guide.md Run the DevLake backend with the 'q_dev' plugin and the config-ui frontend in development mode. Install poetry if not already present. The config-ui will be accessible on localhost:4000. ```bash # Install poetry, follow the guide: https://python-poetry.org/docs/#installation # Run devlake, only using the q dev plugin here DEVLAKE_PLUGINS=q_dev nohup make dev & # Run config-ui make configure-dev ``` -------------------------------- ### Clone DevLake Repository Source: https://github.com/apache/devlake/wiki/QA-Release-Plan Clone the DevLake repository and copy the example environment file to set up local configuration. ```sh git clone https://github.com/merico-dev/lake.git devlake cd devlake cp .env.example .env ``` -------------------------------- ### Create Blueprint Response Source: https://github.com/apache/devlake/blob/main/backend/server/api/README.md Example response after successfully creating a blueprint. It includes the assigned ID and creation timestamps. ```json { "id": 7, "createdAt": "2022-03-27T10:16:20.046+08:00", "updatedAt": "2022-03-27T10:16:20.046+08:00", "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "owner": "merico-dev", "repo": "lake" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` -------------------------------- ### Example Jira Sprint Value (Object) Source: https://github.com/apache/devlake/wiki/Jira-Integration Demonstrates a structured object representation for a Jira sprint value, including name, start, and end dates. ```json { name: 'Sprint 1', start: '2021-01-01', end: '2021-01-10' } ``` -------------------------------- ### Example Jira Sprint Value (String) Source: https://github.com/apache/devlake/wiki/Jira-Integration Shows a simple string representation for a Jira sprint value. ```string Sprint 1 ``` -------------------------------- ### Push API Endpoint Example Source: https://github.com/apache/devlake/blob/main/backend/server/api/push/README.md Illustrates the POST request format for the Push API endpoint, specifying the table name in the URL. ```bash POST to localhost:8080/push/:tableName ``` -------------------------------- ### Run Docker Compose Source: https://github.com/apache/devlake/wiki/FAQ Use this command to start Apache DevLake services in detached mode. M1 Mac users may encounter issues and should refer to Docker's documentation for specific setup. ```bash docker-compose up -d ``` -------------------------------- ### Example Domain Layer Issue Initialization Source: https://github.com/apache/devlake/blob/main/backend/core/models/domainlayer/README.md Demonstrates how to initialize an Issue domain entity with a unique `Id` and `BoardId`. The `Id` follows the specified format, incorporating plugin and primary key information from the origin record. ```go issue := Issue { Id: "jira:JiraIssues:1:10", BoardId: "jira:JiraBoard:1:10" ... } ``` -------------------------------- ### Implement Trivial Model Conversion Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Implement the `convert` method to transform a `ToolUser` model into a `DomainUser` model. This example shows a direct mapping when models align. ```python def convert(self, user: ToolUser, context: Context) -> Iterable[DomainUser]: yield DomainUser( id=user.id, name=user.name email=user.email ) ``` -------------------------------- ### Start MySQL and Grafana Containers Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/Q_DEV_deploy_guide.md Start the MySQL and Grafana Docker containers in detached mode using the provided docker-compose file. Ensure the Docker daemon is running. ```bash docker-compose -f docker-compose-dev.yml up -d mysql grafana ``` -------------------------------- ### Push API JSON Body Example Source: https://github.com/apache/devlake/blob/main/backend/server/api/push/README.md Provides an example of the JSON body structure required for the Push API, which is an array of objects to be inserted. ```json [ { "id": "gitlab...etc", "sha": "osidjfoawehfwh08", "additions": 89, ... } ] ``` -------------------------------- ### Get All Q Developer Connections Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/README.md Retrieve a list of all configured connections for the Q Developer plugin using this curl command. ```bash curl Get 'http://localhost:8080/plugins/q_dev/connections' ``` -------------------------------- ### Build Script for Plugin Source: https://github.com/apache/devlake/blob/main/backend/python/README.md A shell script to install plugin dependencies using Poetry. This should be placed in the root directory of the plugin. ```bash #!/bin/bash cd "$(dirname "$0")" poetry install ``` -------------------------------- ### Build Config-UI Docker Image Locally Source: https://github.com/apache/devlake/wiki/How-to-Release-to-Docker-Hub Builds the Config-UI Docker image locally after installing dependencies and building the production assets. Replace 'x.y.z-test' with the appropriate test tag. ```bash cd config-ui npm i npm run build-production docker build -t mericodev/config-ui:x.y.z-test . ``` -------------------------------- ### Define a Basic API Wrapper Class Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Create a class that inherits from pydevlake.api.API to wrap a REST API. The `users` method demonstrates calling a GET endpoint. ```python from pydevlake.api import API class MyAPI(API): def __init__(self, url: str): self.url = url def users(self): return self.get(f'{self.url}/users') ``` -------------------------------- ### Example Jira Object Value Source: https://github.com/apache/devlake/wiki/Jira-Integration Illustrates the structure of a Jira object type value, which includes an ID, key, and name. ```json { id: 100001, key: 'xx', name: 'jira_name' } ``` -------------------------------- ### Main Function for Debugging Source: https://github.com/apache/devlake/wiki/How-to-enable-a-debugger-in-Go This Go code snippet shows the main function where plugins are loaded. It's a common starting point for setting breakpoints, especially when dealing with issues where breakpoints in plugins are not recognized until after loading. ```go func main() { err := plugins.LoadPlugins(plugins.PluginDir()) if err != nil { panic(err) } api.CreateApiService() println("Hello, lake") } ``` -------------------------------- ### Build Git Extractor Plugin Source: https://github.com/apache/devlake/blob/main/backend/plugins/gitextractor/README.md Builds the Git Extractor plugin using local compiled libgit2. Ensure libgit2 is installed at /usr/local/lib and /usr/local/include. ```bash CGO_LDFLAGS="-L/usr/local/lib -lgit2" CGO_CFLAGS="-I/usr/local/include" go build ./plugins/gitextractor/... 2>&1 | tail -5 ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://github.com/apache/devlake/blob/main/backend/python/DevelopmentSetup.md Use `virtualenv` to create an isolated Python environment, specifying the required Python version. Activate the environment before installing dependencies. ```bash virtualenv -p python3.9 path/to/venv source path/to/venv/bin/activate.sh ``` -------------------------------- ### Displaying Plugin Help Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Run the main plugin script with the --help flag to see available commands and options for testing. ```console poetry run myplugin/main.py --help ``` -------------------------------- ### VS Code Launch Configuration for Debugging Source: https://github.com/apache/devlake/wiki/How-to-enable-a-debugger-in-Go Set up a launch configuration in `.vscode/launch.json` to tell VS Code how to launch the Go debugger. It specifies the entry point (`main.go`) and links to the pre-launch build task. ```json { "version": "0.2.0", "configurations": [ { "name": "Launch Package", "type": "go", "request": "launch", "mode": "debug", "program": "main.go", "preLaunchTask": "build-plugin" } ] } ``` -------------------------------- ### Get Blueprint by ID Source: https://github.com/apache/devlake/blob/main/backend/server/api/README.md Retrieves a specific blueprint by its unique identifier. ```APIDOC ## GET /blueprints/:blueprintId ### Description Retrieves a specific blueprint by its ID. ### Method GET ### Endpoint /blueprints/:blueprintId ### Parameters #### Path Parameters - **blueprintId** (integer) - Required - The ID of the blueprint to retrieve. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the blueprint. - **createdAt** (string) - The timestamp when the blueprint was created. - **updatedAt** (string) - The timestamp when the blueprint was last updated. - **name** (string) - The name of the blueprint. - **tasks** (array) - The tasks defined for the blueprint. - **enable** (boolean) - Indicates if the blueprint is enabled. - **cronConfig** (string) - The cron schedule for the blueprint. #### Response Example ```json { "id": 7, "createdAt": "2022-03-27T10:16:20.046+08:00", "updatedAt": "2022-03-27T10:16:20.046+08:00", "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "owner": "merico-dev", "repo": "lake" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` ``` -------------------------------- ### Build and Push Docker Image Source: https://github.com/apache/devlake/blob/main/devops/docker/alpine-dbt/README.md Set the version tag and build the Docker image locally. Then, push the tagged image to a Docker registry. ```shell export VERSION=0.0.1 docker build -t mericodev/alpine-dbt:$VERSION . docker push mericodev/alpine-dbt:$VERSION ``` -------------------------------- ### Test Production Build Source: https://github.com/apache/devlake/blob/main/config-ui/README.md Builds production assets and runs a local server to emulate a production environment, verifying minified assets. ```bash yarn preview ``` -------------------------------- ### Build Production Assets Source: https://github.com/apache/devlake/blob/main/config-ui/README.md Creates static and minified production assets in the 'dist/' directory. ```bash yarn build ``` -------------------------------- ### Build and Push Docker Image Source: https://github.com/apache/devlake/blob/main/devops/docker/lake-builder/README.md Manually build the Docker image and tag it with a specific version. Then, push the tagged image to the Docker registry. ```shell export VERSION=0.0.11 docker build -t mericodev/lake-builder:$VERSION . docker push mericodev/lake-builder:$VERSION ``` -------------------------------- ### Build Lake Docker Image Locally Source: https://github.com/apache/devlake/wiki/How-to-Release-to-Docker-Hub Builds the Lake Docker image locally from the project root. Replace 'x.y.z-test' with the appropriate test tag. ```bash cd to project root docker build -t mericodev/lake:x.y.z-test . ``` -------------------------------- ### Get Trello Boards Source: https://github.com/apache/devlake/blob/main/backend/plugins/trello/README.md Retrieve a list of all boards associated with a Trello connection using this curl command. Replace `` with your specific connection ID. ```bash curl 'http://localhost:8080/plugins/trello/connections//proxy/rest/1/members/me/boards?fields=name,id' ``` -------------------------------- ### Full DevLake Server Test Function Source: https://github.com/apache/devlake/blob/main/backend/DevelopmentManual.md This Go function sets up and runs an in-memory DevLake server for testing. It configures environment variables, connects to a local server, and specifies plugins to be made available. Use this to create a controlled testing environment. ```go func TestDevlakeServer(t *testing.T) { // set up any environment variable you need for the server here setupEnvironmentVars() _ = helper.ConnectLocalServer(t, &helper.LocalClientConfig{ ServerPort: 8080, DbURL: "mysql://merico:merico@127.0.0.1:3306/lake?charset=utf8mb4&parseTime=True", //DO NOT USE localhost - it breaks Python CreateServer: true, // start an in-memory server TruncateDb: false, // get rid of all existing data in the DevLake database before startup DropDb: false, // drop all tables in the DevLake database before startup Plugins: []plugin.PluginMeta{ // list of plugins to make available to the server. Just create an empty instance of your intended plugin structs (conventionally declared in their respective `impl.go`) github.Github{}, githubGraphql.GithubGraphql{}, gitextractor.GitExtractor{}, // this requires that your host machine has libgit2 installed, otherwise you'll get compilation errors gitlab.Gitlab(""), jenkins.Jenkins{}, webhook.Webhook{}, pagerduty.PagerDuty{}, tapd.Tapd{}, //refdiff.RefDiff{}, // not needed to be specified - already included by default //dora.Dora{}, // not needed to be specified - already included by default //org.Org{}, // not needed to be specified - already included by default }, }) time.Sleep(math.MaxInt) } // example env variables to enable Python-debugging func setupEnvironmentVars() { os.Setenv("USE_PYTHON_DEBUGGER", "pycharm") // The Debug host is your host-IP as seen by the IDE. This is usually just "localhost", but will be different if you're launching your IDE from WSL, // which you'd need if developing on Windows. In that case, it is the IP of the WSL vEthernet network interface (e.g. 192.168.0.1). // Make sure, additionally, that the firewall is not blocking network access to your IDE - inbound/outbound. os.Setenv("PYTHON_DEBUG_HOST", "localhost") os.Setenv("PYTHON_DEBUG_PORT", "32000") } ``` -------------------------------- ### Initialize Schemas for Plugin Migration Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Use the `migration` decorator to define schema initialization scripts. The version number should be a 14-digit timestamp. The `MigrationScriptBuilder` is used to create tables, and a snapshot model should be used for migration. ```python @migration(20230501000001, name="initialize schemas for Plugin") def init_schemas(b: MigrationScriptBuilder): class PluginConnection(Connection): token: SecretStr organization: Optional[str] b.create_tables(PluginConnection) ``` -------------------------------- ### Implement Collect Method with API Wrapper Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Use the custom API wrapper within the `collect` method to fetch data. This example iterates over users returned by the API. ```python from myplugin.api import MyAPI ... def collect(self, state, context) -> Iterable[Tuple[object, dict]]: api = MyAPI(context.connection.url) for user in api.users().json: yield user, state ... ``` -------------------------------- ### Configure libgit2 for E2E Tests Source: https://github.com/apache/devlake/blob/main/backend/test/Readme.md If libgit2 is in a non-standard location, set PKG_CONFIG_PATH and CGO_LDFLAGS to help the test binary locate and load the dynamic library. ```bash export PKG_CONFIG_PATH=/path/to/libgit2/build export CGO_LDFLAGS='-L/path/to/libgit2/build -Wl,-rpath,/path/to/libgit2/build' make e2e-test ``` -------------------------------- ### Build and Development Commands Source: https://github.com/apache/devlake/blob/main/AGENTS.md Common make commands for managing dependencies, building, running, and testing the Apache DevLake project. ```bash # From repo root make dep # Install Go + Python dependencies make build # Build plugins + server make dev # Build + run server make godev # Go-only dev (no Python plugins) make unit-test # Run all unit tests make e2e-test # Run E2E tests # From backend/ make swag # Regenerate Swagger docs (required after API changes) make lint # Run golangci-lint ``` -------------------------------- ### Sample Trigger Configuration JSON Source: https://github.com/apache/devlake/wiki/How-to-use-the-triggers-page This is the overall structure for sending multiple plugin configurations in a single request. It allows for concurrent data collection from different sources. ```json [ [ { "plugin": "jira", "Options": { "boardId": 8, "sourceId": 1 } }, { "plugin": "gitlab", "Options": { "projectId": 8967944 } }, { "plugin": "jenkins", "Options": {} }, { "Plugin": "github", "Options": { "repositoryName": "lake", "owner": "merico-dev" } } ] ] ``` -------------------------------- ### Initialize Test Configuration for Local Execution Source: https://github.com/apache/devlake/blob/main/backend/test/e2e/manual/Readme.md Set the test configuration values within the `init` function of a `*_local_test.go` file. This allows the test helper to access the configuration for manual test runs. ```go package azuredevops import "github.com/apache/incubator-devlake/test/helper" func init() { helper.SetTestConfig(TestConfig{ Org: "???", Project: "???", Token: "??????", }) } // Your custom test cases (optional) ``` -------------------------------- ### Create Trello Data Collection Pipeline Source: https://github.com/apache/devlake/blob/main/backend/plugins/trello/README.md This curl command demonstrates how to set up a pipeline to collect data from Trello. Ensure you provide a valid connection ID and board ID. ```bash curl 'http://localhost:8080/pipelines' \ --header 'Content-Type: application/json' \ --data-raw ' { "name":"MY PIPELINE", "plan":[ [ { "plugin":"trello", "options":{ "connectionId":, "boardId":"" } } ] ] } ' ``` -------------------------------- ### Create and Push Git Tag for Release Source: https://github.com/apache/devlake/blob/main/devops/docker/lake-builder/README.md Create a Git tag following the 'builder-v#.#.#' pattern to trigger an automated GitHub workflow. Push the tag to origin to initiate the build and push process to the Docker registry. ```shell git tag builder-v0.0.11 ``` ```shell git push origin --tag builder-v0.0.11 ``` -------------------------------- ### Run Data Collection and Enrichment Script Source: https://github.com/apache/devlake/wiki/QA-Release-Plan Execute the pm.sh script to initiate data collection and enrichment. This process can take approximately 30 minutes. ```sh ./scripts/pm.sh ``` -------------------------------- ### Create Blueprint Source: https://github.com/apache/devlake/blob/main/backend/server/api/README.md Creates a new blueprint with a specified name, tasks, and cron schedule. The cronConfig follows the standard crontab format. ```APIDOC ## POST /blueprints ### Description Creates a new blueprint. ### Method POST ### Endpoint /blueprints ### Parameters #### Request Body - **name** (string) - Required - The name of the blueprint. - **tasks** (array) - Required - An array of task arrays, where each task is an object defining the plugin and its options. - **enable** (boolean) - Required - Whether the blueprint is enabled. - **cronConfig** (string) - Required - The cron schedule for the blueprint in crontab format (e.g., "M H D M WD"). ### Request Example ```json { "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "repo": "lake", "owner": "merico-dev" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the created blueprint. - **createdAt** (string) - The timestamp when the blueprint was created. - **updatedAt** (string) - The timestamp when the blueprint was last updated. - **name** (string) - The name of the blueprint. - **tasks** (array) - The tasks defined for the blueprint. - **enable** (boolean) - Indicates if the blueprint is enabled. - **cronConfig** (string) - The cron schedule for the blueprint. #### Response Example ```json { "id": 7, "createdAt": "2022-03-27T10:16:20.046+08:00", "updatedAt": "2022-03-27T10:16:20.046+08:00", "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "owner": "merico-dev", "repo": "lake" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` ``` -------------------------------- ### Testing a Plugin Standalone Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Execute plugin commands like 'collect', 'extract', or 'convert' with a JSON context and stream name. Redirect file descriptor 3 to stdout for communication with the Go side. ```console CTX='{"db_url":"sqlite+pysqlite:///:memory:", "connection": {...your connection attrs here...}}' poetry run myplugin/main.py $CTX users 3>&1 ``` -------------------------------- ### Build Grafana Docker Image Locally Source: https://github.com/apache/devlake/wiki/How-to-Release-to-Docker-Hub Builds the Grafana Docker image locally. Replace 'x.y.z-test' with the appropriate test tag. ```bash cd grafana docker build -t mericodev/grafana:x.y.z-test . ``` -------------------------------- ### List Blueprints Source: https://github.com/apache/devlake/blob/main/backend/server/api/README.md Retrieves a list of all configured blueprints. ```APIDOC ## GET /blueprints ### Description Retrieves a list of all blueprints. ### Method GET ### Endpoint /blueprints ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the blueprint. - **createdAt** (string) - The timestamp when the blueprint was created. - **updatedAt** (string) - The timestamp when the blueprint was last updated. - **name** (string) - The name of the blueprint. - **tasks** (array) - The tasks defined for the blueprint. - **enable** (boolean) - Indicates if the blueprint is enabled. - **cronConfig** (string) - The cron schedule for the blueprint. #### Response Example ```json { "id": 7, "createdAt": "2022-03-27T10:16:20.046+08:00", "updatedAt": "2022-03-27T10:16:20.046+08:00", "name": "COLLECT 1648121282469", "tasks": [ [ { "plugin": "github", "options": { "owner": "merico-dev", "repo": "lake" } } ] ], "enable": true, "cronConfig": "103 13 /13 * *" } ``` ``` -------------------------------- ### Push Test Docker Images to Docker Hub Source: https://github.com/apache/devlake/wiki/How-to-Release-to-Docker-Hub Pushes the locally built test images to Docker Hub. Replace 'x.y.z-test' with the actual test tag used during the build. ```bash docker push mericodev/lake:x.y.z-test docker push mericodev/config-ui:x.y.z-test docker push mericodev/grafana:x.y.z-test ``` -------------------------------- ### Create Q Developer Connection Source: https://github.com/apache/devlake/blob/main/backend/plugins/q_dev/README.md Use this curl command to create a new connection for the Q Developer plugin. Replace placeholders with your actual AWS and Identity Center credentials and bucket information. ```bash curl 'http://localhost:8080/plugins/q_dev/connections' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "q_dev_connection", "accessKeyId": "", "secretAccessKey": "", "region": "", "bucket": "", "identityStoreId": "", "identityStoreRegion": "", "rateLimitPerHour": 20000 }' ``` -------------------------------- ### Implement domain_scopes Method Source: https://github.com/apache/devlake/blob/main/backend/python/README.md Returns a list of domain scopes related to a given tool scope. Typically yields a single domain scope. ```python from pydevlake.domain_layer.devops import CicdScope ... class MyPlugin(dl.Plugin): ... def domain_scopes(self, tool_scope: MyPluginToolScope) -> list[dl.DomainScope]: yield CicdScope( name=tool_scope.name, description=tool_scope.description, url=tool_scope.url, ) ``` -------------------------------- ### Build Plugins with Debug Flags Source: https://github.com/apache/devlake/wiki/How-to-enable-a-debugger-in-Go Pass the `-gcflags="all=-N -l"` option when building plugins to include necessary debug symbols. This is crucial for stepping into plugin code during debugging. ```bash scripts/compile-plugins.sh -gcflags="all=-N -l" ``` -------------------------------- ### Load Test Configuration in Test Function Source: https://github.com/apache/devlake/blob/main/backend/test/e2e/manual/Readme.md Use the `helper.GetTestConfig` function to load the defined `TestConfig` struct into your test function. Ensure the `TestConfig` struct is defined in a `models.go` file. ```go cfg := helper.GetTestConfig[TestConfig]() ``` -------------------------------- ### Define Test Configuration Struct Source: https://github.com/apache/devlake/blob/main/backend/test/e2e/manual/Readme.md Define a struct to hold test-specific configuration values like organization, project, and tokens. This struct is loaded at runtime by the test helper. ```go package azuredevops type TestConfig struct { Org string Project string Token string } ``` -------------------------------- ### Push Production Docker Images to Docker Hub Source: https://github.com/apache/devlake/wiki/How-to-Release-to-Docker-Hub Pushes the final production images to Docker Hub. Replace 'x.y.z' with the new production version tag. ```bash docker push mericodev/lake:x.y.z docker push mericodev/config-ui:x.y.z ``` -------------------------------- ### Configure E2E Database URL Source: https://github.com/apache/devlake/blob/main/backend/test/Readme.md Set the E2E_DB_URL environment variable to point to your MySQL test database. Ensure you use '127.0.0.1' instead of 'localhost'. ```bash export E2E_DB_URL='mysql://merico:merico@127.0.0.1:3306/lake_test?charset=utf8mb4&parseTime=True' cd backend go run ./test/init.go make e2e-test ```