-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from ArcGIS/issue14
#14 Redesigned test workflows
- Loading branch information
Showing
23 changed files
with
254 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
# Copy Container Images from DockerHub to Amazon ECR | ||
# Scripts for Provisioning Container Images in Amazon ECR | ||
|
||
Amazon ECR is a fully managed container registry that provides a secure, scalable, and reliable registry for container images on AWS. | ||
|
||
Script image-copy-ecr copies the ArcGIS Enterprise on Kubernetes container images from Docker Hub to AWS Elastic Container Registry (ECR) repositories in specific AWS account and region. | ||
|
||
## Requirements | ||
|
||
On the machine where the script is run, the following tools must be installed: | ||
On the machine where the scripts are run, the following tools must be installed: | ||
|
||
* [AWS CLI](https://aws.amazon.com/cli/) | ||
* [Docker](https://www.docker.com/) | ||
|
||
The AWS CLI must be configured with the appropriate AWS credentials and region must be set by AWS_DEFAULT_REGION environment variable. | ||
|
||
The DockerHub credentials must be set by environment variables `CONTAINER_REGISTRY_USER` and `CONTAINER_REGISTRY_PASSWORD`. The DockerHub container registry organization must be set by environment variable `CONTAINER_REGISTRY_ORG`. | ||
## build-admin-cli-image.sh | ||
|
||
`ECR_REPOSITORY_PREFIX` environment variable must be set to the prefix of the ECR repository name that matches the value "of ecr_repository_prefix" setting used for the k8s-cluster configuration. | ||
Builds container image for Enterprise Admin CLI and pushes it to private ECR repository in the AWS region. | ||
|
||
```bash | ||
chmod +x ./build-admin-cli-image.sh | ||
./build-admin-cli-image.sh <ECR repository name> <build context path> | ||
``` | ||
|
||
The script requires at least 20GB of free disk space on the machine to temporary store the container images. | ||
## copy-docker-hub-images.sh | ||
|
||
## Usage | ||
Copies ArcGIS Enterprise for Kubernetes images from DockerHub registry to private Amazon ECR repositories in the AWS region. | ||
|
||
The DockerHub credentials must be set by environment variables `CONTAINER_REGISTRY_USER` and `CONTAINER_REGISTRY_PASSWORD`. The DockerHub container registry organization must be set by environment variable `CONTAINER_REGISTRY_ORG`. | ||
|
||
`ECR_REPOSITORY_PREFIX` environment variable must be set to the prefix of the ECR repository name that matches the value "of ecr_repository_prefix" setting used for the k8s-cluster configuration. | ||
|
||
```bash | ||
chmod +x ./copy-docker-hub-images.sh | ||
./copy-docker-hub-images.sh <manifest file path> | ||
``` | ||
|
||
The Esri-published version manifest is a JSON file that contains a list of images for a specific ArcGIS Enterprise on Kubernetes version, which are to be copied to ECR. This manifest file can be downloaded from a URL specified by the VERSION_MANIFEST_URL property in the `arcgis-enterprise/<version>/setup/.install/arcgis-enterprise/arcgis-enterprise.properties` file, located within the ArcGIS Enterprise on Kubernetes setup scripts for that particular version of ArcGIS Enterprise on Kubernetes. | ||
|
||
> The script requires at least 20GB of free disk space on the machine to temporary store the container images. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# This script builds container image for Enterprise Admin CLI and pushes it to | ||
# private ECR repository in the AWS region. | ||
# | ||
# On the machine where the script is executed: | ||
# | ||
# * AWS CLI and Docker must be installed | ||
# * AWS credentials must be configured for AWS CLI | ||
# * AWS region must be specified by AWS_DEFAULT_REGION environment variable | ||
|
||
set -e | ||
|
||
ECR_REPOSITORY_NAME=$1 | ||
BUILD_CONTEXT_PATH=$2 | ||
TAG=0.1.0 | ||
|
||
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
ECR_REGISTRY_URL=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com | ||
IMAGE_TAG=$ECR_REGISTRY_URL/$ECR_REPOSITORY_NAME:$TAG | ||
|
||
aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_REGISTRY_URL | ||
|
||
set +e | ||
|
||
aws ecr describe-repositories --repository-names $ECR_REPOSITORY_NAME | ||
|
||
# Create ECR repository if it does not exist | ||
if [ $? -ne 0 ] | ||
then | ||
aws ecr create-repository --repository-name $ECR_REPOSITORY_NAME --image-scanning-configuration scanOnPush=true --image-tag-mutability IMMUTABLE | ||
echo "ECR repository '${ECR_REPOSITORY_NAME}' created." | ||
else | ||
echo "ECR repository '${ECR_REPOSITORY_NAME}' already exists." | ||
fi | ||
|
||
aws ecr describe-images --repository-name $ECR_REPOSITORY_NAME --image-ids imageTag=$TAG | ||
|
||
# Copy image to the ECR repository if it does not exist | ||
if [[ $? == 0 ]]; then | ||
echo "Image $ECR_REPOSITORY_NAME:$TAG is already in the ECR repository" | ||
else | ||
set -e | ||
|
||
docker build -t $IMAGE_TAG $BUILD_CONTEXT_PATH | ||
docker push $IMAGE_TAG | ||
|
||
echo "Image $ECR_REPOSITORY_NAME:$TAG copied." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.