WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

native Cache support for container jobs #59

@ThomasSteinbach

Description

@ThomasSteinbach

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions