Fix shell command issues

This commit is contained in:
Teoh Han Hui 2019-10-11 18:35:26 +02:00
parent 1c4a4261fa
commit 77e74f257f
No known key found for this signature in database
GPG key ID: D43E2BABAF97DCAE
2 changed files with 23 additions and 38 deletions

View file

@ -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"]

44
entrypoint.sh Normal file → Executable file
View file

@ -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