Repository navigation
Releases: pyTooling/pyTooling.GitLab
Releases · pyTooling/pyTooling.GitLab
Release list
v0.1.0-rc1
Note
The first release candidate of v0.1.0. It requires pyTooling v10.0.0-rc3 or later and, for the extra sphinx, pyTooling.Sphinx v0.1.0-rc3 or later - both pre-releases on PyPI.
- ✨ The package
pyTooling.GitLabwith its metadata - a sub-namespace of pyTooling, like pyTooling.GitHub. - ✨
GitLabError, the base exception; the requirements and the extrasdiagramandsphinx. - ✨
pyTooling.GitLab.PipelineFile: a pipeline configuration file with its inputs, stages, variables, jobs, their needs, rules, parallel instances and triggers, and the keysworkflow,includeanddefault;extends,!referencetags and defaults are merged into the jobs as GitLab does; a file converts into thepyTooling.CIpipeline it defines, reading its local includes and child pipelines (#7, #10, #12, #14, #16, #18, #19, #20, #21). - ✨ The pipeline run model: jobs, matrix instances, pipelines, downstream pipelines and pipeline groups as GitLab's REST API reports them, a client of that API for one project, and the dependencies a pipeline file's stages and needs imply (#8, #11, #13).
- ✨ Pipeline traces: a pipeline read from GitLab's REST API as a software execution trace, for OTLP/JSON and Gantt charts (#15), and the program
pytooling-gitlabwriting them (#17). - ✨ The Sphinx domain
glci: the directiveglci:pipelinedocuments a pipeline file,glci:inputandglci:variableits parameters; parameter tables, the interface, the dependencies and YAML excerpts summarize it,glci:pipeline-graphdraws it (#22, #23, #24, #25, #26). - 📖 The documentation, structured as pyTooling.GitHub's: data models, Sphinx domain
glci, visualization, program, reports. - ⚙️ The pipeline on pyTooling/Actions'
CompletePipeline.
First release of pyTooling.GitLab, to work with GitLab CI/CD pipelines: a data model of pipeline configuration files (.gitlab-ci.yml, included files, child pipelines' files) and the pyTooling.CI pipeline they define; pipeline runs read from GitLab's REST API and their conversion into traces (OpenTelemetry's OTLP/JSON, Gantt charts), also by the program pytooling-gitlab; and the Sphinx domain glci, which documents pipeline files.
✨ New Features
pyTooling.GitLab: the package, holding its metadata only -__version__ = "0.1.0rc1", author, copyright, license, keywords, project, documentation and issue tracker URLs (#1).pyTooling.GitLab.GitLabError(derived frompyTooling.CI.CIError): the base exception of the package (#5).pyTooling.GitLab.PipelineFile(#7): a data model of a GitLab CI/CD configuration file (.gitlab-ci.yml, an included file, a child pipeline's file), read with ruamel.yaml - the counterpart of pyTooling.GitHub'sWorkflowFile. This release reads a file's stages, variables, jobs, needs, rules and the keysworkflow,includeanddefault, and builds the pipeline the file defines.PipelineFile.FromFile(path)reads a file; an optional header document holdingspec(separated by---) is accepted.PipelineFile.DeclaredStages(thestageskey as written) andPipelineFile.Stages(declared or the default build, test, deploy, always between.preand.post).Variable: a variable of the top-levelvariablesor of a job -Value,Description,Options,Expand.Job(#10): a top-level key is a job unless it is a global keyword (RESERVED_KEYS); a key starting with a dot is a hidden job.PipelineFile.JobsandPipelineFile.HiddenJobskeep them apart, withJobCount,ContainsJob(),IterateJobs(),IterateHiddenJobs().- A job's
Stage(testif it names none, checked againstPipelineFile.Stages),Script/BeforeScript/AfterScript,When(apyTooling.CI.RuleOutcome, #30),AllowFailureandAllowedExitCodes,Image,Services,Environment,Tagsand itsVariables(#10). Need(#12): an entry of a job'sneeds, withKind(enumerationNeedKind): a job of the same pipeline, a job of another pipeline of the parent-child hierarchy, a job of another project's pipeline, or another project's pipeline whose status the job mirrors.Job.NeedsisNonewithout aneedskey and empty forneeds: [];Job.NeededJobsandNeed.NeededJobresolve needs of the same pipeline to the file's jobs.FromFilechecks that a job needs only jobs of the file (an optional need may name a missing one) and that the jobs don't need each other in a cycle (#12).Rule(#14): a rule ofrules, kept as written, not evaluated -Condition(if),ChangesandCompareTo,Exists, andWhen,AllowFailureandVariablesapplying if it matches;Job.Rules.Workflow(#14): theworkflowkey - the pipeline'sNameand itsRules;PipelineFile.Workflow.Include(#16): an entry ofinclude-Kind(enumerationIncludeKind: local, project, remote, template, component),Locationas written,FilesandRefof another project, theInputsit passes and itsRules;PipelineFile.Includes. The included files aren't read.Default(#16): thedefaultkey -Image,Services,Tags,BeforeScript,AfterScript, also read from the deprecated global keywords unlessdefaultsets them;PipelineFile.Default.- A job's keys are merged as GitLab merges them, before the job is built (#18):
!referencetags are replaced by what they refer to (a referred list is spliced into a list, nesting up toMAX_REFERENCE_DEPTH= 10);extendsdeep-merges the extended jobs in order, then the job's own keys, per GitLab's merge rules (up toMAX_EXTENDS_DEPTH= 11 levels, a cycle is an error;Job.Extendskeeps the names); a job gets the keys ofdefaultit doesn't set, unlessinherit.defaultsays otherwise. Every key keeps the line it is written at. Job.Unresolved(#18): in a file including other files, a job may extend or refer to jobs of the included files, which aren't read; the job is built from what the file has, andUnresolvednames what it lacks. A file including no files must have everything it refers to.Parallel(#19): a job'sparallel- aCount, or aMatrix;Combinationsholds one combination per instance in GitLab's order,InstanceNamesthe names GitLab gives the instances (test 1/3,deploy: [aws, app1]);Job.Parallel, andNeed.Parallelforneeds:parallel:matrix.Trigger(#19): a job'strigger- a child pipeline's files asIncludes, or another project'sProjectandBranch;Strategy(enumerationTriggerStrategy: depend, mirror),IsChildPipeline;Job.Trigger.IncludeKind.ArtifactandInclude.ArtifactJobinclude a job's artifact (a dynamic child pipeline).Input(#20): an input of the header'sspec:inputs-Type(enumerationInputType),Default,Required,Description,Options,Regex, conditionalRules;PipelineFile.InputsandPipelineFile.Description. A job'sinputs(GitLab 18.10) areInputs too;Job.Inputs. A default is checked against the type and the options.- A stage or a needed job interpolating an input (
$[[ inputs.stage ]]) is known when the file is included only, so it isn't checked against the stages or the jobs (#20). PipelineFile.ToPipeline(resolver=None, depth=None)(#21): thepyTooling.CIpipeline a file defines, as pyTooling maps GitLab CI onto it - a job becomes aDefinedJob, a job withparallelaDefinedMatrixofDefinedMatrixJobs, a trigger job aDefinedWorkflow(DefinedMatrixWorkflowper instance);DefinedPipelineis named byworkflow:nameor the file's name. Stage order implies needs unlessneedsreplaces them; matrix instances are named as GitLab names them (test: [3.14, linux],test 1/3); every element links back to its job byDefinitionMixin.Definition. Each element carries onepyTooling.CI.Ruleper rule of its job - the rule'sif, itswhen(else the job's, elseon_success), andchanges,compare_to,exists,allow_failure,variablesas key-value-pairs; a job withwhenbut no rules gets one rule without condition;workflow:rulesare the pipeline's rules (#30).IncludeResolver(root)(#21): reads local includes from a repository's directory, each file once;PipelineFile.FromFile(path, resolver)then resolvesextendsand!referenceinto the included files. A trigger job's child pipeline is expanded into its workflow when the resolver reads its files, limited bydepth.- Every element knows its
Parent, itsPipelineFile, itsLineand itsLocation(.gitlab-ci.yml:42) (#10);PipelineFileError(GitLabError)carriesPathandLine.
- The pipeline run model (#8, #11, #13): what GitLab's REST API reports about jobs, pipelines and downstream pipelines.
Status: GitLab's 13 job and pipeline statuses; an unknown value is aGitLabErrorwhose note lists the known values.Status.ToOutcome()maps a status topyTooling.CI's outcome.Source: the 20 pipeline sources ofCI_PIPELINE_SOURCE.StatusMixin(status, failure reason, URL) andJobMixin(identifier, stage,allow_failure, queued duration).Job(pyTooling.CI.Job, StatusMixin, JobMixin)with runner and requested runner tags,Job.Parse(json);MatrixJobfor an instance ofparallel:matrixorparallel: N.ProjectClient(pyTooling.REST.RESTClient)(#11): a client of GitLab's REST API for one project, given by its numeric identifier or its path;apiURLreaches a self-managed instance.GetJSONArray(resourcePath, pageSize=100)reads a list GitLab answers as a JSON array, following theLink: rel="next"pages.Pipeline(pyTooling.CI.Pipeline, StatusMixin, PipelineContentsMixin)(#11): identifier, project number (IID), project identifier, source, reference, commit,IsTag, queued duration;Pipeline.Parse(pipeline, jobs). Jobs are added in the order GitLab created them, matrix instances grouped below apyTooling.CI.Matrix; a pipeline withoutworkflow:nameis na...