diff --git a/ci/configure.sh b/ci/configure.sh new file mode 100755 index 00000000..93cbf43a --- /dev/null +++ b/ci/configure.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +FLY="${FLY_CLI:-fly}" + +"$FLY" -t "${CONCOURSE_TARGET:-stemcells}" set-pipeline \ + -p bosh-aws-light-stemcell-builder \ + -c "$(dirname $0)/pipeline.yml" diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile new file mode 100644 index 00000000..deec0fd5 --- /dev/null +++ b/ci/docker/Dockerfile @@ -0,0 +1,18 @@ +FROM bosh/golang-release + +ARG BOSH_CLI_VERSION +ARG METALINK_VERSION + +RUN apt update; apt -y upgrade; apt-get clean +RUN apt install -y \ + git tar curl wget make ruby unzip qemu-utils python3 python3-pip jq && \ + apt-get clean +RUN pip3 install awscli + +RUN curl -fsL https://github.com/cloudfoundry/bosh-cli/releases/download/v${BOSH_CLI_VERSION}/bosh-cli-${BOSH_CLI_VERSION}-linux-amd64 \ + > /usr/local/bin/bosh \ + && chmod +x /usr/local/bin/bosh + +RUN curl -fsL https://github.com/dpb587/metalink/releases/download/v${METALINK_VERSION}/meta4-${METALINK_VERSION}-linux-amd64 \ + > /usr/local/bin/meta4 \ + && chmod +x /usr/local/bin/meta4 diff --git a/ci/docker/boshcpi.light-stemcell-builder/Dockerfile b/ci/docker/boshcpi.light-stemcell-builder/Dockerfile deleted file mode 100644 index 9ff2e11e..00000000 --- a/ci/docker/boshcpi.light-stemcell-builder/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -FROM ubuntu:22.04 - -ENV BOSH_CLI_VERSION 7.0.1-linux-amd64 -ENV METALINK_VERSION 0.3.0-linux-amd64 -ENV GO_VERSION go1.19.3.linux-amd64 - -RUN apt update; apt -y upgrade; apt-get clean -RUN apt install -y \ - git tar curl wget make ruby unzip qemu-utils python3 python3-pip jq && \ - apt-get clean -RUN pip3 install awscli - -RUN cd /tmp && \ - wget -nv "https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-${BOSH_CLI_VERSION}" && \ - ( \ - echo "808ed5b94c45ac1f5a351ace62f2a93adb6fcf2f689368cbba12b37343f1121e bosh-cli-${BOSH_CLI_VERSION}" | \ - sha256sum -c - \ - ) && \ - mv /tmp/bosh-cli-* /usr/local/bin/bosh && \ - chmod +x /usr/local/bin/bosh - -RUN cd /tmp && \ - wget -nv "https://github.com/dpb587/metalink/releases/download/v0.3.0/meta4-${METALINK_VERSION}" && \ - ( \ - echo "e276ccff74cbe9a85eda17e5955df0b0b06ee68fcdb67d860f691d41b34f65cf meta4-${METALINK_VERSION}" | \ - sha256sum -c - \ - ) && \ - mv /tmp/meta4-* /usr/local/bin/meta4 && \ - chmod +x /usr/local/bin/meta4 - -RUN cd /tmp && \ - wget -nv "https://dl.google.com/go/${GO_VERSION}.tar.gz" && \ - ( \ - echo "74b9640724fd4e6bb0ed2a1bc44ae813a03f1e72a4c76253e2d5c015494430ba ${GO_VERSION}.tar.gz" | \ - sha256sum -c - \ - ) && \ - tar -C /usr/local -xzf go*.tar.gz && \ - rm go*.tar.gz - -ENV GOPATH /opt/go - -ENV PATH /usr/local/go/bin:/opt/go/bin:$PATH - -RUN mkdir /opt/go && go install github.com/onsi/ginkgo/ginkgo@latest diff --git a/ci/docker/boshcpi.light-stemcell-builder/build-image.sh b/ci/docker/boshcpi.light-stemcell-builder/build-image.sh deleted file mode 100755 index daa36077..00000000 --- a/ci/docker/boshcpi.light-stemcell-builder/build-image.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -my_dir="$( cd $(dirname $0) && pwd )" - -DOCKER_IMAGE=${DOCKER_IMAGE:-boshcpi/light-stemcell-builder} - -docker login - -echo "Building docker image..." -docker build -t $DOCKER_IMAGE ${my_dir} - -echo "Pushing docker image to '$DOCKER_IMAGE'..." -docker push $DOCKER_IMAGE diff --git a/ci/pipeline.yml b/ci/pipeline.yml new file mode 100644 index 00000000..5fcd4746 --- /dev/null +++ b/ci/pipeline.yml @@ -0,0 +1,78 @@ +jobs: +- name: build-docker-image + plan: + - in_parallel: + - get: bosh-aws-light-stemcell-builder + - get: golang-release-registry-image + trigger: true + - get: bosh-cli-github-release + trigger: true + params: + globs: + - "no-files-needed" + - get: metalink-github-release + trigger: true + params: + globs: + - "no-files-needed" + - task: build-docker-args + image: golang-release-registry-image + config: + platform: linux + inputs: + - name: bosh-cli-github-release + - name: metalink-github-release + outputs: + - name: docker-build-args + run: + path: sh + args: + - -exc + - | + cat << EOF > docker-build-args/docker-build-args.json + { + "BOSH_CLI_VERSION": "$(cat bosh-cli-github-release/version)", + "METALINK_VERSION": "$(cat metalink-github-release/version)" + } + EOF + + cat docker-build-args/docker-build-args.json + - put: light-stemcell-builder-docker-image + params: + build: bosh-aws-light-stemcell-builder/ci/docker/ + build_args_file: docker-build-args/docker-build-args.json + + +resources: +- name: bosh-aws-light-stemcell-builder + type: git + source: + uri: https://github.com/cloudfoundry/bosh-aws-light-stemcell-builder.git + +- name: light-stemcell-builder-docker-image + type: docker-image + source: + repository: boshcpi/light-stemcell-builder + username: ((dockerhub_username)) + password: ((dockerhub_password)) + +- name: golang-release-registry-image + type: registry-image + source: + repository: bosh/golang-release + username: ((dockerhub_username)) + password: ((dockerhub_password)) + +- name: bosh-cli-github-release + type: github-release + source: + access_token: ((github_public_repo_token)) + owner: cloudfoundry + repository: bosh-cli + +- name: metalink-github-release + type: github-release + source: + access_token: ((github_public_repo_token)) + owner: dpb587 + repository: metalink