Skip to content

Commit b3749dc

Browse files
authored
Merge pull request #2557 from port-labs/PORT-14552-deployment-environment-tags-releases
Port 14552 deployment environment tags releases
2 parents 820286a + 46acf22 commit b3749dc

File tree

11 files changed

+346
-2
lines changed

11 files changed

+346
-2
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
- [`repository`](https://docs.github.com/en/rest/repos/repos#get-a-repository)
22
- [`pull-request`](https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request)
33
- [`file`](/build-your-software-catalog/sync-data-to-catalog/git/github/#ingest-files-from-your-repositories)
4-
4+
- [`environment`](https://docs.github.com/en/rest/deployments/environments#get-an-environment)
5+
- [`deployment`](https://docs.github.com/en/rest/deployments/deployments#get-a-deployment)
6+
- [`releases`](https://docs.github.com/en/rest/releases/releases#list-releases)
7+
- [`tags`](https://docs.github.com/en/rest/repos/repos#list-repository-tags)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<details>
2+
<summary><b>Deployment blueprint (click to expand) </b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "githubDeployment",
7+
"title": "Deployment",
8+
"icon": "Deployment",
9+
"schema": {
10+
"properties": {
11+
"description": {
12+
"title": "Description",
13+
"type": "string"
14+
},
15+
"ref": {
16+
"title": "Ref",
17+
"type": "string"
18+
},
19+
"sha": {
20+
"title": "Sha",
21+
"type": "string"
22+
},
23+
"transientEnvironment": {
24+
"title": "Transient Running Service",
25+
"type": "boolean"
26+
},
27+
"productionEnvironment": {
28+
"title": "Production Running Service",
29+
"type": "boolean"
30+
},
31+
"createdAt": {
32+
"title": "Created At",
33+
"type": "string",
34+
"format": "date-time"
35+
},
36+
"url": {
37+
"title": "URL",
38+
"type": "string",
39+
"icon": "Link",
40+
"format": "url"
41+
}
42+
},
43+
"required": []
44+
},
45+
"mirrorProperties": {},
46+
"calculationProperties": {},
47+
"relations": {
48+
"deployment_environment": {
49+
"title": "Deployment Environment",
50+
"target": "githubRepoEnvironment",
51+
"required": false,
52+
"many": false
53+
}
54+
}
55+
}
56+
```
57+
58+
</details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<details>
2+
3+
<summary><b>Port port-app-config.yml (click to expand)</b></summary>
4+
5+
```yaml showLineNumbers
6+
createMissingRelatedEntities: true
7+
resources:
8+
- kind: repository
9+
selector:
10+
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
11+
port:
12+
entity:
13+
mappings:
14+
identifier: ".name" # The Entity identifier will be the repository name.
15+
title: ".name"
16+
blueprint: '"githubRepository"'
17+
properties:
18+
readme: file://README.md
19+
url: .html_url
20+
defaultBranch: .default_branch
21+
- kind: environment
22+
selector:
23+
query: "true"
24+
port:
25+
entity:
26+
mappings:
27+
identifier: .__repository + "-" + .name
28+
title: .name
29+
blueprint: '"githubRepoEnvironment"'
30+
properties:
31+
url: .html_url
32+
customBranchPolicies: .deployment_branch_policy.custom_branches_policies
33+
protectedBranches: .deployment_branch_policy.protected_branches
34+
createdAt: .created_at
35+
updatedAt: .updated_at
36+
relations:
37+
repository: .__repository
38+
- kind: deployment
39+
selector:
40+
query: "true"
41+
port:
42+
entity:
43+
mappings:
44+
identifier: .__repository + "-" + (.id|tostring)
45+
title: .task + "-" + .environment
46+
blueprint: '"githubDeployment"'
47+
properties:
48+
description: .description
49+
ref: .ref
50+
sha: .sha
51+
productionEnvironment: .production_environment
52+
transientEnvironment: .transient_environment
53+
createdAt: .created_at
54+
url: .url
55+
relations:
56+
deployment_environment: .__repository + "-" + .environment
57+
```
58+
59+
</details>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<details>
2+
<summary><b>Deployment Environment blueprint (click to expand)</b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "githubRepoEnvironment",
7+
"title": "Deployment Environments",
8+
"icon": "Environment",
9+
"schema": {
10+
"properties": {
11+
"url": {
12+
"icon": "DefaultProperty",
13+
"title": "URL",
14+
"type": "string",
15+
"format": "url"
16+
},
17+
"createdAt": {
18+
"title": "Created At",
19+
"type": "string",
20+
"format": "date-time",
21+
"icon": "DefaultProperty"
22+
},
23+
"updatedAt": {
24+
"title": "Updated At",
25+
"type": "string",
26+
"format": "date-time"
27+
},
28+
"protectedBranches": {
29+
"title": "Protected Branches",
30+
"type": "boolean"
31+
},
32+
"customBranchPolicies": {
33+
"title": "Custom Branch Policies",
34+
"type": "boolean"
35+
}
36+
},
37+
"required": []
38+
},
39+
"mirrorProperties": {},
40+
"calculationProperties": {},
41+
"relations": {
42+
"repository": {
43+
"target": "githubRepository",
44+
"required": true,
45+
"many": false
46+
}
47+
}
48+
}
49+
```
50+
51+
</details>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<details>
2+
<summary><b>Release blueprint (click to expand)</b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "githubRelease",
7+
"title": "Release",
8+
"icon": "Github",
9+
"schema": {
10+
"properties": {
11+
"release_creation_time": {
12+
"icon": "DefaultProperty",
13+
"type": "string",
14+
"title": "Release creation time",
15+
"format": "date-time"
16+
},
17+
"author": {
18+
"type": "string",
19+
"title": "Author"
20+
},
21+
"description": {
22+
"type": "string",
23+
"title": "Description"
24+
}
25+
},
26+
"required": []
27+
},
28+
"mirrorProperties": {},
29+
"calculationProperties": {},
30+
"aggregationProperties": {},
31+
"relations": {
32+
"repository": {
33+
"title": "Repository",
34+
"target": "githubRepository",
35+
"required": false,
36+
"many": false
37+
},
38+
"tag": {
39+
"title": "Tag",
40+
"target": "githubTag",
41+
"required": false,
42+
"many": false
43+
}
44+
}
45+
}
46+
```
47+
48+
</details>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<details>
2+
3+
<summary><b> Port port-app-config.yml (click to expand)</b></summary>
4+
5+
```yaml showLineNumbers
6+
resources:
7+
- kind: repository
8+
selector:
9+
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
10+
port:
11+
entity:
12+
mappings:
13+
identifier: ".name" # The Entity identifier will be the repository name.
14+
title: ".name"
15+
blueprint: '"githubRepository"'
16+
properties:
17+
readme: file://README.md
18+
url: .html_url
19+
defaultBranch: .default_branch
20+
- kind: tag
21+
selector:
22+
query: 'true'
23+
port:
24+
entity:
25+
mappings:
26+
identifier: .name
27+
title: .name
28+
blueprint: '"githubTag"'
29+
properties:
30+
commit_sha: .commit.sha
31+
relations:
32+
repository: .__repository
33+
- kind: release
34+
selector:
35+
query: 'true'
36+
port:
37+
entity:
38+
mappings:
39+
identifier: .name
40+
title: .name
41+
blueprint: '"githubRelease"'
42+
properties:
43+
author: .author.login
44+
description: .body
45+
release_creation_time: .created_at
46+
relations:
47+
tag: .tag_name
48+
repository: .__repository
49+
```
50+
51+
</details>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<details>
2+
<summary><b>Tag blueprint (click to expand)</b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "githubTag",
7+
"title": "Tag",
8+
"icon": "Github",
9+
"schema": {
10+
"properties": {
11+
"commit_sha": {
12+
"icon": "DefaultProperty",
13+
"type": "string",
14+
"title": "Commit sha"
15+
}
16+
},
17+
"required": []
18+
},
19+
"mirrorProperties": {},
20+
"calculationProperties": {},
21+
"aggregationProperties": {},
22+
"relations": {
23+
"repository": {
24+
"title": "Repository",
25+
"target": "githubRepository",
26+
"required": false,
27+
"many": false
28+
}
29+
}
30+
}
31+
```
32+
33+
</details>

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/examples.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import PRBlueprint from './\_github_exporter_example_pull_request_blueprint.mdx'
77
import PortAppConfig from './\_github_exporter_example_port_app_config.mdx'
88
import GitHubResources from '../\_github_exporter_supported_resources.mdx'
99

10+
import RepoEnvironmentBlueprint from './example-deployments-environments/\_github_exporter_example_environment_blueprint.mdx'
11+
import DeploymentBlueprint from './example-deployments-environments/\_github_exporter_example_deployment_blueprint.mdx'
12+
import PortRepoDeploymentAndEnvironmentAppConfig from './example-deployments-environments/\_github_exporter_example_deployments_and_environments_port_app_config.mdx'
13+
14+
import TagBlueprint from './example-repository-release-tag/\_github_exporter_example_tag_blueprint.mdx'
15+
import ReleaseBlueprint from './example-repository-release-tag/\_github_exporter_example_release_blueprint.mdx'
16+
import RepositoryTagReleaseAppConfig from './example-repository-release-tag/\_github_exporter_example_release_tag_port_app_config.mdx'
17+
1018
import PackageBlueprint from './example-file-kind/\_example_package_blueprint.mdx'
1119
import PackageAppConfig from './example-file-kind/\_package_json_app_config.mdx'
1220
import FileBlueprint from './example-file-kind/\_example_file_blueprint.mdx'
@@ -48,6 +56,7 @@ The following example demonstrates ingestion of dependencies from a `package.jso
4856
The example will parse the `package.json` file in your repository and extract the dependencies into Port entities.
4957
For more information about ingesting files and file contents, click [here](/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/#ingest-files-from-your-repositories).
5058

59+
5160
## Map Files and Repositories
5261

5362
The following example demonstrates mapping files to repository.
@@ -57,6 +66,29 @@ The following example demonstrates mapping files to repository.
5766
<RepoFileAppConfig />
5867

5968

69+
## Map repositories, deployments and environments
70+
71+
The following example demonstrates how to ingest your GitHub repositories, their deployments and environments to Port, you may use the following Port blueprint definitions and `port-app-config.yml`:
72+
73+
<RepositoryBlueprint/>
74+
75+
<RepoEnvironmentBlueprint/>
76+
77+
<DeploymentBlueprint/>
78+
79+
<PortRepoDeploymentAndEnvironmentAppConfig/>
80+
81+
## Map repositories, repository releases and tags
82+
83+
The following example demonstrates how to ingest your GitHub repositories, their releases and tags to Port, you may use the following Port blueprint definitions and `port-app-config.yml`:
84+
85+
<RepositoryBlueprint/>
86+
87+
<TagBlueprint/>
88+
89+
<ReleaseBlueprint/>
90+
91+
<RepositoryTagReleaseAppConfig/>
6092

6193
## Map supported resources
6294

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/installation/github-app.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ This page outlines the following steps:
4646
- Contents: Readonly (for reading port configuration files and repository files).
4747
- Metadata: Readonly.
4848
- Pull Request: Readonly
49+
- Deployments: Readonly
50+
- Environments: Readonly
4951
- **Organization Permissions:**
5052
- Webhooks: Read and Write (to allow the integration create webhook).
5153

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/installation/installation.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ To create a personal access token see Github's [managing your personal access to
4747
- **Content**: Readonly
4848
- **Metadata**: Readonly
4949
- **Pull Requests**: Readonly
50+
- **Deployments**: Readonly
51+
- **Environments**: Readonly
5052

5153
**Organization permissions:**
5254
- **Webhooks**: Read and Write (for managing webhook)

0 commit comments

Comments
 (0)