From e7edcceefb5bdb0a09747e2e029a54bd246d138e Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Tue, 16 Feb 2021 09:07:35 +0000 Subject: [PATCH] Remove Ansible and Terraform custom installation scripts Signed-off-by: Takuya Noguchi --- .gitlab-ci.yml | 2 ++ Dockerfile.custom | 13 ------------- README.md | 37 +++++++++++++++++++------------------ scripts/custom-docker-build | 19 ------------------- scripts/install-ansible | 15 --------------- scripts/install-terraform | 13 ------------- 6 files changed, 21 insertions(+), 78 deletions(-) delete mode 100755 scripts/install-ansible delete mode 100755 scripts/install-terraform diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4457505..b2800f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,6 +138,7 @@ sitespeed-gitlab test: *test_build ubi-release test: *test_build www-gitlab-com-2.7 test: *test_build build-git: *test_build +# Used by GitLab: https://gitlab.com/gitlab-org/gitlab/-/blob/13-8-stable-ee/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml terraform test: *test_build # Used by go projects for linting https://gitlab.com/gitlab-org/gitlab/blob/master/doc/development/go_guide/index.md#automatic-linting golangci-lint-alpine test: *test_build @@ -208,6 +209,7 @@ sitespeed-gitlab push: *build_and_deploy ubi-release push: *build_and_deploy www-gitlab-com-2.7 push: *build_and_deploy build-git push: *build_and_deploy +# Used by GitLab: https://gitlab.com/gitlab-org/gitlab/-/blob/13-8-stable-ee/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml terraform push: *build_and_deploy # Used by go projects for linting https://gitlab.com/gitlab-org/gitlab/blob/master/doc/development/go_guide/index.md#automatic-linting golangci-lint-alpine push: *build_and_deploy diff --git a/Dockerfile.custom b/Dockerfile.custom index 0693d6b..b64c91a 100644 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -57,17 +57,6 @@ ARG POSTGRES_VERSION RUN if [ -n "$POSTGRES_VERSION" ] ; then /scripts/install-postgresql $POSTGRES_VERSION; fi -# Ansible -ARG ANSIBLE_VERSION - -RUN if [ -n "$ANSIBLE_VERSION" ] ; then /scripts/install-ansible $ANSIBLE_VERSION; fi - -# Terraform -ARG TERRAFORM_VERSION -ARG TERRAFORM_DOWNLOAD_SHA256 - -RUN if [ -n "$TERRAFORM_VERSION" ] ; then /scripts/install-terraform $TERRAFORM_VERSION $TERRAFORM_DOWNLOAD_SHA256; fi - # GraphicsMagick ARG GRAPHISMAGICK_VERSION ARG GRAPHISMAGICK_DOWNLOAD_URL=https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/${GRAPHISMAGICK_VERSION}/GraphicsMagick-${GRAPHISMAGICK_VERSION}.tar.gz @@ -100,8 +89,6 @@ ENV RUBY_VERSION=${RUBY_VERSION} \ GOLANG_VERSION=${INSTALL_GOLANG_VERSION} \ LFS_VERSION=${LFS_VERSION} \ POSTGRES_VERSION=${POSTGRES_VERSION} \ - ANSIBLE_VERSION=${ANSIBLE_VERSION} \ - TERRAFORM_VERSION=${TERRAFORM_VERSION} \ GRAPHISMAGICK_VERSION=${GRAPHISMAGICK_VERSION} \ DOCKER_VERSION=${DOCKER_VERSION} \ PGBOUNCER_VERSION=${PGBOUNCER_VERSION} diff --git a/README.md b/README.md index 24b4137..a8e5715 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ various parts of GitLab: There are two methods to adding a new image: -1. Use a docker buildfile. +1. Use a Dockerfile. 1. Use a custom image with versioned features. -### Use a docker buildfile +### Use a Dockerfile A bespoke image is one that uses it's own Dockerfile. In the interests of avoiding repetition, it's better to use the custom docker build if possible. @@ -37,34 +37,35 @@ The name is defined as `[feature]-[version]` pairs, separated by `-`. Here are some example build names: -1. `ruby-2.1-git-2.7` -1. `ruby-2.3.3-golang-1.8-git-2.7-chrome-60.0-node-7.1-postgresql-9.6` -1. `ruby-2.4.1-golang-1.8-git-2.7-node-7.1-postgresql-9.6` +1. `ruby-2.7-golang-1.15-git-2.29` +1. `ruby-3.0.0-git-2.29-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.34` +1. `ruby-3.0.0.patched-golang-1.14-git-2.29-lfs-2.9-chrome-87-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.34` -The first pair represents the base image and version. So `ruby-2.1-...` will use the `ruby:2.1` base image, while -`golang-1.8` will use the `golang:1.8` base image. +The first pair represents the base image and version. So `ruby-3.0-...` will use the `ruby:3.0` base image, while +`golang-1.15` will use the `golang:1.15` base image. Each of the following parts represents another feature and version. Available options are: -1. `golang` -1. `git` 1. `chrome` -1. `node` -1. `yarn` -1. `postgres` -1. `terraform` -1. `ansible` +1. `docker` +1. `git` +1. `golang` 1. `graphicsmagick` +1. `lfs` +1. `node` 1. `pgbouncer` +1. `postgresql` +1. `ruby` +1. `yarn` #### Adding a new build -As an example, if you want to add new image for Ruby 2.4 with `git` 2.14 and `golang` 1.9, -the name would be `ruby-2.4-golang-1.9-git-2.14`. +As an example, if you want to add new image for Ruby 3.0 with `git` 2.29 and `golang` 1.15, +the name would be `ruby-3.0-golang-1.15-git-2.29`. -1. Add a test task: `ruby-2.4-golang-1.9-git-2.14 test: *test_custom` -1. Add a new build task: `ruby-2.4-golang-1.9-git-2.14: *build_and_deploy_custom` +1. Add a test task: `ruby-3.0-golang-1.15-git-2.29 test: *test_custom` +1. Add a new build task: `ruby-3.0-golang-1.15-git-2.29 push: *build_and_deploy_custom` #### Pushing a rebuild image diff --git a/scripts/custom-docker-build b/scripts/custom-docker-build index d2e8fd2..35cb5f6 100755 --- a/scripts/custom-docker-build +++ b/scripts/custom-docker-build @@ -173,27 +173,10 @@ function print_postgres_args() { printf -- "--build-arg POSTGRES_VERSION=%s " "$1" } -function print_ansible_args() { - printf -- "--build-arg ANSIBLE_VERSION=%s " "$1" -} - function print_docker_args() { printf -- "--build-arg DOCKER_VERSION=%s " "$1" } -function print_terraform_args() { - case "$1" in - 0.11) - TERRAFORM_VERSION=0.11.7 - TERRAFORM_DOWNLOAD_SHA256=6b8ce67647a59b2a3f70199c304abca0ddec0e49fd060944c26f666298e23418 - ;; - *) echo "Unknown terraform version $1"; exit 1; - esac - - printf -- "--build-arg TERRAFORM_VERSION=%s " "$TERRAFORM_VERSION" - printf -- "--build-arg TERRAFORM_DOWNLOAD_SHA256=%s " "$TERRAFORM_DOWNLOAD_SHA256" -} - function print_graphicsmagick_args() { case "$1" in 1.3.29) @@ -274,8 +257,6 @@ function parse_arguments() { node) print_node_args $version ;; yarn) print_yarn_args $version ;; postgresql) print_postgres_args $version ;; - ansible) print_ansible_args $version ;; - terraform) print_terraform_args $version ;; graphicsmagick) print_graphicsmagick_args $version ;; pgbouncer) print_pgbouncer_args $version ;; *) exit 1;; diff --git a/scripts/install-ansible b/scripts/install-ansible deleted file mode 100755 index dec9bc7..0000000 --- a/scripts/install-ansible +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -xeou pipefail - -ANSIBLE_VERSION=$1 - -apt-get update -apt-get install -y python-pip python-dev - -pip install --no-cache-dir --upgrade cffi -pip install --no-cache-dir "ansible==${ANSIBLE_VERSION}" - -apt-get autoremove -yq -apt-get clean -yqq -rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-terraform b/scripts/install-terraform deleted file mode 100755 index 84c1e20..0000000 --- a/scripts/install-terraform +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -xeou pipefail - -TERRAFORM_VERSION=${1} -TERRAFORM_DOWNLOAD_SHA256=${2} - -TERRAFORM_DOWNLOAD_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" - -curl -fsSL "$TERRAFORM_DOWNLOAD_URL" -o terraform.zip -echo "${TERRAFORM_DOWNLOAD_SHA256} terraform.zip" | sha256sum -c - -unzip -d /usr/local/bin terraform.zip -rm terraform.zip