Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Images built with riff-cnb don't show up in API requests for Harbor registry #33

Closed
trisberg opened this issue Feb 18, 2019 · 2 comments

Comments

@trisberg
Copy link
Member

trisberg commented Feb 18, 2019

This might be an issue that needs to be solved in the buildpacks or lifecycle projects but I'm adding it here as a start.

I have Harbor running and can push and pull images from it using docker CLI.

If I run this:

riff function create hello --git-repo https://github.com/projectriff-samples/hello.js --artifact hello.js \
  --image harbor.springdeveloper.com/pub/hello --verbose

I get the image pushed and function starts running.

$ riff function create hello --git-repo https://github.com/projectriff-samples/hello.js --artifact hello.js --image harbor.springdeveloper.com/pub/hello --verbose
Waiting for LatestCreatedRevisionName
Waiting on function creation: function creation incomplete: service status unknown: RevisionMissing: Configuration "hello" is waiting for a Revision to become ready.
LatestCreatedRevisionName available: hello-00001
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 Trying group of 5...
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 ======== Output: NPM Buildpack ========
default/hello-00001-pod-9b721e[build-step-detect]: no "package.json" found at: /workspace/package.json
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 ======== Results ========
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 Cloud Foundry OpenJDK Buildpack: pass
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 Node.js Buildpack: pass
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 Cloud Foundry Build System Buildpack: skip
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 NPM Buildpack: skip
default/hello-00001-pod-9b721e[build-step-detect]: 2019/02/18 15:52:28 riff Buildpack: pass
default/hello-00001-pod-9b721e[build-step-analyze]: 2019/02/18 15:52:31 WARNING: image 'harbor.springdeveloper.com/pub/hello' not found or requires authentication to access
default/hello-00001-pod-9b721e[build-step-build]: -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M5
default/hello-00001-pod-9b721e[build-step-build]: 
default/hello-00001-pod-9b721e[build-step-build]: -----> Node.js Buildpack 0.0.2
default/hello-00001-pod-9b721e[build-step-build]: -----> NodeJS 11.4.0: Contributing to layer
default/hello-00001-pod-9b721e[build-step-build]:        Downloading from https://nodejs.org/dist/v11.4.0/node-v11.4.0-linux-x64.tar.gz
default/hello-00001-pod-9b721e[build-step-build]:        Verifying checksum
default/hello-00001-pod-9b721e[build-step-build]:        Expanding to /layers/org.cloudfoundry.buildpacks.nodejs/node
default/hello-00001-pod-9b721e[build-step-build]:        Writing NODE_HOME to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing NODE_ENV to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing NODE_MODULES_CACHE to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing NODE_VERBOSE to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing NPM_CONFIG_PRODUCTION to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing NPM_CONFIG_LOGLEVEL to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing WEB_MEMORY to shared
default/hello-00001-pod-9b721e[build-step-build]:        Writing WEB_CONCURRENCY to shared
default/hello-00001-pod-9b721e[build-step-build]: -----> riff Buildpack 0.2.0-BUILD-SNAPSHOT
default/hello-00001-pod-9b721e[build-step-build]: -----> riff Node Invoker 0.1.0: Contributing to layer
default/hello-00001-pod-9b721e[build-step-build]:        Reusing cached download from buildpack
default/hello-00001-pod-9b721e[build-step-build]:        Expanding to /layers/io.projectriff.riff/riff-invoker-node
default/hello-00001-pod-9b721e[build-step-build]:        npm-installing the node invoker
default/hello-00001-pod-9b721e[build-step-build]: added 76 packages from 60 contributors and audited 524 packages in 2.395s
default/hello-00001-pod-9b721e[build-step-build]: found 3 moderate severity vulnerabilities
default/hello-00001-pod-9b721e[build-step-build]:   run `npm audit fix` to fix them, or `npm audit` for details
default/hello-00001-pod-9b721e[build-step-build]:        Writing HOST to launch
default/hello-00001-pod-9b721e[build-step-build]:        Writing HTTP_PORT to launch
default/hello-00001-pod-9b721e[build-step-build]: -----> NodeJS hello.js: Contributing to layer
default/hello-00001-pod-9b721e[build-step-build]:        Writing FUNCTION_URI to launch
default/hello-00001-pod-9b721e[build-step-build]: -----> Process types:
default/hello-00001-pod-9b721e[build-step-build]:        web:      node /layers/io.projectriff.riff/riff-invoker-node/server.js
default/hello-00001-pod-9b721e[build-step-build]:        function: node /layers/io.projectriff.riff/riff-invoker-node/server.js
default/hello-00001-pod-9b721e[build-step-build]: 
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:40 caching unexported layer 'org.cloudfoundry.buildpacks.nodejs/4ef7dea131453da3a93cc1f32bff948da8953958dcbe3b413debae8bb41aa7a0'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:40 caching launch layer 'org.cloudfoundry.buildpacks.nodejs/node' with sha 'sha256:591279fb5d9e451b134c112b86d459baf2f6143cc8628af6969073380cec93d6'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:40 removing uncached layer 'io.projectriff.riff/function'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:40 removing uncached layer 'io.projectriff.riff/riff-invoker-node'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:41 adding layer 'app' with diffID 'sha256:c4857bb76413f87a896a045a0f11fe9b4f4adadf697e36f01914ce18a22c8321'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:41 adding layer 'config' with diffID 'sha256:788d039dca2f3950b3dbb1806d80588af4ca3a0cda5f1d2f8eed700fe3c87957'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:41 adding layer 'launcher' with diffID 'sha256:2ad3c2c97afc88259b030858502967f39de147e748dc42b859b50091262d8049'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:41 adding layer 'org.cloudfoundry.buildpacks.nodejs/node' with diffID 'sha256:591279fb5d9e451b134c112b86d459baf2f6143cc8628af6969073380cec93d6'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 adding layer 'io.projectriff.riff/function' with diffID 'sha256:40bb43c93848c7cd6d9491c81f374303c0c5947024ad308848df0a3077222556'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 adding layer 'io.projectriff.riff/riff-invoker-node' with diffID 'sha256:b4c044cef9ee2478246213c027b1612b03307430c1d8d4798e340bf984856c7c'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 setting metadata label 'io.buildpacks.lifecycle.metadata'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 setting env var 'PACK_LAYERS_DIR=/layers'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 setting env var 'PACK_APP_DIR=/workspace'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 setting entrypoint '/lifecycle/launcher'
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 setting empty cmd
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:43 writing image
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:7ade611080482d0fcaa6840b4df8352d01b8a3018b30f762a536140cd8dffcee
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:09b3ec4f3bede08b94d415ed2318e8766fb189bf31e69c9ed5d5db5055982f07
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:7f6e268c4bf3c282c066a17015e6c89268476592bb092a4577b6768790250dc3
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:46836b201a93dde5e8f1856785764d32460276e0e2ffba8e7f0dbb34c8ed3767
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:705054bc3f5bd722eb8f026532447fac897c521d8906eb36e79a60d0fb0606fa
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:7a427cee704cfd8d536e53bdf8107309cdebe534201963bb6578d7e028e58e79
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:2501aaff82c2d492dc3f4fd4f526fd3c2e7fd090297559566733f170d92d692f
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:7308e914506c09fa6d2242368545f55462e024f785e21b21b3e90403081a9336
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:c7051e0695642c5bf01467a4a64106cabfa20e57fee91b31ee73f7308bccf5bd
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:4c51b7d9e9ea44f5e1a432b04fd1d3a2accbcc8e8c2ba7455155a6661c868fb8
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:44 pushed blob sha256:eaab5fcd334de9b86a1844771d4f333e055da33c9eb603b6c53329ee9e10b83a
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:45 pushed blob sha256:2da8bfb3b5b741820e6cb29a71f66e8d944ddad2d00c6dc1e31461120ed39e46
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:45 pushed blob sha256:01e734c850498f929b8fb427f845545d3ebf3165afdb77c85a9f7dcbda1adc60
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:46 pushed blob sha256:b964be986659b0d5eaae45bbb22fc179096ef8f8f49d9dfc2d8f6c2a8920c6f6
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:50 pushed blob sha256:80e339c0631fb56471f967a9838454f62212fcf097b3424152b3a2cd266f52aa
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:54 pushed blob sha256:d3d2d352c91dfa8784df6da49f645c24b89c98b1ceee3d8dc0dc183073d94932
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:55 pushed blob sha256:38e2e6cd5626f31cea1a0a5751a9a7e6564c589a3388dcf84f00d4bb98146844
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:55 harbor.springdeveloper.com/pub/hello:latest: digest: sha256:7ae9a94324d2389a98b03d39e7e9f8bcea03a3b453e2315c7c5dce64401a3093 size: 2856
default/hello-00001-pod-9b721e[build-step-export]: 2019/02/18 15:52:55 
default/hello-00001-pod-9b721e[build-step-export]: *** Image: harbor.springdeveloper.com/pub/hello@sha256:7ae9a94324d2389a98b03d39e7e9f8bcea03a3b453e2315c7c5dce64401a3093
default/hello-00001-deployment-77946755fd-4m4pj[user-container]: Node started in 120ms
default/hello-00001-deployment-77946755fd-4m4pj[user-container]: Server starting with request-reply interaction model and payload argument type
default/hello-00001-deployment-77946755fd-4m4pj[user-container]: HTTP loaded in 123ms
default/hello-00001-deployment-77946755fd-4m4pj[user-container]: HTTP running on localhost:8080
default/hello-00001-deployment-77946755fd-4m4pj[user-container]: Function invoker started in 251ms

riff function create completed successfully

However, I can't see the image using the Harbor API:

$ curl -X GET -L -u trisberg:$HARBOR_PWD -w '\n' --header 'Accept: application/json' 'http://harbor.springdeveloper.com/api/repositories?project_id=7'
[]

I can pull the image

$ docker pull harbor.springdeveloper.com/pub/hello
Using default tag: latest
latest: Pulling from pub/hello
38e2e6cd5626: Already exists 
705054bc3f5b: Already exists 
c7051e069564: Already exists 
7308e914506c: Already exists 
2da8bfb3b5b7: Already exists 
4c51b7d9e9ea: Already exists 
80e339c0631f: Already exists 
01e734c85049: Already exists 
09b3ec4f3bed: Already exists 
2501aaff82c2: Already exists 
7a427cee704c: Pull complete 
7ade61108048: Pull complete 
b964be986659: Pull complete 
d3d2d352c91d: Pull complete 
7f6e268c4bf3: Pull complete 
eaab5fcd334d: Pull complete 
Digest: sha256:7ae9a94324d2389a98b03d39e7e9f8bcea03a3b453e2315c7c5dce64401a3093
Status: Downloaded newer image for harbor.springdeveloper.com/pub/hello:latest

I can push the image

$ docker push harbor.springdeveloper.com/pub/hello
The push refers to repository [harbor.springdeveloper.com/pub/hello]
b4c044cef9ee: Layer already exists 
40bb43c93848: Layer already exists 
591279fb5d9e: Layer already exists 
2ad3c2c97afc: Layer already exists 
788d039dca2f: Layer already exists 
c4857bb76413: Layer already exists 
fa4d876615d8: Layer already exists 
b68f13611ea3: Layer already exists 
72a6570c4422: Layer already exists 
3210aa063b89: Layer already exists 
b2fedec7b904: Layer already exists 
0e84b32bb1dd: Layer already exists 
27a216ffe825: Layer already exists 
9e9d3c3a7458: Layer already exists 
7604c8714555: Layer already exists 
adcb570ae9ac: Layer already exists 
latest: digest: sha256:ffab0c86d36c0c53c1c2699378450b216bcfe944c9db71d3a60426bd0dbbf6b1 size: 3661

And now I can see the image using the Harbor API:

$ curl -X GET -L -u trisberg:$HARBOR_PWD -w '\n' --header 'Accept: application/json' 'http://harbor.springdeveloper.com/api/repositories?project_id=7'
[
  {
    "id": 48,
    "name": "pub/hello",
    "project_id": 7,
    "description": "",
    "pull_count": 0,
    "star_count": 0,
    "tags_count": 1,
    "labels": [],
    "creation_time": "2019-02-18T15:57:04.565661Z",
    "update_time": "2019-02-18T15:57:04.565661Z"
  }
]
@scothis
Copy link
Member

scothis commented Aug 15, 2019

@trisberg have you seen this behavior with lifecycle 0.3?

@trisberg
Copy link
Member Author

This was fixed in Harbor v1.7.5 - goharbor/harbor#5729

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants