From 27e9cdf5c59d4bd1a527b6d3ffed95ee805e19ac Mon Sep 17 00:00:00 2001 From: Mila Page Date: Mon, 18 Mar 2024 03:32:54 -0700 Subject: [PATCH 01/10] Add workflow for snowflake and changelog --- .../unreleased/Features-20240318-033136.yaml | 6 ++ .github/workflows/release-internal.yml | 64 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .changes/unreleased/Features-20240318-033136.yaml create mode 100644 .github/workflows/release-internal.yml diff --git a/.changes/unreleased/Features-20240318-033136.yaml b/.changes/unreleased/Features-20240318-033136.yaml new file mode 100644 index 000000000..6176d094d --- /dev/null +++ b/.changes/unreleased/Features-20240318-033136.yaml @@ -0,0 +1,6 @@ +kind: Features +body: ' Add new workflow for internal patch releases' +time: 2024-03-18T03:31:36.425644-07:00 +custom: + Author: versusfacit + Issue: "38" diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml new file mode 100644 index 000000000..dc12e3781 --- /dev/null +++ b/.github/workflows/release-internal.yml @@ -0,0 +1,64 @@ +name: Release internal patch + +on: + workflow_dispatch: + inputs: + version_number: + description: "The release version number (i.e. 1.0.0b1)" + type: string + required: true + sha: + description: "The sha to use (leave empty to use latest on main)" + type: string + required: false + package_test_command: + description: "Package test command" + type: string + default: "python -c \"import dbt.adapters.snowflake\"" + required: true + dbms_name: + description: "The name of the warehouse the adapter connects to." + type: string + default: "snowflake" + required: true + workflow_call: + inputs: + version_number: + description: "The release version number (i.e. 1.0.0b1)" + type: string + required: true + sha: + description: "The sha to use (leave empty to use latest on main)" + type: string + required: false + package_test_command: + description: "Package test command" + type: string + default: "python -c \"import dbt.adapters.snowflake\"" + required: true + dbms_name: + description: "The name of the warehouse the adapter connects to." + type: string + default: "snowflake" + required: true + +defaults: + run: + shell: bash + +env: + PYTHON_TARGET_VERSION: 3.11 + +jobs: + invoke-reusable-workflow: + name: Build and Release Internally + + uses: VersusFacit/dbt-release/.github/workflows/internal-archive-release.yml@main + + with: + version_number: ${{ inputs.version_number }} + package_test_command: ${{ inputs.package_test_command }} + dbms_name: ${{ inputs.dbms_name }} + sha: ${{ inputs.sha }} + + secrets: inherit From 303fd24690875a4ad46f547e7e720885bed0651f Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 18:57:22 -0700 Subject: [PATCH 02/10] Add comments and make fit conventions. --- .github/workflows/release-internal.yml | 44 +++++++++++--------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml index dc12e3781..6e4fbc285 100644 --- a/.github/workflows/release-internal.yml +++ b/.github/workflows/release-internal.yml @@ -1,3 +1,15 @@ +# What? +# +# Tag and release an arbitrary sha. Uploads to an internal archive for further processing. +# +# How? +# +# After checking out and testing the provided sha, the image is built and uploaded. +# +# When? +# +# Manual trigger. + name: Release internal patch on: @@ -21,26 +33,6 @@ on: type: string default: "snowflake" required: true - workflow_call: - inputs: - version_number: - description: "The release version number (i.e. 1.0.0b1)" - type: string - required: true - sha: - description: "The sha to use (leave empty to use latest on main)" - type: string - required: false - package_test_command: - description: "Package test command" - type: string - default: "python -c \"import dbt.adapters.snowflake\"" - required: true - dbms_name: - description: "The name of the warehouse the adapter connects to." - type: string - default: "snowflake" - required: true defaults: run: @@ -51,14 +43,14 @@ env: jobs: invoke-reusable-workflow: - name: Build and Release Internally + name: "Build and Release Internally" - uses: VersusFacit/dbt-release/.github/workflows/internal-archive-release.yml@main + uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@mp/finish_internal_workflow" with: - version_number: ${{ inputs.version_number }} - package_test_command: ${{ inputs.package_test_command }} - dbms_name: ${{ inputs.dbms_name }} - sha: ${{ inputs.sha }} + version_number: "${{ inputs.version_number }}" + package_test_command: "${{ inputs.package_test_command }}" + dbms_name: "${{ inputs.dbms_name }}" + sha: "${{ inputs.sha }}" secrets: inherit From 71add792b673321bf3e7f1bd95efaef133fda56f Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 19:06:54 -0700 Subject: [PATCH 03/10] Add changelog. --- .changes/unreleased/Under the Hood-20240320-190629.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20240320-190629.yaml diff --git a/.changes/unreleased/Under the Hood-20240320-190629.yaml b/.changes/unreleased/Under the Hood-20240320-190629.yaml new file mode 100644 index 000000000..94dc80d10 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240320-190629.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Finalize the snowflake internal release build workflow +time: 2024-03-20T19:06:29.87556-07:00 +custom: + Author: versusfacit + Issue: "38" From d14126ace5c788543459bbbf2811454074145aca Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 19:08:45 -0700 Subject: [PATCH 04/10] reorder input params --- .github/workflows/release-internal.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml index 6e4fbc285..7dcdfb188 100644 --- a/.github/workflows/release-internal.yml +++ b/.github/workflows/release-internal.yml @@ -19,10 +19,6 @@ on: description: "The release version number (i.e. 1.0.0b1)" type: string required: true - sha: - description: "The sha to use (leave empty to use latest on main)" - type: string - required: false package_test_command: description: "Package test command" type: string @@ -33,6 +29,10 @@ on: type: string default: "snowflake" required: true + sha: + description: "The sha to use (leave empty to use latest on main)" + type: string + required: false defaults: run: From 3f82faad70d18375c4dd599f9c0b7c4155cb9e8e Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 19:16:54 -0700 Subject: [PATCH 05/10] Tweaks to input params. --- .github/workflows/release-internal.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml index 7dcdfb188..7b0c83df9 100644 --- a/.github/workflows/release-internal.yml +++ b/.github/workflows/release-internal.yml @@ -19,20 +19,16 @@ on: description: "The release version number (i.e. 1.0.0b1)" type: string required: true + sha: + description: "The ref (sha or branch name) to use" + type: string + default: "main" + required: true package_test_command: description: "Package test command" type: string default: "python -c \"import dbt.adapters.snowflake\"" required: true - dbms_name: - description: "The name of the warehouse the adapter connects to." - type: string - default: "snowflake" - required: true - sha: - description: "The sha to use (leave empty to use latest on main)" - type: string - required: false defaults: run: @@ -50,7 +46,7 @@ jobs: with: version_number: "${{ inputs.version_number }}" package_test_command: "${{ inputs.package_test_command }}" - dbms_name: "${{ inputs.dbms_name }}" + dbms_name: "snowflake" sha: "${{ inputs.sha }}" secrets: inherit From 92b44f51e3a4ac7ecc53331f694db3f8247bd93d Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 19:34:39 -0700 Subject: [PATCH 06/10] Add quotes --- .github/workflows/release-internal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml index 7b0c83df9..70a8ba635 100644 --- a/.github/workflows/release-internal.yml +++ b/.github/workflows/release-internal.yml @@ -49,4 +49,4 @@ jobs: dbms_name: "snowflake" sha: "${{ inputs.sha }}" - secrets: inherit + secrets: "inherit" From fe6bffa09b0d1773e1a058af1c8e744bdc876a64 Mon Sep 17 00:00:00 2001 From: Mila Page Date: Wed, 20 Mar 2024 20:23:24 -0700 Subject: [PATCH 07/10] Add build to valid semver. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 625876e26..9cfe8c32a 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,8 @@ def _get_plugin_version_dict(): _semver = r"""(?P\d+)\.(?P\d+)\.(?P\d+)""" _pre = r"""((?Pa|b|rc)(?P
\d+))?"""
     _nightly = r"""(\.(?P[a-z0-9]+)?)?"""
-    _version_pattern = rf"""version\s*=\s*["']{_semver}{_pre}{_nightly}["']"""
+    _build = r"""(\+build[0-9]+)?"""
+    _version_pattern = rf"""version\s*=\s*["']{_semver}{_pre}{_nightly}{_build}["']"""
     with open(_version_path) as f:
         match = re.search(_version_pattern, f.read().strip())
         if match is None:

From 25d4189cc2944ed10472e0e4454b95f816e5cacf Mon Sep 17 00:00:00 2001
From: Mila Page 
Date: Fri, 22 Mar 2024 13:29:25 -0700
Subject: [PATCH 08/10] Change python version to match Cloud.

---
 .github/workflows/release-internal.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml
index 70a8ba635..5be835d95 100644
--- a/.github/workflows/release-internal.yml
+++ b/.github/workflows/release-internal.yml
@@ -10,7 +10,7 @@
 #
 # Manual trigger.
 
-name: Release internal patch
+name: "Release internal patch"
 
 on:
   workflow_dispatch:
@@ -35,7 +35,7 @@ defaults:
     shell: bash
 
 env:
-  PYTHON_TARGET_VERSION: 3.11
+  PYTHON_TARGET_VERSION: 3.8
 
 jobs:
   invoke-reusable-workflow:

From 0df1cc3e66d4d630ef054d0ffc76dc27a0c426cc Mon Sep 17 00:00:00 2001
From: Mila Page 
Date: Tue, 26 Mar 2024 13:04:21 -0700
Subject: [PATCH 09/10] Finalize workflow.

---
 .../unreleased/Under the Hood-20240320-190629.yaml    |  6 ------
 .github/workflows/release-internal.yml                | 11 ++++-------
 2 files changed, 4 insertions(+), 13 deletions(-)
 delete mode 100644 .changes/unreleased/Under the Hood-20240320-190629.yaml

diff --git a/.changes/unreleased/Under the Hood-20240320-190629.yaml b/.changes/unreleased/Under the Hood-20240320-190629.yaml
deleted file mode 100644
index 94dc80d10..000000000
--- a/.changes/unreleased/Under the Hood-20240320-190629.yaml	
+++ /dev/null
@@ -1,6 +0,0 @@
-kind: Under the Hood
-body: Finalize the snowflake internal release build workflow
-time: 2024-03-20T19:06:29.87556-07:00
-custom:
-  Author: versusfacit
-  Issue: "38"
diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml
index 5be835d95..cd93022f6 100644
--- a/.github/workflows/release-internal.yml
+++ b/.github/workflows/release-internal.yml
@@ -1,10 +1,10 @@
 # What?
 #
-# Tag and release an arbitrary sha. Uploads to an internal archive for further processing.
+# Tag and release an arbitrary ref. Uploads to an internal archive for further processing.
 #
 # How?
 #
-# After checking out and testing the provided sha, the image is built and uploaded.
+# After checking out and testing the provided ref, the image is built and uploaded.
 #
 # When?
 #
@@ -19,7 +19,7 @@ on:
         description: "The release version number (i.e. 1.0.0b1)"
         type: string
         required: true
-      sha:
+      ref:
         description: "The ref (sha or branch name) to use"
         type: string
         default: "main"
@@ -34,9 +34,6 @@ defaults:
   run:
     shell: bash
 
-env:
-  PYTHON_TARGET_VERSION: 3.8
-
 jobs:
   invoke-reusable-workflow:
     name: "Build and Release Internally"
@@ -47,6 +44,6 @@ jobs:
       version_number: "${{ inputs.version_number }}"
       package_test_command: "${{ inputs.package_test_command }}"
       dbms_name: "snowflake"
-      sha: "${{ inputs.sha }}"
+      ref: "${{ inputs.ref }}"
 
     secrets: "inherit"

From c09b7f8eb616ccce99df072a7f97653900fc0681 Mon Sep 17 00:00:00 2001
From: Mila Page 
Date: Tue, 26 Mar 2024 15:39:47 -0700
Subject: [PATCH 10/10] Change branch reference of workflow to main.

---
 .github/workflows/release-internal.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml
index cd93022f6..cff860595 100644
--- a/.github/workflows/release-internal.yml
+++ b/.github/workflows/release-internal.yml
@@ -38,7 +38,7 @@ jobs:
   invoke-reusable-workflow:
     name: "Build and Release Internally"
 
-    uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@mp/finish_internal_workflow"
+    uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@main"
 
     with:
       version_number: "${{ inputs.version_number }}"