From 1dd11c99cc78d2614fc1b0b75af7c08f1f611664 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sun, 6 Jan 2019 00:00:49 +0000 Subject: [PATCH] ci: add linux buildkite tests --- .buildkite/dockerfiles/docker-compose.yml | 4 ++ .buildkite/dockerfiles/linux-env.Dockerfile | 43 ++++++++------------ .buildkite/dockerfiles/linux-test.Dockerfile | 32 +++++++++++++++ .buildkite/pipeline.yml | 27 +++++++++--- .buildkite/provision/linux-buildkite.md | 26 ++++++++++++ 5 files changed, 100 insertions(+), 32 deletions(-) create mode 100644 .buildkite/dockerfiles/linux-test.Dockerfile create mode 100644 .buildkite/provision/linux-buildkite.md diff --git a/.buildkite/dockerfiles/docker-compose.yml b/.buildkite/dockerfiles/docker-compose.yml index a28ee374eb..0d9b2b41f4 100644 --- a/.buildkite/dockerfiles/docker-compose.yml +++ b/.buildkite/dockerfiles/docker-compose.yml @@ -8,3 +8,7 @@ services: build: context: ../../ dockerfile: ./.buildkite/dockerfiles/windows-test.Dockerfile + linux-test: + build: + context: ../../ + dockerfile: ./.buildkite/dockerfiles/linux-test.Dockerfile diff --git a/.buildkite/dockerfiles/linux-env.Dockerfile b/.buildkite/dockerfiles/linux-env.Dockerfile index 6c3ce94c50..cfcc952b48 100644 --- a/.buildkite/dockerfiles/linux-env.Dockerfile +++ b/.buildkite/dockerfiles/linux-env.Dockerfile @@ -1,32 +1,21 @@ -ARG target=node:10.12 -FROM $target -# Redeclare target ARG after FROM to inherit use value from the first ARG. -# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact -ARG target +FROM node:10.12 -# Install Bazel Ubuntu pre-requisites if it's the default target. -# Subsequent targets will already have it installed. +# Bazel Ubuntu pre-requisites. # https://docs.bazel.build/versions/master/install-ubuntu.html -RUN if [ "$target" = "node:10.12" ] ; then apt-get update; apt-get -y install pkg-config zip g++ zlib1g-dev unzip python ; fi -# Chrome prerequisites -RUN if [ "$target" = "node:10.12" ] ; then apt-get -y install libx11-xcb1 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 libnss3 libxss1 ; fi +RUN apt-get update; +RUN apt-get -y install pkg-config zip g++ zlib1g-dev unzip python -# Setup files. -WORKDIR /src -COPY ./ /src -COPY .circleci/bazel.rc /etc/bazel.bazelrc +# Chrome prerequisites. +# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker +RUN apt-get install -y wget --no-install-recommends \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ + && apt-get update \ + && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get purge --auto-remove -y curl \ + && rm -rf /src/*.deb -# Workaround symlink when building image on Windows. -RUN rm /src/packages/upgrade/static/src -RUN ln -s ../src /src/packages/upgrade/static/src -# Install dependencies and run tests. -RUN yarn install --frozen-lockfile --non-interactive -# RUN yarn bazel test //tools/ts-api-guardian:all -RUN yarn bazel build //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local -# RUN yarn bazel build --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot //... -# RUN yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local -# RUN yarn test-ivy-aot //... - -# docker build -t angular:latest . -# docker build . --build-arg target=angular:latest +# Work back from https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/node/images/10.12.0-jessie/Dockerfile to get Chrome working properly diff --git a/.buildkite/dockerfiles/linux-test.Dockerfile b/.buildkite/dockerfiles/linux-test.Dockerfile new file mode 100644 index 0000000000..6df5e584cd --- /dev/null +++ b/.buildkite/dockerfiles/linux-test.Dockerfile @@ -0,0 +1,32 @@ +FROM gcr.io/internal-200822/angular-linux:latest +USER root + +# TODO: Delete the above once the bootstrap image is available. + +WORKDIR /src + +# Copy package.json and yarn.lock before the other files. +# This allows docker to cache these steps even if source files change. +COPY ./package.json /src/package.json +COPY ./yarn.lock /src/yarn.lock +COPY ./tools/yarn/check-yarn.js /src/tools/yarn/check-yarn.js +COPY ./tools/postinstall-patches.js /src/tools/postinstall-patches.js +RUN yarn install --frozen-lockfile --non-interactive --network-timeout 100000 + +# Setup files. +COPY ./ /src +COPY .circleci/bazel.rc /etc/bazel.bazelrc + +# Workaround symlink when building image on Windows. +RUN rm /src/packages/upgrade/static/src +RUN ln -s ../src /src/packages/upgrade/static/src + +# Run tests. +RUN yarn bazel test //tools/ts-api-guardian:all --noshow_progress +# RUN yarn bazel build //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local +# RUN yarn bazel build --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot //... +# RUN yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local +# RUN yarn test-ivy-aot //... + +# docker build -t angular:latest . +# docker build . --build-arg target=angular:latest diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 4ece462789..e6d7315829 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,12 +8,29 @@ steps: - target=gcr.io/internal-200822/angular-windows:master agents: windows: true - - wait - - label: windows-update-image - branches: master + - label: linux-test plugins: - docker-compose#v2.6.0: - push: windows-test:gcr.io/internal-200822/angular-windows:master + build: linux-test config: .buildkite/dockerfiles/docker-compose.yml + # args: + # - target=gcr.io/internal-200822/angular-linux:master agents: - windows: true + linux: true + - wait + # - label: windows-update-image + # branches: master + # plugins: + # - docker-compose#v2.6.0: + # push: windows-test:gcr.io/internal-200822/angular-windows:master + # config: .buildkite/dockerfiles/docker-compose.yml + # agents: + # windows: true + # - label: linux-update-image + # # branches: master + # plugins: + # - docker-compose#v2.6.0: + # push: linux-test:gcr.io/internal-200822/angular-linux:master + # config: .buildkite/dockerfiles/docker-compose.yml + # agents: + # linux: true diff --git a/.buildkite/provision/linux-buildkite.md b/.buildkite/provision/linux-buildkite.md new file mode 100644 index 0000000000..26646cd6bc --- /dev/null +++ b/.buildkite/provision/linux-buildkite.md @@ -0,0 +1,26 @@ +Follow https://buildkite.com/docs/agent/v3/gcloud#running-the-agent-on-google-container-engine +but : +on the cluster creation chose n1-highcpu-16 instances, and give "read write" permissions to Storage + +on the "Create a deployment to start an agent:" step use change +``` + env: + - name: BUILDKITE_AGENT_TOKEN + valueFrom: {secretKeyRef: {name: buildkite-agent, key: token}} +``` +to +``` + env: + - name: BUILDKITE_AGENT_TOKEN + valueFrom: {secretKeyRef: {name: buildkite-agent, key: token}} + - name: BUILDKITE_AGENT_TAGS + value: "linux=true" + - name: BUILDKITE_TIMESTAMP_LINES + value: "true" +``` + + +config kubernetes to access container registry +maybe just give write access to storage https://medium.com/google-cloud/updating-google-container-engine-vm-scopes-with-zero-downtime-50bff87e5f80 +https://cloud.google.com/container-registry/docs/using-with-google-cloud-platform +https://container-solutions.com/using-google-container-registry-with-kubernetes/ \ No newline at end of file