Some changes in dockerfile and jenkinsfile
test-org/prometheus-exporter/pipeline/pr-master There was a failure building this commit Details

pull/3/head
yuobrezkov 2025-02-21 14:27:24 +03:00
parent beecc698f0
commit 6ad1b23359
2 changed files with 3 additions and 4 deletions

View File

@ -5,6 +5,7 @@ RUN apt update && apt install -y musl-tools
RUN rustup target add x86_64-unknown-linux-musl RUN rustup target add x86_64-unknown-linux-musl
COPY . . COPY . .
RUN cargo test
RUN cargo build --release --target=x86_64-unknown-linux-musl RUN cargo build --release --target=x86_64-unknown-linux-musl
FROM alpine:latest FROM alpine:latest
@ -14,4 +15,4 @@ COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/exporter /app/
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
CMD ["/app/exporter"] ENTRYPOINT ["/app/exporter"]

4
Jenkinsfile vendored
View File

@ -23,10 +23,8 @@ pipeline {
} }
steps { steps {
script { script {
def image = docker.build("${env.IMAGE_NAME}:${env.IMAGE_TAG}")
try { try {
sh "docker run --rm ${env.IMAGE_NAME}:${env.IMAGE_TAG} cargo test" def image = docker.build("${env.IMAGE_NAME}:${env.IMAGE_TAG}")
sh "docker tag ${env.IMAGE_NAME}:${env.IMAGE_TAG} ${env.REGISTRY_NAME}/${env.IMAGE_NAME}:${env.IMAGE_TAG}" sh "docker tag ${env.IMAGE_NAME}:${env.IMAGE_TAG} ${env.REGISTRY_NAME}/${env.IMAGE_NAME}:${env.IMAGE_TAG}"
} catch (Exception e) { } catch (Exception e) {
error("Tests failed: ${e.message}") error("Tests failed: ${e.message}")