Documentation
¶
Overview ¶
Package tiap implements a simplistic Industrial Edge .app file packager.
“tiap isn't app publisher.” In can be used instead of the Siemens Industrial Edge App Publisher and iectl tools that are either interactive or an un-wget-able CLI tool. In contrast, tiap is easily “go install”-able, including version pinning. Moreover, tiap doesn't need setting up clean workspaces, et cetera.
All that tiap needs: a “template” folder with the usual app project folder structure. This can be easily gotten by exporting a (new) project once and purging out the image files and the digest.json file. The structure thus is as follows:
- detail.json (but leave the versionNumber and versionId fields empty)
- $REPO/
- $REPO/appicon.png (150⨉150 pixels)
- $REPO/docker-compose.yml (or .yaml)
- $REPO/nginx (where necessary)
- $REPO/nginx/nginx.json
Here, $REPO is an almost arbitrary directory name (except for “images”) that is considered to be the app's “repository” name.
Please note that tiap doesn't lint the Docker composer project, except for:
- rejecting “:latest” image references (yes, we're more strict than IE App Publisher here for a reason),
- enforcing “mem_limit” service configuration.
Index ¶
- Constants
- func FileDigests(root string) (map[string]string, error)
- func SaveImageToFile(ctx context.Context, imageref string, platform string, savedir string, ...) (filename string, err error)
- func WriteDigests(w io.Writer, root string) error
- type App
- func (a *App) Done()
- func (a *App) Interpolate(vars map[string]string) error
- func (a *App) Package(out string) error
- func (a *App) PullAndWriteCompose(ctx context.Context, platform string, optclient daemon.Client) error
- func (a *App) SetDetails(semver string, releasenotes string, iearch string, vars map[string]string) error
- type ComposerProject
- func (p *ComposerProject) Images() (ServiceImages, error)
- func (cp *ComposerProject) Interpolate(vars map[string]string) error
- func (p *ComposerProject) PullImages(ctx context.Context, serviceimgs ServiceImages, platform string, root string, ...) error
- func (p *ComposerProject) Save(w io.Writer) error
- type ServiceImages
Constants ¶
const DefaultIEAppArch = "x86-64"
DefaultIEAppArch is the denormalized platform architecture name of the default "unnamed" architecture.
Variables ¶
This section is empty.
Functions ¶
func FileDigests ¶
FileDigests calculates the SHA256 digests of files inside the “root” directory and its subdirectories, and returns them as a map of filenames to SHA256 hex strings. The SHA256 hex strings do not contain a “sha256:” digist scheme prefix.
Please note that symbolic links are ignored.
func SaveImageToFile ¶
func SaveImageToFile(ctx context.Context, imageref string, platform string, savedir string, optclient daemon.Client, ) (filename string, err error)
SaveImageToFile checks if the referenced image (“imageref”) is either available locally for the specific platform or otherwise attempts to pull it, and then immediately saves it to local storage in the specified directory “savedir”. The name of the image file will be the image reference's SHA256. SaveImageToFile either reports success or a more specific error.
Please note that an attempt to find the referenced image with the local daemon is only made when a non-nil client has been passed in. Otherwise, always a pull is attempted only.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents an IE App (project) to be packaged.
func (*App) Interpolate ¶ added in v0.12.0
Interpolate all variables in the app's composer project using the specified variables, updating the project's YAML data accordingly. In case of interpolation problems, it returns an error, otherwise nil.
func (*App) Package ¶
Package (finally) packages the IE app project in a IE app package tar file indicated by “out”.
func (*App) PullAndWriteCompose ¶
func (a *App) PullAndWriteCompose( ctx context.Context, platform string, optclient daemon.Client, ) error
PullAndWriteCompose analyzes the project's compose deployment in order to pull the required container images, then saves the images into the temporary stage, and writes composer project.
func (*App) SetDetails ¶
func (a *App) SetDetails(semver string, releasenotes string, iearch string, vars map[string]string) error
SetDetails sets the semver (“versionNumber”, oh well) of this release, notes (if any) and optional architecture, and then writes a new “detail.json” into the build directory. This automatically sets the versionId to some suitable value behind the scenes. At least we think that it might be a suitable versionId value.
type ComposerProject ¶
type ComposerProject struct {
// contains filtered or unexported fields
}
ComposerProject represents a loaded Docker composer project.
func LoadComposerProject ¶
func LoadComposerProject(dir string) (*ComposerProject, error)
LoadComposerProject looks in the specified “dir” for a Docker composer project file and loads it. This takes the several official variations of composer project file names into account. However, contrary to Docker's composer, it doesn't look into parent directories for project files and it doesn't take overrides into account.
func NewComposerProject ¶
func NewComposerProject(path string) (*ComposerProject, error)
NewComposerProject reads the specified YAML file containing a (Docker) composer project and returns a ComposerProject object for it.
func (*ComposerProject) Images ¶
func (p *ComposerProject) Images() (ServiceImages, error)
Images returns the mapping between services defined in this composer project and the container images they reference.
func (*ComposerProject) Interpolate ¶ added in v0.12.0
func (cp *ComposerProject) Interpolate(vars map[string]string) error
Interpolate all variables in this composer project using the specified variables, updating the project's YAML data accordingly. In case of interpolation problems, it returns an error, otherwise nil.
func (*ComposerProject) PullImages ¶
func (p *ComposerProject) PullImages( ctx context.Context, serviceimgs ServiceImages, platform string, root string, optclient daemon.Client, ) error
PullImages takes a service-to-image reference mapping and pulls and saves the required container images. The caller is responsible to supply the correct "root" directory path inside which to place the images in a “image/” subdirectory. That is, the root path needs to reference the arbitrarily named “repository” folder.
type ServiceImages ¶
ServiceImages maps service names in Docker composer projects to their image references.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
tiap
tiap isn't app publisher, but packages Industrial Edge .app files anyway.
|
tiap isn't app publisher, but packages Industrial Edge .app files anyway. |
Package interpolate provides string interpolation from environment variables as per the Compose specification.
|
Package interpolate provides string interpolation from environment variables as per the Compose specification. |
test
|
|
grab
Package grab provides temporarily grabbing the structured log output, in form of JSON output, and later restoring it to its original configuration.
|
Package grab provides temporarily grabbing the structured log output, in form of JSON output, and later restoring it to its original configuration. |