AHeise commented on a change in pull request #10460: [FLINK-14574] Fixing writing with plugin s3 filesystem. URL: https://github.com/apache/flink/pull/10460#discussion_r354840849
########## File path: flink-end-to-end-tests/test-scripts/common_s3_minio.sh ########## @@ -0,0 +1,110 @@ +#!/usr/bin/env bash +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +################################################################################ + +# export credentials into environment variables for AWS client +export AWS_REGION=us-east-1 +export AWS_ACCESS_KEY_ID=access_key +export AWS_SECRET_ACCESS_KEY=secret_key + +export IT_CASE_S3_BUCKET=test-data + +export S3_TEST_DATA_WORDS_URI="s3://$IT_CASE_S3_BUCKET/words" + +export S3_OUTPUT_LOCATION="s3://$(basename "$TEST_DATA_DIR")/out/wc_out" + + +################################### +# Starts a docker container for s3 minio. +# +# Globals: +# TEST_INFRA_DIR +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY +# Exports: +# MINIO_CONTAINER_ID +# S3_ENDPOINT +################################### +function s3_start { + echo "Spawning minio for s3 tests" + export MINIO_CONTAINER_ID=$(docker run -d \ + -P \ + --mount type=bind,source="$TEST_INFRA_DIR",target=/data \ + -e "MINIO_ACCESS_KEY=$AWS_ACCESS_KEY_ID" -e "MINIO_SECRET_KEY=$AWS_SECRET_ACCESS_KEY" -e "MINIO_DOMAIN=localhost" \ + minio/minio \ + server \ + /data) + while [[ "$(docker inspect -f {{.State.Running}} "$MINIO_CONTAINER_ID")" -ne "true" ]]; do + sleep 0.1 + done + export S3_ENDPOINT="http://$(docker port "$MINIO_CONTAINER_ID" 9000 | sed s'/0\.0\.0\.0/localhost/')" + echo "Started minio @ $S3_ENDPOINT" + on_exit s3_stop +} + +# always start it while sourcing, so that MINIO_CONTAINER_ID is available from parent script +if [[ $MINIO_CONTAINER_ID ]]; then + aws_cli_stop +fi +s3_start + +################################### +# Stops the docker container of minio. +# +# Globals: +# MINIO_CONTAINER_ID +################################### +function s3_stop { + docker kill "$MINIO_CONTAINER_ID" + docker rm "$MINIO_CONTAINER_ID" + export S3_ENDPOINT= + export MINIO_CONTAINER_ID= +} + +################################### +# Setup Flink s3 access. +# +# Globals: +# FLINK_DIR +# IT_CASE_S3_ACCESS_KEY +# IT_CASE_S3_SECRET_KEY +# Arguments: +# $1 - s3 filesystem type (hadoop/presto) +# Returns: +# None +################################### +function s3_setup { Review comment: No it's meant to be a drop-in replacement. Initially, I was even thinking of using common_s3_minio as a fallback, when not all AWS globals are set. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
