Skip to content

Checkmarx/containers-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containers Types

A Go module for handling images in Docker, Docker Compose, and Helm files. This module provides structures and utilities to manage image information across different types of files in a Kubernetes environment.

Installation

go get github.com/Checkmarx/containers-types

Usage

Importing the Module

import "github.com/Checkmarx/containers-types"

File Structures

FileImages

type FileImages struct {
    Dockerfile    []FilePath
    DockerCompose []FilePath
    Helm          []HelmChartInfo
}

FilePath

type FilePath struct {
    FullPath     string
    RelativePath string
}

ImageModel

type ImageModel struct {
    Name           string
    ImageLocations []ImageLocation
}

HelmChartInfo

type HelmChartInfo struct {
    Directory     string     // Absolute path to the Helm chart directory
    ValuesFile    string     // Relative path to the values.yaml file
    TemplateFiles []FilePath // Relative paths to template files
}

ImageLocation

type ImageLocation struct {
    Origin string
    Path   string
}

Constants

const (
    UserInput               = "UserInput"
    DockerFileOrigin        = "Dockerfile"
    DockerComposeFileOrigin = "DockerCompose"
    HelmFileOrigin          = "Helm"
    NoFilePath              = "NONE"
)

Microservice

type Microservice struct {
    Spec struct {
        Image struct {
            Registry string yaml:"registry"
            Name     string yaml:"name"
            Tag      string yaml:"tag"
        } yaml:"image"
    } yaml:"spec"
}

Functions

ToImageModels

Converts a list of image names into a list of ImageModel structures, marking them as user input with no specific file paths.

func ToImageModels(images []string) []ImageModel {
    var imageNames []ImageModel

    for _, image := range images {
        imageNames = append(imageNames, ImageModel{
            Name: image,
            ImageLocations: []ImageLocation{
                {
                    Origin: UserInput,
                    Path:   NoFilePath,
                },
            },
        })
    }

    return imageNames
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages