Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker release process for dbt-postgres #9828

Merged
merged 5 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Fixes-20240327-150013.yaml
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 15 additions & 5 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]];
mikealfare marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -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 }}
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ARG [email protected]
ARG [email protected]
ARG [email protected]
# special case args
ARG dbt_postgres_subdirectory=""
ARG dbt_spark_version=all
ARG dbt_third_party

Expand Down Expand Up @@ -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}"


##
Expand Down Expand Up @@ -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}"