diff --git a/.gitignore b/.gitignore index 9ada4d7..0c65e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea /release +exported diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f24c63..4035f5f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ include: - - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' +- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' stages: - - build +- build variables: DOCKER_HOST: tcp://docker:2375/ @@ -12,8 +12,10 @@ image: buildtool/build-tools:${BUILDTOOLS_VERSION} build: stage: build services: - - docker:dind + - docker:dind script: - - ci_env=`bash <(curl -s https://codecov.io/env)` - - build ${ci_env//-e /--build-arg } - - push + - build + - curl -Os https://uploader.codecov.io/latest/linux/codecov + - chmod +x codecov + - ./codecov -t ${CODECOV_TOKEN} + - push diff --git a/Dockerfile b/Dockerfile index 531ae2c..a06e45f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,4 @@ FROM golang:1.17.2 as build -ARG CODECOV_ENV -ARG CODECOV_TOKEN -ARG CODECOV_URL -ARG CODECOV_SLUG -ARG VCS_COMMIT_ID -ARG VCS_BRANCH_NAME -ARG VCS_PULL_REQUEST -ARG VCS_SLUG -ARG VCS_TAG -ARG CI_BUILD_URL -ARG CI_BUILD_ID -ARG CI_JOB_ID -ARG GITLAB_CI -ARG CI_BUILD_REF_NAME -ARG CI_BUILD_ID -ARG CI_BUILD_REPO -ARG CI_BUILD_REF WORKDIR /build ENV CGO_ENABLED=0 ADD . /build @@ -27,10 +10,11 @@ RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v -f <(find . -type f | xa RUN go tool cover -html=coverage.txt -o coverage.html RUN go tool cover -func=coverage.txt RUN rm coverage.txt.tmp -RUN curl -s https://codecov.io/bash | bash - RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -o release/cron-checker -ldflags '-w -s' +FROM scratch as export +COPY --from=build /build/coverage.txt / + FROM scratch COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=build /build/release/cron-checker /