Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

[atomic scan] Get image name in atomic scanner #1190

Open
navidshaikh opened this issue Feb 20, 2018 · 5 comments
Open

[atomic scan] Get image name in atomic scanner #1190

navidshaikh opened this issue Feb 20, 2018 · 5 comments

Comments

@navidshaikh
Copy link
Contributor

I am writing an atomic scanner for a use case where the scanner needs to know the image_name being processed.

Now, I get the image name by explicitly setting an env variable while invoking the atomic scan command like

IMAGE_NAME=<image_name> atomic scan [..]

what's the better way to get image_name without explicitly have to ask for providing env var along with atomic scan command?

@rhatdan
Copy link
Member

rhatdan commented Feb 21, 2018

Currently I don't believe we leak that information into the container?
@baude PTAL

@navidshaikh
Copy link
Contributor Author

There is (meta)data with the image itself which could help atomic scanners to implement different use cases.
For example, accessing Labels of image under-scan, within atomic scanner for processing.

How I am achieving that right now is

  • Provide env var specifying image name while invoking atomic scan and os.environ.get within scanner
  • Using Atomic.run.Run().get_label() to access the Labels.

If we can provide an interface for atomic scanners (say via Atomic) to retrieve metadata related information for image under scan, that should be helpful.

@baude
Copy link
Member

baude commented Feb 21, 2018

@navidshaikh do you want only on the image name ?

@baude
Copy link
Member

baude commented Feb 21, 2018

@navidshaikh and you want all this before the scan is run correct?

@navidshaikh
Copy link
Contributor Author

navidshaikh commented Feb 21, 2018

@baude

do you want only on the image name?

  1. Image name
  2. The dictionary/hash printed by docker inspect (only interested in the Labels part right now, but other information can be useful as well)

Labels part can be achieved, if image name can be retrieved.
Like:

from Atomic import run
run_object = run.Run()
run_object.image = IMAGE_NAME
label = run_object.get_label("LABEL_NAME")

and you want all this before the scan is run correct?

Correct. Basically, a way to access that information in the atomic scanner itself.

For eg: My use case is, write an atomic scanner which reads Labels of image under test and perform foo, bar actions based on data in Labels.

baude added a commit to baude/atomic that referenced this issue Feb 21, 2018
Issue projectatomic#1190 asks for an enhancement to atomic scan where
the scanner could figure out the image|container inspect
information prior to the scan.  We do this now by writing
a file in the scanout/ dir.  The file is JSON formatted
and could be ingested by a scanner that needed that type
of information.  The path should bexi
/scanout/inspect_info.json.

Signed-off-by: baude <bbaude@redhat.com>
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

3 participants