Skip to content

Commit 7b5d6d1

Browse files
committed
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).
1 parent 3851927 commit 7b5d6d1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.travis.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ before_install:
88
- export MAJOR_VERSION="2"
99
- export VSCODE_VERSION="1.38.1"
1010
- export VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
11+
- export TAG="$VERSION-vsc$VSCODE_VERSION"
1112
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
1213
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
1314

@@ -33,27 +34,26 @@ jobs:
3334
- name: "Docker build"
3435
os: linux
3536
dist: trusty
37+
env: DOCKER_BUILD="true"
3638
if: branch == master AND tag IS blank
37-
script:
38-
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin hub.docker.com
39-
- docker build -t codercom/code-server:$VERSION -t codercom/code-server:v2 .
39+
script: docker build --build-arg codeServerVersion="$VERSION" --build-arg vscodeVersion="$VSCODE_VERSION" -t codercom/code-server:"$VERSION" -t codercom/code-server:v2 .
4040

4141
git:
4242
depth: 3
4343

4444
before_deploy:
45-
- echo "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT"
45+
- echo "$TAG" "$TRAVIS_COMMIT"
4646
- git config --local user.name "$USER_NAME"
4747
- git config --local user.email "$USER_EMAIL"
48-
- git tag "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT"
48+
- if ! git tag "$TAG" "$TRAVIS_COMMIT" ; then echo "$TAG already exists"; fi
4949

5050
deploy:
5151
- provider: releases
5252
file_glob: true
5353
prerelease: true
54-
tag_name: "$VERSION-vsc$VSCODE_VERSION"
54+
tag_name: "$TAG"
5555
target_commitish: "$TRAVIS_COMMIT"
56-
name: "$VERSION-vsc$VSCODE_VERSION"
56+
name: "$TAG"
5757
skip_cleanup: true
5858
api_key:
5959
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:
6363
on:
6464
repo: cdr/code-server
6565
branch: master
66+
6667
- provider: script
6768
script:
68-
- docker push codercom/code-server:$VERSION
69+
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin hub.docker.com
70+
- docker push codercom/code-server:"$VERSION"
6971
- docker push codercom/code-server:v2
7072
on:
7173
repo: cdr/code-server
7274
branch: master
73-
condition: -n "$DOCKER_USERNAME"
75+
condition: -n "$DOCKER_BUILD"
7476

7577
cache:
7678
yarn: true

0 commit comments

Comments
 (0)