Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions incubating/codecov-reporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# syntax=docker/dockerfile:1

FROM --platform=${BUILDPLATFORM} alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf AS build
ARG CF_CLI_VERSION=v1.3.6
ARG CODECOV_VERSION=v0.8.0
ARG TARGETARCH
WORKDIR /download
RUN apk add --no-cache curl gnupg
RUN case "${TARGETARCH}" in \
amd64) CF_OS=alpine-x64; CODECOV_OS=alpine ;; \
arm64) CF_OS=alpine-arm64; CODECOV_OS=aarch64 ;; \
*) echo "unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& curl -fsSL "https://github.com/codefresh-io/cli/releases/download/${CF_CLI_VERSION}/codefresh-${CF_CLI_VERSION}-${CF_OS}.tar.gz" \
| tar -xz codefresh \
&& curl -fsSL https://keybase.io/codecovsecops/pgp_keys.asc \
| gpg --dearmor > codecov.gpg \
&& curl -fsSLO "https://uploader.codecov.io/${CODECOV_VERSION}/${CODECOV_OS}/codecov" \
&& curl -fsSLO "https://uploader.codecov.io/${CODECOV_VERSION}/${CODECOV_OS}/codecov.SHA256SUM" \
&& curl -fsSLO "https://uploader.codecov.io/${CODECOV_VERSION}/${CODECOV_OS}/codecov.SHA256SUM.sig" \
&& gpgv --keyring ./codecov.gpg codecov.SHA256SUM.sig codecov.SHA256SUM \
&& sha256sum -c codecov.SHA256SUM \
&& chmod +x codefresh codecov


FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf
RUN apk add --no-cache git jq
COPY --from=build /download/codefresh /download/codecov /usr/local/bin/
RUN codefresh version && codecov --version
35 changes: 10 additions & 25 deletions incubating/codecov-reporter/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: step-type
metadata:
name: codecov-reporter
title: Sends a code scan report to codecov
version: 2.1.1
version: 2.1.2
isPublic: true
description: Sends a code scan report to codecov
sources:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
},
"os": {
"type": "string",
"description": "OS being used ( alpine | linux | macos | windows )",
"description": "Deprecated and ignored: the Codecov uploader is now bundled in the step image and only supports Linux",
"default": "linux"
},
"working_directory": {
Expand All @@ -77,32 +77,17 @@ spec:
}
}
steps:
first:
title: "get token"
image: codefresh/cli
environment:
- CODECOV_INTEGRATION=${{codecov_integration}}
commands:
- export CODECOV_API_KEY=$(codefresh get context $CODECOV_INTEGRATION --decrypt -o yaml | yq -r -c .spec.data.token)
- export CODECOV_URL=$(codefresh get context $CODECOV_INTEGRATION --decrypt -o yaml | yq -r -c .spec.data.url)
- echo CODECOV_API_KEY=$CODECOV_API_KEY >> /meta/env_vars_to_export
- echo CODECOV_URL=$CODECOV_URL >> /meta/env_vars_to_export
second:
main:
name: "send report"
image: node:24
image: quay.io/codefreshplugins/codecov-reporter:2.1.2
environment:
- CODECOV_API_KEY=${{CODECOV_API_KEY}}
- CODECOV_INTEGRATION=${{codecov_integration}}
- WORKING_DIRECTORY=${{working_directory}}
- os=${{os}}
commands:
- CODECOV_CONTEXT=$(codefresh get context "$CODECOV_INTEGRATION" --decrypt -o json)
- CODECOV_API_KEY=$(echo "$CODECOV_CONTEXT" | jq -r .spec.data.token)
- CODECOV_URL=$(echo "$CODECOV_CONTEXT" | jq -r .spec.data.url)
- cd ${WORKING_DIRECTORY}
- curl https://keybase.io/codecovsecops/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
- curl -Os "https://uploader.codecov.io/latest/${{os}}/codecov"
- curl -Os "https://uploader.codecov.io/latest/${{os}}/codecov.SHA256SUM"
- curl -Os "https://uploader.codecov.io/latest/${{os}}/codecov.SHA256SUM.sig"
- gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
- shasum -a 256 -c codecov.SHA256SUM
- chmod +x ./codecov
- ./codecov -t ${{CODECOV_API_KEY}} -u ${{CODECOV_URL}} -Q codefresh-2.0.0 | tee codecov.log
- codecov -t "$CODECOV_API_KEY" -u "$CODECOV_URL" -Q codefresh-2.0.0 | tee codecov.log
# [<< timestamp >>] ['info'] {"status":"success","resultURL":"<< Codecov URL >>"}
- cf_export second_CF_OUTPUT_URL=$(grep -A0 'resultURL' codecov.log | awk 'BEGIN{FS="\"";}{print $8}')
- cf_export main_CF_OUTPUT_URL=$(grep -A0 'resultURL' codecov.log | awk 'BEGIN{FS="\"";}{print $8}')
Loading