Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM 020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre-centos9:202607101511.b527cf7b
FROM 020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre:202609300803.5ae07065-f44
Comment thread
gd-ladislavandel marked this conversation as resolved.
Resolved

ARG RVM_VERSION=stable
ARG JRUBY_VERSION=9.4.12.1

LABEL image_name="GDC LCM Bricks"
LABEL maintainer="LCM <lcm@gooddata.com>"
LABEL git_repository_url="https://github.com/gooddata/gooddata-ruby/"
LABEL parent_image="020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre-centos9:202607101511.b527cf7b"
LABEL parent_image="020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre:202609300803.5ae07065-f44"

# which is required by RVM
RUN yum install -y gcc gcc-c++ which patch make unzip gnupg git maven procps gzip \
RUN yum install -y gcc gcc-c++ which patch make unzip gnupg git maven procps gzip gawk bzip2 \
&& yum clean all \
&& rm -rf /var/cache/yum
&& rm -rf /var/cache/libdnf5

# Install + verify RVM with gpg (https://rvm.io/rvm/security)
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \
Expand Down
8 changes: 4 additions & 4 deletions DockerfileOldImage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM 020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre-centos9:202607101511.b527cf7b
FROM 020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre:202609300803.5ae07065-f44

ARG RVM_VERSION=stable

Expand All @@ -8,12 +8,12 @@ ARG JRUBY_VERSION=9.2.20.0
LABEL image_name="GDC LCM Bricks"
LABEL maintainer="LCM <lcm@gooddata.com>"
LABEL git_repository_url="https://github.com/gooddata/gooddata-ruby/"
LABEL parent_image="020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre-centos9:202607101511.b527cf7b"
LABEL parent_image="020413372491.dkr.ecr.us-east-1.amazonaws.com/tools/gdc-java-11-jre:202609300803.5ae07065-f44"

# which is required by RVM
RUN yum install -y gcc gcc-c++ diffutils curl-minimal which patch make git maven procps \
RUN yum install -y gcc gcc-c++ diffutils curl-minimal which patch make gnupg git maven procps gawk bzip2 \
&& yum clean all \
&& rm -rf /var/cache/yum
&& rm -rf /var/cache/libdnf5

# Install + verify RVM with gpg (https://rvm.io/rvm/security)
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.109
3.7.111
15 changes: 12 additions & 3 deletions lib/gooddata/cloud_resources/redshift/redshift_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,23 @@ def connect
full_url = build_url(@url, @database)
GoodData.logger.info "Setting up connection to Redshift #{full_url}"

# The driver defaults 'user' to the JVM's user.name and reads it before UID,
# so 'user' must be set explicitly or UID is ignored.
prop = java.util.Properties.new
if @authentication['basic']
prop.setProperty('UID', @authentication['basic']['userName'])
prop.setProperty('PWD', @authentication['basic']['password'])
user = @authentication['basic']['userName']
password = @authentication['basic']['password']
prop.setProperty('user', user)
prop.setProperty('UID', user)
prop.setProperty('password', password)
prop.setProperty('PWD', password)
Comment thread
gd-ladislavandel marked this conversation as resolved.
Resolved
else
db_user = @authentication['iam']['dbUser']
prop.setProperty('AccessKeyID', @authentication['iam']['accessKeyId'])
prop.setProperty('SecretAccessKey', @authentication['iam']['secretAccessKey'])
prop.setProperty('DbUser', @authentication['iam']['dbUser'])
prop.setProperty('DbUser', db_user)
prop.setProperty('user', db_user)
prop.setProperty('UID', db_user)
Comment thread
gd-ladislavandel marked this conversation as resolved.
Resolved
end

@connection = com.amazon.redshift.jdbc42.Driver.new.connect(full_url, prop)
Expand Down
70 changes: 70 additions & 0 deletions spec/unit/cloud_resources/redshift/redshift_client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# encoding: UTF-8
Comment thread
gd-ladislavandel marked this conversation as resolved.
Resolved
#
# Copyright (c) 2010-2026 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

if RUBY_PLATFORM =~ /java/
require 'gooddata/cloud_resources/redshift/redshift_client'

describe GoodData::CloudResources::RedshiftClient do
let(:driver) { double('driver') }
let(:driver_class) { double('driver_class', new: driver) }
let(:options) do
{
'redshift_client' => {
'connection' => {
'url' => 'jdbc:redshift://redshift.example.com:5439',
'database' => 'db',
'authentication' => authentication
}
}
}
end

# Driver jars are not on the classpath in unit tests, so stub the Java package chain
before do
allow(Java).to receive_message_chain('com.amazon.redshift.jdbc42.Driver').and_return(driver_class)
end

subject do
client = described_class.new(options)
allow(client).to receive_message_chain('com.amazon.redshift.jdbc42.Driver').and_return(driver_class)
client
end

def connect_properties
received = nil
allow(driver).to receive(:connect) { |_url, props| received = props }
subject.connect
received
end

context 'with basic authentication' do
let(:authentication) { { 'basic' => { 'userName' => 'basic_user', 'password' => 'secret' } } }

it 'sets user and password to the configured values' do
props = connect_properties
expect(props.getProperty('user')).to eq 'basic_user'
expect(props.getProperty('UID')).to eq 'basic_user'
expect(props.getProperty('password')).to eq 'secret'
expect(props.getProperty('PWD')).to eq 'secret'
end
end

context 'with IAM authentication' do
let(:authentication) do
{ 'iam' => { 'accessKeyId' => 'key_id', 'secretAccessKey' => 'secret_key', 'dbUser' => 'iam_user' } }
end

it 'sets user to the configured dbUser' do
props = connect_properties
expect(props.getProperty('user')).to eq 'iam_user'
expect(props.getProperty('UID')).to eq 'iam_user'
expect(props.getProperty('DbUser')).to eq 'iam_user'
expect(props.getProperty('AccessKeyID')).to eq 'key_id'
expect(props.getProperty('SecretAccessKey')).to eq 'secret_key'
end
end
end
end
Loading