зеркало из https://github.com/mozilla/fxa.git
refactor(fxa-circleci): moved fxa-circleci image source
Including fxa-circleci in the /packages folder was awkward since it isn't part of the deployment and needed some special handling in the test/build process. This attempts to make that better.
This commit is contained in:
Родитель
46d4cb5f9d
Коммит
b88a0e2cff
|
@ -4,11 +4,10 @@
|
|||
|
||||
## Special Cases
|
||||
|
||||
`fxa-email-service` and `fxa-circleci` aren't tested for most PRs because
|
||||
they don't change often and are relatively resource intensive. In order to
|
||||
trigger these tests the PR branch should be prefixed with `email-service-`
|
||||
or `fxa-circleci-`. PRs that change those packages on other branches
|
||||
will (intentionally) fail.
|
||||
`fxa-email-service` isn't tested for most PRs because it doesn't change
|
||||
often and is relatively resource intensive. In order to
|
||||
trigger these tests the PR branch should be prefixed with `email-service-`.
|
||||
PRs that change those packages on other branches will (intentionally) fail.
|
||||
|
||||
## Scripts
|
||||
|
||||
|
|
|
@ -15,9 +15,3 @@ if grep -e 'fxa-email-service' ../packages/test.list; then
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
if grep -e 'fxa-circleci' ../packages/test.list; then
|
||||
if [[ ! $CIRCLE_BRANCH =~ ^fxa-circleci-.* ]]; then
|
||||
echo "Please create a new PR from a branch name starting with 'fxa-circleci-'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
|
||||
cd "$DIR/../_dev/docker/circleci"
|
||||
|
||||
mkdir -p ../../artifacts
|
||||
|
||||
echo "building fxa-circleci"
|
||||
time (docker build --progress=plain -t "fxa-circleci:latest" . &> "../../artifacts/fxa-circleci.log")
|
||||
|
||||
if [[ -n "${DOCKER_PASS_fxa_circleci}" ]] && [[ -n "${DOCKER_USER_fxa_circleci}" ]]; then
|
||||
echo "deploying fxa-circleci"
|
||||
echo "${DOCKER_PASS_fxa_circleci}" | docker login -u "${DOCKER_USER_fxa_circleci}" --password-stdin
|
||||
time docker push "fxa-circleci:latest"
|
||||
fi
|
|
@ -152,7 +152,7 @@ jobs:
|
|||
test-email-service:
|
||||
resource_class: large
|
||||
docker:
|
||||
- image: mozilla/fxa-circleci
|
||||
- image: circleci/rust:latest-node
|
||||
- image: mysql:5.7.27
|
||||
environment:
|
||||
- MYSQL_DATABASE: fxa
|
||||
|
@ -164,22 +164,11 @@ jobs:
|
|||
steps:
|
||||
- base-install:
|
||||
package: fxa-email-service
|
||||
- run: cargo install cargo-audit
|
||||
- run: ./packages/fxa-email-service/scripts/test-ci.sh
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
|
||||
test-fxa-circleci:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
environment:
|
||||
SKIP_PACKAGES: true
|
||||
steps:
|
||||
- base-install:
|
||||
package: fxa-circleci
|
||||
- setup_remote_docker
|
||||
- run: ./.circleci/build.sh fxa-circleci
|
||||
|
||||
deploy-packages:
|
||||
resource_class: small
|
||||
docker:
|
||||
|
@ -201,6 +190,24 @@ jobs:
|
|||
- store_artifacts:
|
||||
path: artifacts
|
||||
|
||||
# this job is manually triggered as needed. see _dev/docker/circleci/README.md
|
||||
build-and-deploy-fxa-circleci:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
environment:
|
||||
SKIP_PACKAGES: true
|
||||
DOCKER_BUILDKIT: 1
|
||||
steps:
|
||||
- setup_remote_docker:
|
||||
version: 18.09.3
|
||||
- run:
|
||||
name: Build & deploy fxa-circleci
|
||||
command: ./.circleci/build-and-deploy-fxa-circleci.sh
|
||||
no_output_timeout: 1h
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
|
||||
workflows:
|
||||
test_pull_request:
|
||||
jobs:
|
||||
|
@ -265,16 +272,6 @@ workflows:
|
|||
- /^email-service-.*/
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- test-fxa-circleci:
|
||||
# since fxa-circleci rarely changes
|
||||
# we only run it on branches
|
||||
# starting with "fxa-circleci-"
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /^fxa-circleci-.*/
|
||||
tags:
|
||||
ignore: /.*/
|
||||
deploy_master:
|
||||
jobs:
|
||||
- deploy-packages:
|
||||
|
|
|
@ -13,7 +13,6 @@ packages/*/static/bower_components
|
|||
packages/fxa-auth-server/.mail_output
|
||||
!packages/fxa-auth-server/docs/pushpayloads.schema.json
|
||||
packages/fxa-amplitude-send
|
||||
packages/fxa-circleci
|
||||
packages/fxa-dev-launcher
|
||||
packages/fxa-email-event-proxy
|
||||
packages/fxa-email-service
|
||||
|
|
|
@ -2,19 +2,11 @@ FROM circleci/node:12-stretch-browsers
|
|||
|
||||
USER root
|
||||
RUN apt-get update && apt-get install -y \
|
||||
bison \
|
||||
build-essential \
|
||||
cmake \
|
||||
flex \
|
||||
graphicsmagick \
|
||||
libboost-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-regex-dev \
|
||||
libboost-system-dev \
|
||||
python-setuptools \
|
||||
python-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN npm install -g npm
|
||||
|
||||
RUN easy_install pip
|
||||
RUN pip install mozdownload mozinstall
|
||||
RUN mozdownload --version 68.0 --destination firefox.tar.bz2
|
||||
|
@ -22,10 +14,6 @@ RUN wget https://s3-us-west-2.amazonaws.com/fxa-dev-bucket/fenix-pair/desktop/7f
|
|||
|
||||
USER circleci
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
ENV PATH=/home/circleci/.cargo/bin:$PATH
|
||||
RUN cargo install cargo-audit
|
||||
|
||||
# copy this Dockerfile into the image so we can compare it later
|
||||
COPY --chown=circleci:circleci Dockerfile /
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# fxa-circleci
|
||||
|
||||
This is the base image used for circleci tests and includes dependencies required for selenium testing with specific versions of firefox.
|
||||
|
||||
This image is not built alongside other package images because it doesn't fit well within the deployment flow of the services themselves and it should rarely change.
|
||||
|
||||
To deploy, push your changes to github then trigger a circleci job using the api like so:
|
||||
|
||||
```sh
|
||||
curl -u $CIRCLECI_API_TOKEN \
|
||||
-d build_parameters[CIRCLE_JOB]='build-and-deploy-fxa-circleci' \
|
||||
https://circleci.com/api/v1.1/project/github/mozilla/fxa/tree/$GITHUB_BRANCH
|
||||
```
|
||||
|
||||
- `$CIRCLECI_API_TOKEN` is your personal API token from https://app.circleci.com/settings/user/tokens
|
||||
- `$GITHUB_BRANCH` is the branch you'd like to build & deploy to docker hub (this may be `master`)
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# In order to save time this script pulls the latest docker image and compares
|
||||
# it to the current Dockerfile. If there are no changes the build is skipped.
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
|
||||
cd "$DIR/.."
|
||||
|
||||
docker pull -q mozilla/fxa-circleci:latest
|
||||
ID=$(docker create mozilla/fxa-circleci:latest)
|
||||
docker cp "$ID":Dockerfile /tmp
|
||||
|
||||
if diff Dockerfile /tmp/Dockerfile; then
|
||||
echo "The source is unchanged. Skipping build"
|
||||
else
|
||||
docker build --progress=plain -t fxa-circleci:build . > ../../artifacts/fxa-circleci.log
|
||||
fi
|
||||
docker rm -v "$ID"
|
Загрузка…
Ссылка в новой задаче