Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Onboard Google Cloud Release Notes dataset (#133)
* feat: Adds a pipeline for Google Cloud Release Notes. * revised YAML config files * actuate Terraform * generate DAG * fixed yamllint errors Co-authored-by: Adler Santos <adlersantos@google.com>
- Loading branch information
1 parent
47b4717
commit 5c98c05
Showing
7 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
datasets/google_cloud_release_notes/_terraform/google_cloud_release_notes_dataset.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
resource "google_bigquery_dataset" "google_cloud_release_notes" { | ||
dataset_id = "google_cloud_release_notes" | ||
project = var.project_id | ||
description = "This dataset contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product\u0027s documentation and also in a filterable format at https://console.cloud.google.com/release-notes." | ||
} | ||
|
||
output "bigquery_dataset-google_cloud_release_notes-dataset_id" { | ||
value = google_bigquery_dataset.google_cloud_release_notes.dataset_id | ||
} |
28 changes: 28 additions & 0 deletions
28
datasets/google_cloud_release_notes/_terraform/provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
provider "google" { | ||
project = var.project_id | ||
impersonate_service_account = var.impersonating_acct | ||
region = var.region | ||
} | ||
|
||
data "google_client_openid_userinfo" "me" {} | ||
|
||
output "impersonating-account" { | ||
value = data.google_client_openid_userinfo.me.email | ||
} |
39 changes: 39 additions & 0 deletions
39
datasets/google_cloud_release_notes/_terraform/release_notes_pipeline.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
resource "google_bigquery_table" "release_notes" { | ||
project = var.project_id | ||
dataset_id = "google_cloud_release_notes" | ||
table_id = "release_notes" | ||
|
||
description = "This table contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product\u0027s documentation and also in a filterable format at https://console.cloud.google.com/release-notes." | ||
|
||
|
||
|
||
|
||
depends_on = [ | ||
google_bigquery_dataset.google_cloud_release_notes | ||
] | ||
} | ||
|
||
output "bigquery_table-release_notes-table_id" { | ||
value = google_bigquery_table.release_notes.table_id | ||
} | ||
|
||
output "bigquery_table-release_notes-id" { | ||
value = google_bigquery_table.release_notes.id | ||
} |
23 changes: 23 additions & 0 deletions
23
datasets/google_cloud_release_notes/_terraform/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
variable "project_id" {} | ||
variable "bucket_name_prefix" {} | ||
variable "impersonating_acct" {} | ||
variable "region" {} | ||
variable "env" {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
dataset: | ||
name: google_cloud_release_notes | ||
friendly_name: ~ | ||
description: ~ | ||
dataset_sources: ~ | ||
terms_of_use: ~ | ||
|
||
resources: | ||
- type: bigquery_dataset | ||
dataset_id: google_cloud_release_notes | ||
description: "This dataset contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product's documentation and also in a filterable format at https://console.cloud.google.com/release-notes." |
47 changes: 47 additions & 0 deletions
47
datasets/google_cloud_release_notes/release_notes/pipeline.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
resources: | ||
- type: bigquery_table | ||
table_id: release_notes | ||
description: "This table contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product's documentation and also in a filterable format at https://console.cloud.google.com/release-notes." | ||
|
||
dag: | ||
airflow_version: 1 | ||
initialize: | ||
dag_id: release_notes | ||
default_args: | ||
owner: "Google" | ||
depends_on_past: False | ||
start_date: '2021-08-05' | ||
max_active_runs: 1 | ||
schedule_interval: "0 5 * * *" # run daily at 5am | ||
catchup: False | ||
default_view: graph | ||
|
||
tasks: | ||
- operator: "BigQueryToBigQueryOperator" | ||
description: "Task to run a BQ to BQ operator" | ||
|
||
args: | ||
task_id: "google_cloud_release_notes" | ||
source_project_dataset_tables: ["{{ var.json.google_cloud_release_notes.release_notes.source_project_dataset_table }}"] | ||
destination_project_dataset_table: "{{ var.json.google_cloud_release_notes.release_notes.destination_project_dataset_table }}" | ||
impersonation_chain: "{{ var.json.google_cloud_release_notes.service_account }}" | ||
write_disposition: "WRITE_TRUNCATE" | ||
gcp_conn_id: "google_cloud_release_notes_conn" | ||
|
||
graph_paths: | ||
- "google_cloud_release_notes" |
47 changes: 47 additions & 0 deletions
47
datasets/google_cloud_release_notes/release_notes/release_notes_dag.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from airflow import DAG | ||
from airflow.contrib.operators import bigquery_to_bigquery | ||
|
||
default_args = { | ||
"owner": "Google", | ||
"depends_on_past": False, | ||
"start_date": "2021-08-05", | ||
} | ||
|
||
|
||
with DAG( | ||
dag_id="google_cloud_release_notes.release_notes", | ||
default_args=default_args, | ||
max_active_runs=1, | ||
schedule_interval="0 5 * * *", | ||
catchup=False, | ||
default_view="graph", | ||
) as dag: | ||
|
||
# Task to run a BQ to BQ operator | ||
google_cloud_release_notes = bigquery_to_bigquery.BigQueryToBigQueryOperator( | ||
task_id="google_cloud_release_notes", | ||
source_project_dataset_tables=[ | ||
"{{ var.json.google_cloud_release_notes.release_notes.source_project_dataset_table }}" | ||
], | ||
destination_project_dataset_table="{{ var.json.google_cloud_release_notes.release_notes.destination_project_dataset_table }}", | ||
impersonation_chain="{{ var.json.google_cloud_release_notes.service_account }}", | ||
write_disposition="WRITE_TRUNCATE", | ||
gcp_conn_id="google_cloud_release_notes_conn", | ||
) | ||
|
||
google_cloud_release_notes |