s2i-dotnetcore
s2i-dotnetcore copied to clipboard
npmrc config cannot be set
Hello,
I am currently trying to inject an nmprc config into the ubi8/dotnet-60 container at build time. I used the following guide to do this:
https://docs.openshift.com/container-platform/3.11/security/build_process.html#security-build-securing-inputs-during-builds
Here is the npmrc:
registry=https://XXX _auth=XXX email=XXX always-auth=true
Unfortunately it still tries to download packages from https://registry.npmjs.org. I also tried to set the NPM_MIRROR but that didn't help either.
Here is the log:
Adding cluster TLS certificate authority to trust store I0601 11:14:22.048972 1 builder.go:420] openshift-builder 4.6.0-202204261127.p0.g263041a.assembly.stream-263041a I0601 11:14:22.052214 1 builder.go:421] redacted build: {"kind":"Build","apiVersion":"build.openshift.io/v1","metadata":{"name":"useranalyticswebservice-26","namespace":"ci-bts","selfLink":"/apis/build.openshift.io/v1/namespaces/ci-bts/builds/useranalyticswebservice-26","uid":"bd25b691-0b93-44df-8dcf-d8cd842c34d0","resourceVersion":"356204761","creationTimestamp":"2022-06-01T11:14:19Z","labels":{"app":"useranalyticswebservice","buildconfig":"useranalyticswebservice","openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.number":"26"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"useranalyticswebservice","uid":"2b08c69b-4092-4ffb-877b-9de28274c705","controller":true}],"managedFields":[{"manager":"openshift-apiserver","operation":"Update","apiVersion":"build.openshift.io/v1","time":"2022-06-01T11:14:19Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.number":{}},"f:labels":{".":{},"f:app":{},"f:buildconfig":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.start-policy":{}},"f:ownerReferences":{".":{},"k:{"uid":"2b08c69b-4092-4ffb-877b-9de28274c705"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}},"f:spec":{"f:output":{"f:to":{".":{},"f:kind":{},"f:name":{}}},"f:serviceAccount":{},"f:source":{"f:contextDir":{},"f:git":{".":{},"f:ref":{},"f:uri":{}},"f:secrets":{},"f:sourceSecret":{".":{},"f:name":{}},"f:type":{}},"f:strategy":{"f:sourceStrategy":{".":{},"f:env":{},"f:from":{".":{},"f:kind":{},"f:name":{}}},"f:type":{}},"f:triggeredBy":{}},"f:status":{"f:conditions":{".":{},"k:{"type":"New"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:status":{},"f:type":{}}},"f:config":{".":{},"f:kind":{},"f:name":{},"f:namespace":{}},"f:phase":{}}}}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"gitConfig},"contextDir":"/UserAnalytics","sourceSecret":{"name":"bitbucket-01-secret-XXX"},"secrets":[{"secret":{"name":"secret-npmrc"}}]},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6"},"pullSecret":{"name":"builder-dockercfg-2fn95"},"env":[{"name":"NPM_MIRROR","value":"https://XXX"},{"name":"BUILD_LOGLEVEL","value":"5"}]}},"output":{"to":{"kind":"DockerImage","name":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest"},"pushSecret":{"name":"builder-dockercfg-2fn95"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Manually triggered"}]},"status":{"phase":"New","outputDockerImageReference":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest","config":{"kind":"BuildConfig","namespace":"ci-bts","name":"useranalyticswebservice"},"output":{},"conditions":[{"type":"New","status":"True","lastUpdateTime":"2022-06-01T11:14:19Z","lastTransitionTime":"2022-06-01T11:14:19Z"}]}} I0601 11:14:22.053438 1 scmauths.go:61] Finding auth for "..2022_06_01_11_14_19.963736885" I0601 11:14:22.053456 1 scmauths.go:61] Finding auth for "..data" I0601 11:14:22.053460 1 scmauths.go:61] Finding auth for "password" I0601 11:14:22.053464 1 scmauths.go:61] Found SCMAuth "password" to handle "password" I0601 11:14:22.053467 1 scmauths.go:61] Finding auth for "username" I0601 11:14:22.053470 1 scmauths.go:61] Found SCMAuth "password" to handle "username" I0601 11:14:22.053476 1 scmauths.go:67] Setting up SCMAuth "password" I0601 11:14:22.053673 1 scmauths.go:46] Adding username/password credentials to git config: /# credential git config [credential] helper = store --file=/tmp/gitcredentials.120044880 I0601 11:14:22.053839 1 builder.go:248] Adding parameter http.proxy to .gitconfig /tmp/git198982914/.gitconfig I0601 11:14:22.053857 1 repository.go:450] Executing git config --add http.proxy http://XXX:8080 I0601 11:14:22.056468 1 builder.go:253] Adding parameter https.proxy to .gitconfig /tmp/git198982914/.gitconfig I0601 11:14:22.056485 1 repository.go:450] Executing git config --add https.proxy http://XXX:8080 Cloning "https://XXX" ... I0601 11:14:22.058840 1 source.go:237] git ls-remote --heads https://XXX I0601 11:14:22.058850 1 repository.go:450] Executing git ls-remote --heads https://XXX I0601 11:14:22.534404 1 source.go:237] 47e6d867b623cb0eb5eb5f69738915e76eedbf71 refs/heads/master 0b1c87b538f254a22f0ea44c73402ad345ec9a33 refs/heads/release/Test I0601 11:14:22.534430 1 source.go:69] Cloning source from https://XXX I0601 11:14:22.534450 1 repository.go:450] Executing git clone https://XXX /tmp/build/inputs I0601 11:14:23.619806 1 repository.go:450] Executing git checkout release/Test -- I0601 11:14:23.629415 1 repository.go:450] Executing git submodule update --init --recursive I0601 11:14:23.695032 1 repository.go:450] Executing git rev-parse --abbrev-ref HEAD I0601 11:14:23.697662 1 repository.go:450] Executing git rev-parse --verify HEAD I0601 11:14:23.700098 1 repository.go:450] Executing git --no-pager show -s --format=%an HEAD I0601 11:14:23.702617 1 repository.go:450] Executing git --no-pager show -s --format=%ae HEAD I0601 11:14:23.704983 1 repository.go:450] Executing git --no-pager show -s --format=%cn HEAD I0601 11:14:23.707405 1 repository.go:450] Executing git --no-pager show -s --format=%ce HEAD I0601 11:14:23.709607 1 repository.go:450] Executing git --no-pager show -s --format=%ad HEAD I0601 11:14:23.712047 1 repository.go:450] Executing git --no-pager show -s --format=%<(80,trunc)%s HEAD I0601 11:14:23.714155 1 repository.go:450] Executing git config --get remote.origin.url I0601 11:14:23.715887 1 repository.go:533] Error executing command: exit status 1 Commit: 0b1c87b538f254a22f0ea44c73402ad345ec9a33 (Added environment) Author: XXX Date: Wed Jun 1 11:27:22 2022 +0200 I0601 11:14:23.715993 1 repository.go:450] Executing git rev-parse --abbrev-ref HEAD I0601 11:14:23.718031 1 repository.go:450] Executing git rev-parse --verify HEAD I0601 11:14:23.719882 1 repository.go:450] Executing git --no-pager show -s --format=%an HEAD I0601 11:14:23.721890 1 repository.go:450] Executing git --no-pager show -s --format=%ae HEAD I0601 11:14:23.724042 1 repository.go:450] Executing git --no-pager show -s --format=%cn HEAD I0601 11:14:23.726107 1 repository.go:450] Executing git --no-pager show -s --format=%ce HEAD I0601 11:14:23.728287 1 repository.go:450] Executing git --no-pager show -s --format=%ad HEAD I0601 11:14:23.730542 1 repository.go:450] Executing git --no-pager show -s --format=%<(80,trunc)%s HEAD I0601 11:14:23.732881 1 repository.go:450] Executing git config --get remote.origin.url I0601 11:14:23.734523 1 repository.go:533] Error executing command: exit status 1 Adding cluster TLS certificate authority to trust store I0601 11:14:25.398236 1 builder.go:447] openshift-builder 4.6.0-202204261127.p0.g263041a.assembly.stream-263041a I0601 11:14:25.401132 1 builder.go:448] redacted build: {"kind":"Build","apiVersion":"build.openshift.io/v1","metadata":{"name":"useranalyticswebservice-26","namespace":"ci-bts","selfLink":"/apis/build.openshift.io/v1/namespaces/ci-bts/builds/useranalyticswebservice-26","uid":"bd25b691-0b93-44df-8dcf-d8cd842c34d0","resourceVersion":"356204761","creationTimestamp":"2022-06-01T11:14:19Z","labels":{"app":"useranalyticswebservice","buildconfig":"useranalyticswebservice","openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.number":"26"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"useranalyticswebservice","uid":"2b08c69b-4092-4ffb-877b-9de28274c705","controller":true}],"managedFields":[{"manager":"openshift-apiserver","operation":"Update","apiVersion":"build.openshift.io/v1","time":"2022-06-01T11:14:19Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.number":{}},"f:labels":{".":{},"f:app":{},"f:buildconfig":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.start-policy":{}},"f:ownerReferences":{".":{},"k:{"uid":"2b08c69b-4092-4ffb-877b-9de28274c705"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}},"f:spec":{"f:output":{"f:to":{".":{},"f:kind":{},"f:name":{}}},"f:serviceAccount":{},"f:source":{"f:contextDir":{},"f:git":{".":{},"f:ref":{},"f:uri":{}},"f:secrets":{},"f:sourceSecret":{".":{},"f:name":{}},"f:type":{}},"f:strategy":{"f:sourceStrategy":{".":{},"f:env":{},"f:from":{".":{},"f:kind":{},"f:name":{}}},"f:type":{}},"f:triggeredBy":{}},"f:status":{"f:conditions":{".":{},"k:{"type":"New"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:status":{},"f:type":{}}},"f:config":{".":{},"f:kind":{},"f:name":{},"f:namespace":{}},"f:phase":{}}}}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"gitConfig},"contextDir":"/UserAnalytics","sourceSecret":{"name":"bitbucket-01-secret-XXX"},"secrets":[{"secret":{"name":"secret-npmrc"}}]},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6"},"pullSecret":{"name":"builder-dockercfg-2fn95"},"env":[{"name":"NPM_MIRROR","value":"https://XXX"},{"name":"BUILD_LOGLEVEL","value":"5"}]}},"output":{"to":{"kind":"DockerImage","name":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest"},"pushSecret":{"name":"builder-dockercfg-2fn95"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Manually triggered"}]},"status":{"phase":"New","outputDockerImageReference":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest","config":{"kind":"BuildConfig","namespace":"ci-bts","name":"useranalyticswebservice"},"output":{},"conditions":[{"type":"New","status":"True","lastUpdateTime":"2022-06-01T11:14:19Z","lastTransitionTime":"2022-06-01T11:14:19Z"}]}} I0601 11:14:25.402195 1 builder.go:455] Checking for presence of a Dockerfile Adding cluster TLS certificate authority to trust store I0601 11:14:26.325754 1 builder.go:373] openshift-builder 4.6.0-202204261127.p0.g263041a.assembly.stream-263041a I0601 11:14:26.328639 1 builder.go:374] redacted build: {"kind":"Build","apiVersion":"build.openshift.io/v1","metadata":{"name":"useranalyticswebservice-26","namespace":"ci-bts","selfLink":"/apis/build.openshift.io/v1/namespaces/ci-bts/builds/useranalyticswebservice-26","uid":"bd25b691-0b93-44df-8dcf-d8cd842c34d0","resourceVersion":"356204761","creationTimestamp":"2022-06-01T11:14:19Z","labels":{"app":"useranalyticswebservice","buildconfig":"useranalyticswebservice","openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"useranalyticswebservice","openshift.io/build.number":"26"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"useranalyticswebservice","uid":"2b08c69b-4092-4ffb-877b-9de28274c705","controller":true}],"managedFields":[{"manager":"openshift-apiserver","operation":"Update","apiVersion":"build.openshift.io/v1","time":"2022-06-01T11:14:19Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.number":{}},"f:labels":{".":{},"f:app":{},"f:buildconfig":{},"f:openshift.io/build-config.name":{},"f:openshift.io/build.start-policy":{}},"f:ownerReferences":{".":{},"k:{"uid":"2b08c69b-4092-4ffb-877b-9de28274c705"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}},"f:spec":{"f:output":{"f:to":{".":{},"f:kind":{},"f:name":{}}},"f:serviceAccount":{},"f:source":{"f:contextDir":{},"f:git":{".":{},"f:ref":{},"f:uri":{}},"f:secrets":{},"f:sourceSecret":{".":{},"f:name":{}},"f:type":{}},"f:strategy":{"f:sourceStrategy":{".":{},"f:env":{},"f:from":{".":{},"f:kind":{},"f:name":{}}},"f:type":{}},"f:triggeredBy":{}},"f:status":{"f:conditions":{".":{},"k:{"type":"New"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:status":{},"f:type":{}}},"f:config":{".":{},"f:kind":{},"f:name":{},"f:namespace":{}},"f:phase":{}}}}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"gitConfig},"contextDir":"/UserAnalytics","sourceSecret":{"name":"bitbucket-01-secret-XXX"},"secrets":[{"secret":{"name":"secret-npmrc"}}]},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6"},"pullSecret":{"name":"builder-dockercfg-2fn95"},"env":[{"name":"NPM_MIRROR","value":"https://XXX"},{"name":"BUILD_LOGLEVEL","value":"5"}]}},"output":{"to":{"kind":"DockerImage","name":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest"},"pushSecret":{"name":"builder-dockercfg-2fn95"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Manually triggered"}]},"status":{"phase":"New","outputDockerImageReference":"image-registry.openshift-image-registry.svc:5000/ci-bts/useranalyticswebservice:latest","config":{"kind":"BuildConfig","namespace":"ci-bts","name":"useranalyticswebservice"},"output":{},"conditions":[{"type":"New","status":"True","lastUpdateTime":"2022-06-01T11:14:19Z","lastTransitionTime":"2022-06-01T11:14:19Z"}]}} Caching blobs under "/var/cache/blobs". I0601 11:14:27.097693 1 util_linux.go:57] found cgroup parent kubepods-besteffort-pod69ca9e11_ac93_443c_91d8_93f8ba271072.slice I0601 11:14:27.097746 1 builder.go:381] Running build with cgroup limits: api.CGroupLimits{MemoryLimitBytes:92233720368547, CPUShares:0, CPUPeriod:0, CPUQuota:0, MemorySwap:92233720368547, Parent:"kubepods-besteffort-pod69ca9e11_ac93_443c_91d8_93f8ba271072.slice"} I0601 11:14:27.097903 1 sti.go:156] Found git source info: git.SourceInfo{Ref:"release/Test", CommitID:"0b1c87b538f254a22f0ea44c73402ad345ec9a33", Date:"Wed Jun 1 11:27:22 2022 +0200", AuthorName:"XXX", AuthorEmail:"XXX", CommitterName:"XXX", CommitterEmail:"XXX", Message:"Added environment", Location:"", ContextDir:""} I0601 11:14:27.097929 1 sti.go:118] Injecting build source "secret-npmrc" into a build into "." Local copy of "registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6" is not present. I0601 11:14:27.098523 1 sti.go:231] Locating docker config paths for type PULL_DOCKERCFG_PATH I0601 11:14:27.098539 1 sti.go:231] Getting docker config in paths : [/var/run/secrets/openshift.io/pull] Explicitly pulling image registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6 Asked to pull fresh copy of "registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6". I0601 11:14:27.098593 1 daemonless.go:119] looking for config.json at /var/run/secrets/openshift.io/pull/config.json I0601 11:14:27.098639 1 cfg.go:154] error reading file: open /var/run/secrets/openshift.io/pull/config.json: no such file or directory I0601 11:14:27.098665 1 daemonless.go:119] looking for .dockerconfigjson at /var/run/secrets/openshift.io/pull/.dockerconfigjson I0601 11:14:27.098685 1 cfg.go:154] error reading file: open /var/run/secrets/openshift.io/pull/.dockerconfigjson: no such file or directory I0601 11:14:27.098696 1 daemonless.go:119] looking for .dockercfg at /var/run/secrets/openshift.io/pull/.dockercfg I0601 11:14:27.098917 1 daemonless.go:119] found valid .dockercfg at /var/run/secrets/openshift.io/pull/.dockercfg I0601 11:14:27.099060 1 config.go:110] looking for .dockercfg at /var/run/secrets/openshift.io/pull/.dockercfg I0601 11:14:27.099313 1 config.go:125] found .dockercfg at /var/run/secrets/openshift.io/pull/.dockercfg Getting image source signatures Copying blob sha256:64f86245e6de16170899a8a0bc3fb02df05ea11a2076b99ad8f878f742efae2e Copying blob sha256:4eef1fa1f1c17f9ad6a8187dd5a483e11bd340fc116057bd4cece92305151072 Copying blob sha256:eb24191cef200934f4fe601f3dc7e7847ea86ce5c52cb9859361bf8e00fe95e7 Copying blob sha256:0191a422088002c1b4862e10fc0b3fdad75da146ff943836e64ae9e9a7bc38c8 Copying config sha256:5bc816d9d634bce36af0cdf2a0240b7dc6d992bea68301cff1121207de505643 Writing manifest to image destination Storing signatures I0601 11:14:46.552727 1 builder.go:369] Using builder image assemble user 1001 I0601 11:14:46.553328 1 builder.go:369] Using builder scripts URL I0601 11:14:46.553348 1 builder.go:369] The value of ALLOWED_UIDS is [1-] I0601 11:14:46.553494 1 builder.go:369] Creating a new S2I builder with config: "Source:\t\t\t\t/tmp/build/inputs\nContext Directory:\t\t/UserAnalytics\nOutput Image Tag:\t\t\nEnvironment:\t\t\tOPENSHIFT_BUILD_NAME=useranalyticswebservice-26,OPENSHIFT_BUILD_NAMESPACE=ci-bts,OPENSHIFT_BUILD_SOURCE=https://XXX,OPENSHIFT_BUILD_REFERENCE=release/Test,OPENSHIFT_BUILD_COMMIT=0b1c87b538f254a22f0ea44c73402ad345ec9a33,NPM_MIRROR=https://XXX,BUILD_LOGLEVEL=5\nLabels:\t\t\t\tio.openshift.build.source-context-dir="/UserAnalytics",io.openshift.build.commit.author="XXX",io.openshift.build.commit.date="Wed Jun 1 11:27:22 2022 +0200",io.openshift.build.commit.id="0b1c87b538f254a22f0ea44c73402ad345ec9a33",io.openshift.build.commit.ref="release/Test",io.openshift.build.commit.message="Added environment"\nIncremental Build:\t\tdisabled\nRemove Old Build:\t\tdisabled\nBuilder Pull Policy:\t\talways\nPrevious Image Pull Policy:\t\nQuiet:\t\t\t\tdisabled\nLayered Build:\t\t\tdisabled\nWorkdir:\t\t\t/tmp\nDocker Endpoint:\t\tn/a\nDocker Pull Config:\t\t/var/run/secrets/openshift.io/pull\nDocker Pull User:\t\t\nInjections:\t\t\t/var/run/secrets/openshift.io/build/secret-npmrc->\n" I0601 11:14:46.553507 1 builder.go:369] Starting S2I build from ci-bts/useranalyticswebservice-26 BuildConfig ... Generating dockerfile with builder image registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6 Checking for Docker config file for PULL_DOCKERCFG_PATH in path /var/run/secrets/openshift.io/pull I0601 11:14:46.559947 1 sti.go:453] Using Docker authentication configuration in '/var/run/secrets/openshift.io/pull/.dockercfg' Using Docker config file /var/run/secrets/openshift.io/pull/.dockercfg I0601 11:14:46.560490 1 builder.go:369] Replacing dockerfile FROM registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6 LABEL "io.openshift.build.commit.message"="Added environment"
"io.openshift.build.source-context-dir"="/UserAnalytics"
"io.openshift.build.image"="registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6"
"io.openshift.build.commit.author"="XXX"
"io.openshift.build.commit.date"="Wed Jun 1 11:27:22 2022 +0200"
"io.openshift.build.commit.id"="0b1c87b538f254a22f0ea44c73402ad345ec9a33"
"io.openshift.build.commit.ref"="release/Test" ENV NPM_MIRROR="https://XXX"
OPENSHIFT_BUILD_NAME="useranalyticswebservice-26"
OPENSHIFT_BUILD_NAMESPACE="ci-bts"
OPENSHIFT_BUILD_SOURCE="https://XXX"
OPENSHIFT_BUILD_REFERENCE="release/Test"
OPENSHIFT_BUILD_COMMIT="0b1c87b538f254a22f0ea44c73402ad345ec9a33"
NPM_MIRROR="https://XXX"
BUILD_LOGLEVEL="5" USER root /# Copying in source code COPY upload/src /tmp/src /# Copying in injected content COPY upload/injections/var/run/secrets/openshift.io/build/secret-npmrc /opt/app-root/src /# Change file ownership to the assemble user. Builder image must support chown command. RUN chown -R 1001:0 /tmp/src /opt/app-root/src USER 1001 /# Assemble script sourced from builder image based on user input or image metadata. /# If this file does not exist in the image, the build will fail. RUN /usr/libexec/s2i/assemble /# Cleaning up injected secret content RUN rm /opt/app-root/src/..2022_06_01_11_14_19.457287440/.npmrc &&
rm /opt/app-root/src/.npmrc /# Run script sourced from builder image based on user input or image metadata. /# If this file does not exist in the image, the build will fail. CMD /usr/libexec/s2i/run with: FROM registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6 LABEL "io.openshift.build.commit.message"="Added environment" "io.openshift.build.source-context-dir"="/UserAnalytics" "io.openshift.build.image"="registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6" "io.openshift.build.commit.author"="XXX" "io.openshift.build.commit.date"="Wed Jun 1 11:27:22 2022 +0200" "io.openshift.build.commit.id"="0b1c87b538f254a22f0ea44c73402ad345ec9a33" "io.openshift.build.commit.ref"="release/Test" ENV NPM_MIRROR="https://XXX" OPENSHIFT_BUILD_NAME="useranalyticswebservice-26" OPENSHIFT_BUILD_NAMESPACE="ci-bts" OPENSHIFT_BUILD_SOURCE="https://XXX" OPENSHIFT_BUILD_REFERENCE="release/Test" OPENSHIFT_BUILD_COMMIT="0b1c87b538f254a22f0ea44c73402ad345ec9a33" NPM_MIRROR="https://XXX" BUILD_LOGLEVEL="5" USER root COPY upload/src /tmp/src COPY upload/injections/var/run/secrets/openshift.io/build/secret-npmrc /opt/app-root/src RUN chown -R 1001:0 /tmp/src /opt/app-root/src USER 1001 RUN /usr/libexec/s2i/assemble RUN rm /opt/app-root/src/..2022_06_01_11_14_19.457287440/.npmrc && rm /opt/app-root/src/.npmrc CMD /usr/libexec/s2i/run Building... I0601 11:14:46.560623 1 daemonless.go:520] Setting authentication for registry "192.168.150.0:5000" at "192.168.150.0:5000". I0601 11:14:46.560887 1 daemonless.go:520] Setting authentication for registry "XXX" at "XXX". I0601 11:14:46.561185 1 daemonless.go:520] Setting authentication for registry "image-registry.openshift-image-registry.svc.cluster.local:5000" at "image-registry.openshift-image-registry.svc.cluster.local:5000". I0601 11:14:46.561541 1 daemonless.go:520] Setting authentication for registry "image-registry.openshift-image-registry.svc:5000" at "image-registry.openshift-image-registry.svc:5000". STEP 1: FROM registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6 STEP 2: LABEL "io.openshift.build.commit.message"="Added environment" "io.openshift.build.source-context-dir"="/UserAnalytics" "io.openshift.build.image"="registry.access.redhat.com/ubi8/dotnet-60@sha256:31d85024340ec48f9b06fe49f67b6a816062cb1d1a0b9b3cd79bc290e97f07f6" "io.openshift.build.commit.author"="XXX" "io.openshift.build.commit.date"="Wed Jun 1 11:27:22 2022 +0200" "io.openshift.build.commit.id"="0b1c87b538f254a22f0ea44c73402ad345ec9a33" "io.openshift.build.commit.ref"="release/Test" STEP 3: ENV NPM_MIRROR="https://XXX" OPENSHIFT_BUILD_NAME="useranalyticswebservice-26" OPENSHIFT_BUILD_NAMESPACE="ci-bts" OPENSHIFT_BUILD_SOURCE="https://XXX" OPENSHIFT_BUILD_REFERENCE="release/Test" OPENSHIFT_BUILD_COMMIT="0b1c87b538f254a22f0ea44c73402ad345ec9a33" NPM_MIRROR="https://XXX" BUILD_LOGLEVEL="5" STEP 4: USER root STEP 5: COPY upload/src /tmp/src STEP 6: COPY upload/injections/var/run/secrets/openshift.io/build/secret-npmrc /opt/app-root/src STEP 7: RUN chown -R 1001:0 /tmp/src /opt/app-root/src time="2022-06-01T11:14:48Z" level=warning msg="Path "/run/secrets/etc-pki-entitlement" from "/etc/containers/mounts.conf" doesn't exist, skipping" time="2022-06-01T11:14:48Z" level=warning msg="Path "/run/secrets/redhat.repo" from "/etc/containers/mounts.conf" doesn't exist, skipping" STEP 8: USER 1001 STEP 9: RUN /usr/libexec/s2i/assemble time="2022-06-01T11:14:49Z" level=warning msg="Path "/run/secrets/etc-pki-entitlement" from "/etc/containers/mounts.conf" doesn't exist, skipping" time="2022-06-01T11:14:49Z" level=warning msg="Path "/run/secrets/redhat.repo" from "/etc/containers/mounts.conf" doesn't exist, skipping" ---> Installing application source... Using SDK: 6.0.103 ---> Restoring application dependencies... Determining projects to restore... Restored /opt/app-root/src/UserAnalytics.csproj (in 969 ms). Restore completed successfully ---> Publishing application... Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Copyright (C) Microsoft Corporation. All rights reserved. UserAnalytics -> /opt/app-root/src/bin/Release/net6.0/UserAnalytics.dll /usr/bin/sh : warning : setlocale: LC_ALL: cannot change locale (en_US.UTF-8) [/opt/app-root/src/UserAnalytics.csproj] /usr/bin/sh : warning : setlocale: LC_ALL: cannot change locale (en_US.UTF-8) [/opt/app-root/src/UserAnalytics.csproj] npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash. npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@XXX - Not found npm ERR! 404 npm ERR! 404 '@XXX@^12.2.0' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 It was specified as a dependency of 'ClientApp' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! A complete log of this run can be found in: npm ERR! /opt/app-root/.npm/_logs/2022-06-01T11_15_26_269Z-debug.log /opt/app-root/src/UserAnalytics.csproj(37,5): error MSB3073: The command "npm install" exited with code 1. F0601 11:15:27.801991 1 helpers.go:115] error: build error: error building at STEP "RUN /usr/libexec/s2i/assemble": error while running runtime: exit status 1 goroutine 1 [running]: k8s.io/klog/v2.stacks(0xc000132001, 0xc0009a1180, 0xa5, 0x129) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:996 +0xb9 k8s.io/klog/v2.(*loggingT).output(0x2dfe260, 0xc000000003, 0x0, 0x0, 0xc0006ff420, 0x2b3951d, 0xa, 0x73, 0x410700) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:945 +0x191 k8s.io/klog/v2.(*loggingT).printDepth(0x2dfe260, 0x3, 0x0, 0x0, 0x2, 0xc001307998, 0x1, 0x1) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:718 +0x165 k8s.io/klog/v2.FatalDepth(...) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:1449 k8s.io/kubectl/pkg/cmd/util.fatal(0xc001578280, 0x76, 0x1) /go/src/github.com/openshift/builder/vendor/k8s.io/kubectl/pkg/cmd/util/helpers.go:93 +0x1f0 k8s.io/kubectl/pkg/cmd/util.checkErr(0x1fcf980, 0xc0008e95a0, 0x1e646a0) /go/src/github.com/openshift/builder/vendor/k8s.io/kubectl/pkg/cmd/util/helpers.go:188 +0x945 k8s.io/kubectl/pkg/cmd/util.CheckErr(...) /go/src/github.com/openshift/builder/vendor/k8s.io/kubectl/pkg/cmd/util/helpers.go:115 main.NewCommandS2IBuilder.func1(0xc000172000, 0xc000778200, 0x0, 0x1) /go/src/github.com/openshift/builder/cmd/builder.go:73 +0x85 github.com/spf13/cobra.(*Command).execute(0xc000172000, 0xc000128030, 0x1, 0x1, 0xc000172000, 0xc000128030) /go/src/github.com/openshift/builder/vendor/github.com/spf13/cobra/command.go:846 +0x2c2 github.com/spf13/cobra.(*Command).ExecuteC(0xc000172000, 0x13, 0xc000172000, 0x13) /go/src/github.com/openshift/builder/vendor/github.com/spf13/cobra/command.go:950 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /go/src/github.com/openshift/builder/vendor/github.com/spf13/cobra/command.go:887 main.main() /go/src/github.com/openshift/builder/cmd/main.go:68 +0x745 goroutine 19 [chan receive]: k8s.io/klog/v2.(*loggingT).flushDaemon(0x2dfe260) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:1131 +0x8b created by k8s.io/klog/v2.init.0 /go/src/github.com/openshift/builder/vendor/k8s.io/klog/v2/klog.go:416 +0xd8 goroutine 25 [chan receive]: k8s.io/klog.(*loggingT).flushDaemon(0x2dfe180) /go/src/github.com/openshift/builder/vendor/k8s.io/klog/klog.go:1010 +0x8b created by k8s.io/klog.init.0 /go/src/github.com/openshift/builder/vendor/k8s.io/klog/klog.go:411 +0xd8 goroutine 11 [chan receive, 1 minutes]: main.main.func1(0xc0002e3ec0) /go/src/github.com/openshift/builder/cmd/main.go:32 +0x38 created by main.main /go/src/github.com/openshift/builder/cmd/main.go:31 +0x14a goroutine 10 [syscall, 1 minutes]: os/signal.signal_recv(0x475b86) /usr/lib/golang/src/runtime/sigqueue.go:147 +0x9d os/signal.loop() /usr/lib/golang/src/os/signal/signal_unix.go:23 +0x25 created by os/signal.Notify.func1.1 /usr/lib/golang/src/os/signal/signal.go:150 +0x45 goroutine 12 [select]: k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0x1e64678, 0x1fd1b40, 0xc0006f6000, 0x1, 0xc00010ea20) /go/src/github.com/openshift/builder/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:167 +0x149 k8s.io/apimachinery/pkg/util/wait.JitterUntil(0x1e64678, 0x12a05f200, 0x0, 0x1, 0xc00010ea20) /go/src/github.com/openshift/builder/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x98 k8s.io/apimachinery/pkg/util/wait.Until(...) /go/src/github.com/openshift/builder/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:90 k8s.io/apimachinery/pkg/util/wait.Forever(0x1e64678, 0x12a05f200) /go/src/github.com/openshift/builder/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:81 +0x4f created by k8s.io/component-base/logs.InitLogs /go/src/github.com/openshift/builder/vendor/k8s.io/component-base/logs/logs.go:58 +0x8a goroutine 3034 [IO wait]: internal/poll.runtime_pollWait(0x7f86e6b454a0, 0x72, 0x1fd44a0) /usr/lib/golang/src/runtime/netpoll.go:222 +0x55 internal/poll.(*pollDesc).wait(0xc000852398, 0x72, 0x1fd4400, 0x2d78f48, 0x0) /usr/lib/golang/src/internal/poll/fd_poll_runtime.go:87 +0x45 internal/poll.(*pollDesc).waitRead(...) /usr/lib/golang/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0xc000852380, 0xc000ba7800, 0x1799, 0x1799, 0x0, 0x0, 0x0) /usr/lib/golang/src/internal/poll/fd_unix.go:159 +0x1a5 net.(*netFD).Read(0xc000852380, 0xc000ba7800, 0x1799, 0x1799, 0x203000, 0x7b2a5b, 0xc00111a4e0) /usr/lib/golang/src/net/fd_posix.go:55 +0x4f net.(*conn).Read(0xc000792088, 0xc000ba7800, 0x1799, 0x1799, 0x0, 0x0, 0x0) /usr/lib/golang/src/net/net.go:182 +0x8e crypto/tls.(*atLeastReader).Read(0xc00051b780, 0xc000ba7800, 0x1799, 0x1799, 0xe0e, 0x174d, 0xc000e11708) /usr/lib/golang/src/crypto/tls/conn.go:779 +0x62 bytes.(*Buffer).ReadFrom(0xc00111a600, 0x1fcf740, 0xc00051b780, 0x410b05, 0x1b19960, 0x1cacbe0) /usr/lib/golang/src/bytes/buffer.go:204 +0xb1 crypto/tls.(*Conn).readFromUntil(0xc00111a380, 0x1fd1e20, 0xc000792088, 0x5, 0xc000792088, 0xdfd) /usr/lib/golang/src/crypto/tls/conn.go:801 +0xf3 crypto/tls.(*Conn).readRecordOrCCS(0xc00111a380, 0x0, 0x0, 0xc000298480) /usr/lib/golang/src/crypto/tls/conn.go:608 +0x115 crypto/tls.(*Conn).readRecord(...) /usr/lib/golang/src/crypto/tls/conn.go:576 crypto/tls.(*Conn).Read(0xc00111a380, 0xc000e8b000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/lib/golang/src/crypto/tls/conn.go:1252 +0x15f bufio.(*Reader).Read(0xc002101c20, 0xc0006baf18, 0x9, 0x9, 0xc0020f4c60, 0xc000e11d18, 0x1e65100) /usr/lib/golang/src/bufio/bufio.go:227 +0x222 io.ReadAtLeast(0x1fcf4e0, 0xc002101c20, 0xc0006baf18, 0x9, 0x9, 0x9, 0xc0008e9120, 0xc000118050, 0x0) /usr/lib/golang/src/io/io.go:314 +0x87 io.ReadFull(...) /usr/lib/golang/src/io/io.go:333 golang.org/x/net/http2.readFrameHeader(0xc0006baf18, 0x9, 0x9, 0x1fcf4e0, 0xc002101c20, 0x0, 0x0, 0xc00085cf90, 0x0) /go/src/github.com/openshift/builder/vendor/golang.org/x/net/http2/frame.go:237 +0x89 golang.org/x/net/http2.(*Framer).ReadFrame(0xc0006baee0, 0xc00085cf90, 0x0, 0x0, 0x0) /go/src/github.com/openshift/builder/vendor/golang.org/x/net/http2/frame.go:492 +0xa5 golang.org/x/net/http2.(*clientConnReadLoop).run(0xc000e11fa8, 0x0, 0x0) /go/src/github.com/openshift/builder/vendor/golang.org/x/net/http2/transport.go:1794 +0xd8 golang.org/x/net/http2.(*ClientConn).readLoop(0xc000916900) /go/src/github.com/openshift/builder/vendor/golang.org/x/net/http2/transport.go:1716 +0x6f created by golang.org/x/net/http2.(*Transport).newClientConn /go/src/github.com/openshift/builder/vendor/golang.org/x/net/http2/transport.go:695 +0x66e
Thanks for the help.
Greetings
Andreas
Thanks for reporting this @ascholz
I'm not sure what is going on with the npmrc file, still looking at that, but the reason that NPM_MIRROR
isn't working is because it only gets checked and used if DOTNET_NPM_TOOLS
is also set. In fact, all of the npm related settings only get set if DOTNET_NPM_TOOLS
is set.
@tmds Maybe we should change that?
Yes, that make sense.
@ascholz, is this something you'd be interested in contributing? We'll support you if you have questions. Otherwise, we'll look into it.
@tmds sorry I don't have the time to contribute :-/
Since probably the ticket with the authentication is not implemented, the question is if there is still a solution for my .nmprc file which does not work.
@ascholz Hey, sorry about how long this has sat idle.
I've been trying to recreate this on our side and (after some trouble and experimenting) I think I might have a lead.
According to your logs, the npmrc secret is getting created here:
STEP 6: COPY upload/injections/var/run/secrets/openshift.io/build/secret-npmrc /opt/app-root/src
So the file is at path /opt/app-root/src/.npmrc
. (This seems normal to me)
But when I manually go and work with npm, it wants the file at /opt/app-root/.npmrc
.
If I put an .npmrc file at the first path (/opt/app-root/src
) npm does not pick up the config file. If I put it at the second path (/opt/app-root
) it suddenly starts seeing the configuration.
NPM expecting the config file at /opt/app-root seems odd to me, but maybe it isn't, I don't exactly work with it much
I'm still figuring out what to DO about this, but I thought I'd at least report back what I have so far.
@ascholz
Hey, as a test, can you try running your container with the following environment variable set in openshift?
npm_config_userconfig=/opt/app-root/src/.npmrc
Note: I consider this more of a workaround than a fix, but I want to make sure it works in a real case, and not just in the test that I've rigged up.
NPM expecting the config file at /opt/app-root seems odd to me, but maybe it isn't, I don't exactly work with it much
See https://docs.npmjs.com/cli/v8/configuring-npm/npmrc#files.
/opt/app-root
is HOME
, so this is the per-user file.
Based on the working directory, /opt/app-root/src/.npmrc
is the per-project file.
Settings are read from multiple files and combined.
@tmds Yeah, I realized that is the $HOME
file. But NPM is not picking up the file in the src folder as the project file. According to the docs, it should be looking for the .npmrc
file in the directory that is "a sibling of node_modules and package.json
", but when I try that in a container using the dotnet angular template, it doesn't pick it up their either.
Hey, as a test, can you try running your container with the following environment variable set in openshift? npm_config_userconfig=/opt/app-root/src/.npmrc
@ascholz can you try this?
One way of setting this is by adding an .s2i/environment
file to your source repo and add that line in there.
Or you can add it to the build environment variables in another way.
@tmds Sorry for the late response.I have now tried it and the pod is now building. Thanks for the workaround. My question is how do I start the Angular application? Because as it looks this does not start. At least I can't find any information about the port.
If we're keeping nodejs in .NET 8 (see https://github.com/redhat-developer/s2i-dotnetcore/issues/384) then we should include the fix for this issue.
For .NET 8 images, we are no longer including node. Closing as: won't fix.