From 77e74f257ff93587b604d0d9d6c130d1e74a7e77 Mon Sep 17 00:00:00 2001 From: Teoh Han Hui Date: Fri, 11 Oct 2019 18:35:26 +0200 Subject: [PATCH] Fix shell command issues --- Dockerfile | 17 ++++++++++------- entrypoint.sh | 44 +++++++++++++------------------------------- 2 files changed, 23 insertions(+), 38 deletions(-) mode change 100644 => 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 5364411..bcc99d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ # Codecov @codecov -FROM ubuntu:latest +FROM debian:stretch-slim -WORKDIR /app -COPY . /app +RUN apt-get update && apt-get install -y \ + ca-certificates \ + curl \ + git \ + mercurial \ + --no-install-recommends && rm -r /var/lib/apt/lists/* -RUN apt update && apt install -y curl git mercurial +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -RUN chmod +x /app/entrypoint.sh - -ENTRYPOINT [ "/app/entrypoint.sh" ] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh old mode 100644 new mode 100755 index 37e86a5..80e5946 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,38 +1,20 @@ -#!/bin/bash +#!/bin/sh # Codecov @codecov set -eu -if [ $# -eq 0 ] -then - echo "Please provide an upload token from codecov.io" - exit 1 -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] && [ "x$INPUT_NAME" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS -n $INPUT_NAME -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_NAME" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -f $INPUT_FILE -n $INPUT_NAME -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -n $INPUT_NAME -F $INPUT_FLAGS -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -f $INPUT_FILE -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -F $INPUT_FLAGS -elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN -n $INPUT_NAME -elif [ "x$INPUT_TOKEN" != "x" ] -then - curl -s https://codecov.io/bash | bash -s -- -t $INPUT_TOKEN +if [ "x$INPUT_FILE" != 'x' ]; then + curl -s https://codecov.io/bash | bash -s -- \ + -f "$INPUT_FILE" \ + -t "$INPUT_TOKEN" \ + -n "$INPUT_NAME" \ + -F "$INPUT_FLAGS" \ + -Z || echo 'Codecov upload failed' else - echo "Please provide an upload token from codecov.io with valid arguments" - exit 1 + curl -s https://codecov.io/bash | bash -s -- \ + -t "$INPUT_TOKEN" \ + -n "$INPUT_NAME" \ + -F "$INPUT_FLAGS" \ + -Z || echo 'Codecov upload failed' fi