@@ -66,78 +66,108 @@ type Docker struct {
6666// BuildRequest contains all the information required for a language
6767// container to run the build command.
6868type BuildRequest struct {
69- // cfg is a pointer to the [config.Config] struct, holding general configuration
70- // values parsed from flags or environment variables.
71- Cfg * config.Config
72- // state is a pointer to the [config.LibrarianState] struct, representing
73- // the overall state of the generation and release pipeline.
74- State * config.LibrarianState
75- // libraryID specifies the ID of the library to build.
69+ // HostMount specifies a mount point from the Docker host into the Docker
70+ // container. The format is "{host-dir}:{local-dir}".
71+ HostMount string
72+
73+ // LibraryID specifies the ID of the library to build.
7674 LibraryID string
75+
7776 // RepoDir is the local root directory of the language repository.
7877 RepoDir string
78+
79+ // State is a pointer to the [config.LibrarianState] struct, representing
80+ // the overall state of the generation and release pipeline.
81+ State * config.LibrarianState
7982}
8083
8184// ConfigureRequest contains all the information required for a language
8285// container to run the configure command.
8386type ConfigureRequest struct {
84- // cfg is a pointer to the [config.Config] struct, holding general configuration
85- // values parsed from flags or environment variables.
86- Cfg * config.Config
87- // state is a pointer to the [config.LibrarianState] struct, representing
88- // the overall state of the generation and release pipeline.
89- State * config.LibrarianState
90- // apiRoot specifies the root directory of the API specification repo.
87+ // ApiRoot specifies the root directory of the API specification repo.
9188 ApiRoot string
89+
90+ // HostMount specifies a mount point from the Docker host into the Docker
91+ // container. The format is "{host-dir}:{local-dir}".
92+ HostMount string
93+
9294 // libraryID specifies the ID of the library to configure.
9395 LibraryID string
96+
9497 // RepoDir is the local root directory of the language repository.
9598 RepoDir string
99+
100+ // State is a pointer to the [config.LibrarianState] struct, representing
101+ // the overall state of the generation and release pipeline.
102+ State * config.LibrarianState
96103}
97104
98105// GenerateRequest contains all the information required for a language
99106// container to run the generate command.
100107type GenerateRequest struct {
101- // cfg is a pointer to the [config.Config] struct, holding general configuration
102- // values parsed from flags or environment variables.
103- Cfg * config.Config
104- // state is a pointer to the [config.LibrarianState] struct, representing
105- // the overall state of the generation and release pipeline.
106- State * config.LibrarianState
107- // apiRoot specifies the root directory of the API specification repo.
108+ // ApiRoot specifies the root directory of the API specification repo.
108109 ApiRoot string
109- // libraryID specifies the ID of the library to generate.
110+
111+ // HostMount specifies a mount point from the Docker host into the Docker
112+ // container. The format is "{host-dir}:{local-dir}".
113+ HostMount string
114+
115+ // LibraryID specifies the ID of the library to generate.
110116 LibraryID string
111- // output specifies the empty output directory into which the command should
117+
118+ // Output specifies the empty output directory into which the command should
112119 // generate code
113120 Output string
121+
114122 // RepoDir is the local root directory of the language repository.
115123 RepoDir string
124+
125+ // State is a pointer to the [config.LibrarianState] struct, representing
126+ // the overall state of the generation and release pipeline.
127+ State * config.LibrarianState
116128}
117129
118130// ReleaseInitRequest contains all the information required for a language
119131// container to run the init command.
120132type ReleaseInitRequest struct {
121- // Cfg is a pointer to the [config.Config] struct, holding general configuration
122- // values parsed from flags or environment variables.
123- Cfg * config.Config
133+ // Branch is the remote branch of the language repository to use.
134+ Branch string
135+
136+ // Commit determines whether to create a commit for the release but not
137+ // create a pull request. This flag is ignored if Push is set to true.
138+ Commit bool
139+
140+ // HostMount is used to remap Docker mount paths when running in environments
141+ // where Docker containers are siblings (e.g., Kokoro).
142+ // It specifies a mount point from the Docker host into the Docker container.
143+ // The format is "{host-dir}:{local-dir}".
144+ HostMount string
145+
124146 // LibrarianConfig is a pointer to the [config.LibrarianConfig] struct, holding
125147 // global files configuration in a language repository.
126148 LibrarianConfig * config.LibrarianConfig
127- // State is a pointer to the [config.LibrarianState] struct, representing
128- // the overall state of the generation and release pipeline.
129- State * config.LibrarianState
149+
130150 // LibraryID specifies the ID of the library to release.
131151 LibraryID string
152+
132153 // LibraryVersion specifies the version of the library to release.
133154 LibraryVersion string
155+
134156 // Output specifies the empty output directory into which the command should
135157 // generate code.
136158 Output string
159+
137160 // PartialRepoDir is the local root directory of language repository contains
138161 // files that make up libraries and global files.
139162 // This is the directory that container can access.
140163 PartialRepoDir string
164+
165+ // Push determines whether to push changes to GitHub.
166+ Push bool
167+
168+ // State is a pointer to the [config.LibrarianState] struct, representing
169+ // the overall state of the generation and release pipeline.
170+ State * config.LibrarianState
141171}
142172
143173// New constructs a Docker instance which will invoke the specified
@@ -184,8 +214,7 @@ func (c *Docker) Generate(ctx context.Context, request *GenerateRequest) error {
184214 fmt .Sprintf ("%s:/output" , request .Output ),
185215 fmt .Sprintf ("%s:/source:ro" , request .ApiRoot ), // readonly volume
186216 }
187-
188- return c .runDocker (ctx , request .Cfg .HostMount , CommandGenerate , mounts , commandArgs )
217+ return c .runDocker (ctx , request .HostMount , CommandGenerate , mounts , commandArgs )
189218}
190219
191220// Build builds the library with an ID of libraryID, as configured in
@@ -212,7 +241,7 @@ func (c *Docker) Build(ctx context.Context, request *BuildRequest) error {
212241 "--repo=/repo" ,
213242 }
214243
215- return c .runDocker (ctx , request .Cfg . HostMount , CommandBuild , mounts , commandArgs )
244+ return c .runDocker (ctx , request .HostMount , CommandBuild , mounts , commandArgs )
216245}
217246
218247// Configure configures an API within a repository, either adding it to an
@@ -245,7 +274,7 @@ func (c *Docker) Configure(ctx context.Context, request *ConfigureRequest) (stri
245274 fmt .Sprintf ("%s:/source:ro" , request .ApiRoot ), // readonly volume
246275 }
247276
248- if err := c .runDocker (ctx , request .Cfg . HostMount , CommandConfigure , mounts , commandArgs ); err != nil {
277+ if err := c .runDocker (ctx , request .HostMount , CommandConfigure , mounts , commandArgs ); err != nil {
249278 return "" , err
250279 }
251280
@@ -277,7 +306,7 @@ func (c *Docker) ReleaseInit(ctx context.Context, request *ReleaseInitRequest) e
277306 fmt .Sprintf ("%s:/output" , request .Output ),
278307 }
279308
280- if err := c .runDocker (ctx , request .Cfg . HostMount , CommandReleaseInit , mounts , commandArgs ); err != nil {
309+ if err := c .runDocker (ctx , request .HostMount , CommandReleaseInit , mounts , commandArgs ); err != nil {
281310 return err
282311 }
283312
0 commit comments