Fix Gitlab CI

This commit is contained in:
Otto Winter 2018-11-03 22:14:33 +01:00
parent 28561ea6a4
commit aa5f887ff3
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
3 changed files with 55 additions and 61 deletions

View File

@ -65,7 +65,7 @@ test2:
- BUILD_FROM=homeassistant/${ADDON_ARCH}-base-ubuntu:latest - BUILD_FROM=homeassistant/${ADDON_ARCH}-base-ubuntu:latest
- ADDON_VERSION="${CI_COMMIT_TAG#v}" - ADDON_VERSION="${CI_COMMIT_TAG#v}"
- ADDON_VERSION="${ADDON_VERSION:-${CI_COMMIT_SHA:0:7}}" - ADDON_VERSION="${ADDON_VERSION:-${CI_COMMIT_SHA:0:7}}"
- ESPHOMELIB_VERSION="${ESPHOMELIB_VERSION:-''}" - ESPHOMELIB_VERSION="${ESPHOMELIB_VERSION:-dev}"
- echo "Build from ${BUILD_FROM}" - echo "Build from ${BUILD_FROM}"
- echo "Add-on version ${ADDON_VERSION}" - echo "Add-on version ${ADDON_VERSION}"
- echo "Esphomelib version ${ESPHOMELIB_VERSION}" - echo "Esphomelib version ${ESPHOMELIB_VERSION}"
@ -95,48 +95,48 @@ test2:
script: script:
- version="${CI_COMMIT_TAG#v}" - version="${CI_COMMIT_TAG#v}"
- echo "Publishing release version ${version}" - echo "Publishing release version ${version}"
- docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - docker pull "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
- echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - docker push "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - docker push "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - docker push "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- | - |
docker tag \ docker tag \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
- echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- | - |
docker tag \ docker tag \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
only: only:
@ -150,34 +150,34 @@ test2:
script: script:
- version="${CI_COMMIT_TAG#v}" - version="${CI_COMMIT_TAG#v}"
- echo "Publishing beta version ${version}" - echo "Publishing beta version ${version}"
- docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - docker pull "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
- echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - docker push "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - docker push "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- | - |
docker tag \ docker tag \
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- | - |
docker tag \ docker tag \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc"
only: only:
@ -190,7 +190,7 @@ build:normal:
<<: *docker-builder <<: *docker-builder
stage: build stage: build
script: script:
- docker build -t "${CI_REGISTRY}/ottowinter/esphomeyaml:dev" . - docker build -t "${CI_REGISTRY}/esphomeyaml:dev" .
.build-hassio-edge: &build-hassio-edge .build-hassio-edge: &build-hassio-edge
<<: *build-hassio <<: *build-hassio
@ -209,48 +209,48 @@ build:hassio-armhf-edge:
variables: variables:
ADDON_ARCH: armhf ADDON_ARCH: armhf
DO_PUSH: "false" DO_PUSH: "false"
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-armhf: build:hassio-armhf:
<<: *build-hassio-release <<: *build-hassio-release
variables: variables:
ADDON_ARCH: armhf ADDON_ARCH: armhf
build:hassio-aarch64-edge:
<<: *build-hassio-edge
variables:
ADDON_ARCH: aarch64
DO_PUSH: "false"
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}" ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-aarch64: #build:hassio-aarch64-edge:
<<: *build-hassio-release # <<: *build-hassio-edge
variables: # variables:
ADDON_ARCH: aarch64 # ADDON_ARCH: aarch64
# DO_PUSH: "false"
#build:hassio-aarch64:
# <<: *build-hassio-release
# variables:
# ADDON_ARCH: aarch64
# ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-i386-edge: build:hassio-i386-edge:
<<: *build-hassio-edge <<: *build-hassio-edge
variables: variables:
ADDON_ARCH: i386 ADDON_ARCH: i386
DO_PUSH: "false" DO_PUSH: "false"
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-i386: build:hassio-i386:
<<: *build-hassio-release <<: *build-hassio-release
variables: variables:
ADDON_ARCH: i386 ADDON_ARCH: i386
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-amd64-edge: build:hassio-amd64-edge:
<<: *build-hassio-edge <<: *build-hassio-edge
variables: variables:
ADDON_ARCH: amd64 ADDON_ARCH: amd64
DO_PUSH: "false" DO_PUSH: "false"
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
build:hassio-amd64: build:hassio-amd64:
<<: *build-hassio-release <<: *build-hassio-release
variables: variables:
ADDON_ARCH: amd64 ADDON_ARCH: amd64
ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}"
# Deploy jobs # Deploy jobs
deploy-release:armhf: deploy-release:armhf:
@ -263,15 +263,15 @@ deploy-beta:armhf:
variables: variables:
ADDON_ARCH: armhf ADDON_ARCH: armhf
deploy-release:aarch64: #deploy-release:aarch64:
<<: *deploy-release # <<: *deploy-release
variables: # variables:
ADDON_ARCH: aarch64 # ADDON_ARCH: aarch64
#
deploy-beta:aarch64: #deploy-beta:aarch64:
<<: *deploy-beta # <<: *deploy-beta
variables: # variables:
ADDON_ARCH: aarch64 # ADDON_ARCH: aarch64
deploy-release:i386: deploy-release:i386:
<<: *deploy-release <<: *deploy-release

View File

@ -18,11 +18,7 @@ VOLUME /config
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY docker/platformio.ini /pio/platformio.ini COPY docker/platformio.ini /pio/platformio.ini
ARG ESPHOMELIB_VERSION="" RUN platformio run -d /pio; rm -rf /pio
RUN platformio run -d /pio; rm -rf /pio && \
/bin/bash -c "if [ ! -z '$ESPHOMELIB_VERSION']; then \
platformio lib -g install '${ESPHOMELIB_VERSION}'; \
fi"
COPY . . COPY . .
RUN pip install --no-cache-dir --no-binary :all: -e . && \ RUN pip install --no-cache-dir --no-binary :all: -e . && \

View File

@ -16,12 +16,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
platformio settings set check_platforms_interval 1000000 platformio settings set check_platforms_interval 1000000
COPY docker/platformio.ini /pio/platformio.ini COPY docker/platformio.ini /pio/platformio.ini
ARG ESPHOMELIB_VERSION="" RUN platformio run -d /pio; rm -rf /pio
RUN platformio run -d /pio; rm -rf /pio && \
/bin/bash -c "if [ ! -z '$ESPHOMELIB_VERSION']; then \
platformio lib -g install '${ESPHOMELIB_VERSION}'; \
fi"
ARG ESPHOMELIB_VERSION="dev"
RUN platformio lib -g install "https://github.com/OttoWinter/esphomelib.git#${ESPHOMELIB_VERSION}"
COPY . . COPY . .
RUN pip install --no-cache-dir --no-binary :all: -e . && \ RUN pip install --no-cache-dir --no-binary :all: -e . && \