Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

native Cache support for container jobs #59

Open
ThomasSteinbach opened this issue Apr 14, 2021 · 0 comments
Open

native Cache support for container jobs #59

ThomasSteinbach opened this issue Apr 14, 2021 · 0 comments

Comments

@ThomasSteinbach
Copy link
Contributor

ThomasSteinbach commented Apr 14, 2021

What should gcip do differently? Which functionality do you think we should add?

Current (shortened) implementation of...

def build_scan_push_image(
) -> Sequence:

    cache = Cache(paths=["image"])
    kaniko_execute = kaniko.execute(
        tar_path=cache.paths[0],
    )
    kaniko_execute.set_cache(cache)

    dive_scan = dive.scan(
        image_path=cache.paths[0],
    )
    dive_scan.set_cache(cache)

    trivy_scan = trivy.scan_local_image(
        image_path=cache.paths[0],
    )
    trivy_scan.set_cache(cache)

    crane_push = crane.push(
        tar_path=cache.paths[0],
    )
    crane_push.set_cache(cache)

Modify the container jobs such that following would be possible:

def build_scan_push_image(
) -> Sequence:

    # when `create_cache=True` then the returned job was initialized with a cache object
    kaniko_execute = kaniko.execute(
        create_cache=True,
    )

    # all other functions can request that cache object from the `kaniko_execute` job.
    # This requires to extend the job class exposing its cache as @property.
    # (In general we could expose most of a jobs attributes as @properties)
    dive_scan = dive.scan(
        image_from_cache=kaniko_execute.cache,
    )

    trivy_scan = trivy.scan_local_image(
        image_from_cache=kaniko_execute.cache,
    )

    crane_push = crane.push(
        tar_from_cache=kaniko_execute.cache,
    )

What are you trying to do? What problem would this solve?

All those container methods are job generators which should make native use of the Cache class. They should create or use a Cache object, so that the user doesn't have to mess around with the use of a cache.

Did gcip help you today? Did it make you happy in any way?

Pipeline as Code is awesome.

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

1 participant