From 468ce3a8ac41f38ce89a8dcab52e9f17ee3cc234 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Wed, 27 Mar 2024 14:58:30 -0400 Subject: [PATCH 1/5] allow for dbt-postgres in both <=1.7 and 1.8+ --- .github/workflows/release-docker.yml | 20 +++++++++++++++----- docker/Dockerfile | 5 +++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 63248784fc8..edce5631d23 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -68,10 +68,18 @@ jobs: - name: Get docker build arg id: build_arg run: | - BUILD_ARG_NAME=$(echo ${{ inputs.package }} | sed 's/\-/_/g') - BUILD_ARG_VALUE=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') - echo "name=$BUILD_ARG_NAME" >> $GITHUB_OUTPUT - echo "value=$BUILD_ARG_VALUE" >> $GITHUB_OUTPUT + repo_arg=$(echo ${{ inputs.package }} | sed 's/\-/_/g') + if [[ ${{ inputs.version_number }} < 1.8.0 ]]; + then + repo_value=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') + dbt_postgres_subdirectory="&subdirectory=plugins/postgres" + else + repo_value=${{ inputs.package }} + dbt_postgres_subdirectory="" + fi + echo "repo_arg=$repo_arg" >> $GITHUB_OUTPUT + echo "repo_value=$repo_value" >> $GITHUB_OUTPUT + echo "dbt_postgres_subdirectory=$dbt_postgres_subdirectory" >> $GITHUB_OUTPUT - name: Log in to GHCR uses: docker/login-action@v3 @@ -96,5 +104,7 @@ jobs: file: docker/Dockerfile push: True target: ${{ inputs.package }} - build-args: ${{ steps.build_arg.outputs.name }}_ref=${{ steps.build_arg.outputs.value }}@v${{ inputs.version_number }} + build-args: | + ${{ steps.build_arg.outputs.repo_arg }}_ref=${{ steps.build_arg.outputs.repo_value }}@v${{ inputs.version_number }} + dbt_postgres_subdirectory=${{ steps.build_arg.outputs.dbt_postgres_subdirectory }} tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 8654304dfbc..c492a918983 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,6 +21,7 @@ ARG dbt_bigquery_ref=dbt-bigquery@v1.8.0b1 ARG dbt_snowflake_ref=dbt-snowflake@v1.8.0b1 ARG dbt_spark_ref=dbt-spark@v1.8.0b1 # special case args +ARG dbt_postgres_subdirectory="" ARG dbt_spark_version=all ARG dbt_third_party @@ -62,7 +63,7 @@ RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_ # dbt-postgres ## FROM base as dbt-postgres -RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres" +RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres${dbt_postgres_subdirectory}" ## @@ -130,4 +131,4 @@ RUN apt-get update \ RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_bigquery_ref}#egg=dbt-bigquery" RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_snowflake_ref}#egg=dbt-snowflake" RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_spark_ref}#egg=dbt-spark[${dbt_spark_version}]" - RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres" + RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres${dbt_postgres_subdirectory}" From f3a15191b201cc442e4ad012a9c3ca7c70f1a753 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Wed, 27 Mar 2024 15:00:22 -0400 Subject: [PATCH 2/5] changie --- .changes/unreleased/Fixes-20240327-150013.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Fixes-20240327-150013.yaml diff --git a/.changes/unreleased/Fixes-20240327-150013.yaml b/.changes/unreleased/Fixes-20240327-150013.yaml new file mode 100644 index 00000000000..f988dd5c1ab --- /dev/null +++ b/.changes/unreleased/Fixes-20240327-150013.yaml @@ -0,0 +1,7 @@ +kind: Fixes +body: '"Fix Docker release process to account for both historical and current versions + of `dbt-postgres`' +time: 2024-03-27T15:00:13.388268-04:00 +custom: + Author: mikealfare + Issue: "9827" From ee3a813151e1f714b7d5cbdc8a5e49a9e998a55d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 28 Mar 2024 12:15:12 -0400 Subject: [PATCH 3/5] revert to the 1.7 approach, 1.8 will be handled in the new repo --- .github/workflows/release-docker.yml | 16 +++------------- docker/Dockerfile | 3 +-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index edce5631d23..426998c883f 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -69,17 +69,9 @@ jobs: id: build_arg run: | repo_arg=$(echo ${{ inputs.package }} | sed 's/\-/_/g') - if [[ ${{ inputs.version_number }} < 1.8.0 ]]; - then - repo_value=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') - dbt_postgres_subdirectory="&subdirectory=plugins/postgres" - else - repo_value=${{ inputs.package }} - dbt_postgres_subdirectory="" - fi + repo_value=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') echo "repo_arg=$repo_arg" >> $GITHUB_OUTPUT - echo "repo_value=$repo_value" >> $GITHUB_OUTPUT - echo "dbt_postgres_subdirectory=$dbt_postgres_subdirectory" >> $GITHUB_OUTPUT + echo "repo-value=$repo_value" >> $GITHUB_OUTPUT - name: Log in to GHCR uses: docker/login-action@v3 @@ -104,7 +96,5 @@ jobs: file: docker/Dockerfile push: True target: ${{ inputs.package }} - build-args: | - ${{ steps.build_arg.outputs.repo_arg }}_ref=${{ steps.build_arg.outputs.repo_value }}@v${{ inputs.version_number }} - dbt_postgres_subdirectory=${{ steps.build_arg.outputs.dbt_postgres_subdirectory }} + build-args: ${{ steps.build_arg.outputs.repo-arg }}_ref=${{ steps.build_arg.outputs.repo-value }}@v${{ inputs.version_number }} tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }} diff --git a/docker/Dockerfile b/docker/Dockerfile index c492a918983..6abefbde4c7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,7 +21,6 @@ ARG dbt_bigquery_ref=dbt-bigquery@v1.8.0b1 ARG dbt_snowflake_ref=dbt-snowflake@v1.8.0b1 ARG dbt_spark_ref=dbt-spark@v1.8.0b1 # special case args -ARG dbt_postgres_subdirectory="" ARG dbt_spark_version=all ARG dbt_third_party @@ -63,7 +62,7 @@ RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_ # dbt-postgres ## FROM base as dbt-postgres -RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres${dbt_postgres_subdirectory}" +RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres&subdirectory=plugins/postgres" ## From c52d2794415e25bafcce78f356349e5424f9a69a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 28 Mar 2024 12:16:54 -0400 Subject: [PATCH 4/5] revert to the 1.7 approach, 1.8 will be handled in the new repo --- .github/workflows/release-docker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 426998c883f..63248784fc8 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -68,10 +68,10 @@ jobs: - name: Get docker build arg id: build_arg run: | - repo_arg=$(echo ${{ inputs.package }} | sed 's/\-/_/g') - repo_value=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') - echo "repo_arg=$repo_arg" >> $GITHUB_OUTPUT - echo "repo-value=$repo_value" >> $GITHUB_OUTPUT + BUILD_ARG_NAME=$(echo ${{ inputs.package }} | sed 's/\-/_/g') + BUILD_ARG_VALUE=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') + echo "name=$BUILD_ARG_NAME" >> $GITHUB_OUTPUT + echo "value=$BUILD_ARG_VALUE" >> $GITHUB_OUTPUT - name: Log in to GHCR uses: docker/login-action@v3 @@ -96,5 +96,5 @@ jobs: file: docker/Dockerfile push: True target: ${{ inputs.package }} - build-args: ${{ steps.build_arg.outputs.repo-arg }}_ref=${{ steps.build_arg.outputs.repo-value }}@v${{ inputs.version_number }} + build-args: ${{ steps.build_arg.outputs.name }}_ref=${{ steps.build_arg.outputs.value }}@v${{ inputs.version_number }} tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }} From d3c886e25a720d329cf91973d1b10df07e365021 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 28 Mar 2024 12:17:25 -0400 Subject: [PATCH 5/5] revert to the 1.7 approach, 1.8 will be handled in the new repo --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6abefbde4c7..3264eb8456e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -130,4 +130,4 @@ RUN apt-get update \ RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_bigquery_ref}#egg=dbt-bigquery" RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_snowflake_ref}#egg=dbt-snowflake" RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_spark_ref}#egg=dbt-spark[${dbt_spark_version}]" - RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres${dbt_postgres_subdirectory}" + RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres&subdirectory=plugins/postgres"