Skip to content

Commit

Permalink
Merge main into dependabot/gradle/projects/control-service/projects/c…
Browse files Browse the repository at this point in the history
…om.palantir.git-version-3.0.0
  • Loading branch information
github-actions[bot] authored Mar 30, 2023
2 parents 366e119 + f79a31a commit 50cd710
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh

# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0

# TODO: replace those as env variables
aws_access_key_id=$1
aws_secret_access_key=$2
Expand All @@ -14,15 +12,14 @@ git_repository=$7
registry_type=$8
registry_username=$9
registry_password=${10}
aws_session_token=${11}

# Echo selected data to be logged
echo "AWS_REGION=$aws_region"
echo "DOCKER_REGISTRY=$docker_registry"
echo "GIT_REPOSITORY=$git_repository"
echo "REGISTRY_TYPE=$registry_type"

mkdir /home/user/.docker

# We default to generic repo.
# We have special support for ECR because
# ECR requires for each image to create separate repository
Expand All @@ -32,15 +29,17 @@ if [ "$registry_type" = "ecr" ] || [ "$registry_type" = "ECR" ] ; then
# Setup credentials to connect to AWS - same creds will be used by kaniko as well.
aws configure set aws_access_key_id $aws_access_key_id
aws configure set aws_secret_access_key $aws_secret_access_key
# Check if aws_session_token is set and not empty.
if [ -n "$aws_session_token" ] ; then
aws configure set aws_session_token "$aws_session_token"
fi

# https://stackoverflow.com/questions/1199613/extract-filename-and-path-from-url-in-bash-script
repository_prefix=${docker_registry#*/}
# Create docker repository if it does not exist
aws ecr describe-repositories --region $aws_region --repository-names $repository_prefix/${DATA_JOB_NAME} ||
aws ecr create-repository --region $aws_region --repository-name $repository_prefix/${DATA_JOB_NAME}

echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json

elif [ "$registry_type" = "generic" ] || [ "$registry_type" = "GENERIC" ]; then
export auth=$(echo -n $registry_username:$registry_password | base64 -w 0)
cat > ~/.docker/config.json <<- EOM
Expand All @@ -55,22 +54,17 @@ cat > ~/.docker/config.json <<- EOM
}
EOM
fi


# Clone repo into /data-jobs dir to get job's source
git_url_scheme="https"
[ "$GIT_SSL_ENABLED" = false ] && git_url_scheme="http"

git clone $git_url_scheme://$git_username:$git_password@$git_repository ./data-jobs
cd ./data-jobs

git reset --hard $GIT_COMMIT || ( echo ">data-job-not-found<" && exit 1 )
if [ ! -d ${DATA_JOB_NAME} ]; then
echo ">data-job-not-found<"
exit 1
fi
cd ..

rootlesskit buildctl-daemonless.sh build \
--frontend \
dockerfile.v0 \
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.2
1.3.3
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh

# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0

# TODO: replace those as env variables
aws_access_key_id=$1
aws_secret_access_key=$2
Expand All @@ -14,13 +12,13 @@ git_repository=$7
registry_type=$8
registry_username=$9
registry_password=${10}
aws_session_token=${11}

# Echo selected data to be logged
echo "AWS_REGION=$aws_region"
echo "DOCKER_REGISTRY=$docker_registry"
echo "GIT_REPOSITORY=$git_repository"
echo "REGISTRY_TYPE=$registry_type"

# We default to generic repo.
# We have special support for ECR because
# even though Kaniko supports building and pushing images to ECR
Expand All @@ -33,15 +31,17 @@ if [ "$registry_type" = "ecr" ] || [ "$registry_type" = "ECR" ] ; then
# Setup credentials to connect to AWS - same creds will be used by kaniko as well.
aws configure set aws_access_key_id $aws_access_key_id
aws configure set aws_secret_access_key $aws_secret_access_key
# Check if aws_session_token is set and not empty.
if [ -n "$aws_session_token" ] ; then
aws configure set aws_session_token "$aws_session_token"
fi

# https://stackoverflow.com/questions/1199613/extract-filename-and-path-from-url-in-bash-script
repository_prefix=${docker_registry#*/}
# Create docker repository if it does not exist
aws ecr describe-repositories --region $aws_region --repository-names $repository_prefix/${DATA_JOB_NAME} ||
aws ecr create-repository --region $aws_region --repository-name $repository_prefix/${DATA_JOB_NAME}

echo '{ "credsStore": "ecr-login" }' > /kaniko/.docker/config.json

elif [ "$registry_type" = "generic" ] || [ "$registry_type" = "GENERIC" ]; then
export auth=$(echo -n $registry_username:$registry_password | base64 -w 0)
cat > /kaniko/.docker/config.json <<- EOM
Expand All @@ -57,12 +57,9 @@ cat > /kaniko/.docker/config.json <<- EOM
EOM
#cat /kaniko/.docker/config.json
fi


# Clone repo into /data-jobs dir to get job's source
git_url_scheme="https"
[ "$GIT_SSL_ENABLED" = false ] && git_url_scheme="http"

git clone $git_url_scheme://$git_username:$git_password@$git_repository ./data-jobs
cd ./data-jobs
git reset --hard $GIT_COMMIT || ( echo ">data-job-not-found<" && exit 1 )
Expand All @@ -71,7 +68,6 @@ if [ ! -d ${DATA_JOB_NAME} ]; then
exit 1
fi
cd ..

# kaniko supports building directly from git repository but as we've cloned it here anyhow
# (to check if job directory exists) there's no need to.
/kaniko/executor \
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
14 changes: 5 additions & 9 deletions projects/control-service/projects/job-builder/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh

# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0

# TODO: replace those as env variables
aws_access_key_id=$1
aws_secret_access_key=$2
Expand All @@ -14,6 +12,7 @@ git_repository=$7
registry_type=$8
registry_username=$9
registry_password=${10}
aws_session_token=${11}

# Within this property docker config should be included to connect to the registry used to pull the image from.
# it should be prefixed with a comma
Expand All @@ -24,7 +23,6 @@ echo "AWS_REGION=$aws_region"
echo "DOCKER_REGISTRY=$docker_registry"
echo "GIT_REPOSITORY=$git_repository"
echo "REGISTRY_TYPE=$registry_type"

# We default to generic repo.
# We have special support for ECR because
# even though Kaniko supports building and pushing images to ECR
Expand All @@ -38,14 +36,16 @@ if [ "$registry_type" = "ecr" ] || [ "$registry_type" = "ECR" ] ; then
aws configure set aws_access_key_id $aws_access_key_id
aws configure set aws_secret_access_key $aws_secret_access_key

# Check if aws_session_token is set and not empty.
if [ -n "$aws_session_token" ] ; then
aws configure set aws_session_token "$aws_session_token"
fi
# https://stackoverflow.com/questions/1199613/extract-filename-and-path-from-url-in-bash-script
repository_prefix=${docker_registry#*/}
# Create docker repository if it does not exist
aws ecr describe-repositories --region $aws_region --repository-names $repository_prefix/${DATA_JOB_NAME} ||
aws ecr create-repository --region $aws_region --repository-name $repository_prefix/${DATA_JOB_NAME}

echo '{ "credsStore": "ecr-login" }' > /kaniko/.docker/config.json

elif [ "$registry_type" = "generic" ] || [ "$registry_type" = "GENERIC" ]; then
export auth=$(echo -n $registry_username:$registry_password | base64 -w 0)
cat > /kaniko/.docker/config.json <<- EOM
Expand All @@ -62,12 +62,9 @@ cat > /kaniko/.docker/config.json <<- EOM
EOM
#cat /kaniko/.docker/config.json
fi


# Clone repo into /data-jobs dir to get job's source
git_url_scheme="https"
[ "$GIT_SSL_ENABLED" = false ] && git_url_scheme="http"

git clone $git_url_scheme://$git_username:$git_password@$git_repository ./data-jobs
cd ./data-jobs
git reset --hard $GIT_COMMIT || ( echo ">data-job-not-found<" && exit 1 )
Expand All @@ -76,7 +73,6 @@ if [ ! -d ${DATA_JOB_NAME} ]; then
exit 1
fi
cd ..

# kaniko supports building directly from git repository but as we've cloned it here anyhow
# (to check if job directory exists) there's no need to.
/kaniko/executor \
Expand Down
2 changes: 1 addition & 1 deletion projects/control-service/projects/job-builder/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1

0 comments on commit 50cd710

Please sign in to comment.