Archived
1
0

Fix some CI issues

- Don't error if trying to tag and the tag already exists.
- Add the build arguments to the Docker build.
- Set an environment variable for the Docker build rather than using
- the username because the username always exists (on master anyway).
This commit is contained in:
Asher 2019-09-17 13:17:38 -05:00
parent 3851927396
commit 7b5d6d186b
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -8,6 +8,7 @@ before_install:
- export MAJOR_VERSION="2" - export MAJOR_VERSION="2"
- export VSCODE_VERSION="1.38.1" - export VSCODE_VERSION="1.38.1"
- export VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" - export VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
- export TAG="$VERSION-vsc$VSCODE_VERSION"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi - if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi - if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
@ -33,27 +34,26 @@ jobs:
- name: "Docker build" - name: "Docker build"
os: linux os: linux
dist: trusty dist: trusty
env: DOCKER_BUILD="true"
if: branch == master AND tag IS blank if: branch == master AND tag IS blank
script: script: docker build --build-arg codeServerVersion="$VERSION" --build-arg vscodeVersion="$VSCODE_VERSION" -t codercom/code-server:"$VERSION" -t codercom/code-server:v2 .
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin hub.docker.com
- docker build -t codercom/code-server:$VERSION -t codercom/code-server:v2 .
git: git:
depth: 3 depth: 3
before_deploy: before_deploy:
- echo "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT" - echo "$TAG" "$TRAVIS_COMMIT"
- git config --local user.name "$USER_NAME" - git config --local user.name "$USER_NAME"
- git config --local user.email "$USER_EMAIL" - git config --local user.email "$USER_EMAIL"
- git tag "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT" - if ! git tag "$TAG" "$TRAVIS_COMMIT" ; then echo "$TAG already exists"; fi
deploy: deploy:
- provider: releases - provider: releases
file_glob: true file_glob: true
prerelease: true prerelease: true
tag_name: "$VERSION-vsc$VSCODE_VERSION" tag_name: "$TAG"
target_commitish: "$TRAVIS_COMMIT" target_commitish: "$TRAVIS_COMMIT"
name: "$VERSION-vsc$VSCODE_VERSION" name: "$TAG"
skip_cleanup: true skip_cleanup: true
api_key: api_key:
secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc= secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc=
@ -63,14 +63,16 @@ deploy:
on: on:
repo: cdr/code-server repo: cdr/code-server
branch: master branch: master
- provider: script - provider: script
script: script:
- docker push codercom/code-server:$VERSION - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin hub.docker.com
- docker push codercom/code-server:"$VERSION"
- docker push codercom/code-server:v2 - docker push codercom/code-server:v2
on: on:
repo: cdr/code-server repo: cdr/code-server
branch: master branch: master
condition: -n "$DOCKER_USERNAME" condition: -n "$DOCKER_BUILD"
cache: cache:
yarn: true yarn: true