Check if config fields are nil
This commit is contained in:
		
							parent
							
								
									20b659aa32
								
							
						
					
					
						commit
						a8ecbbd365
					
				|  | @ -33,6 +33,9 @@ func (r *ExposeCommand) ExecuteCommand(config *manifest.Schema2Config) error { | ||||||
| 	logrus.Info("cmd: EXPOSE") | 	logrus.Info("cmd: EXPOSE") | ||||||
| 	// Grab the currently exposed ports
 | 	// Grab the currently exposed ports
 | ||||||
| 	existingPorts := config.ExposedPorts | 	existingPorts := config.ExposedPorts | ||||||
|  | 	if existingPorts == nil { | ||||||
|  | 		existingPorts = make(map[manifest.Schema2Port]struct{}) | ||||||
|  | 	} | ||||||
| 	// Add any new ones in
 | 	// Add any new ones in
 | ||||||
| 	for _, p := range r.cmd.Ports { | 	for _, p := range r.cmd.Ports { | ||||||
| 		// Resolve any environment variables
 | 		// Resolve any environment variables
 | ||||||
|  |  | ||||||
|  | @ -35,7 +35,9 @@ func (r *LabelCommand) ExecuteCommand(config *manifest.Schema2Config) error { | ||||||
| 
 | 
 | ||||||
| func updateLabels(labels []instructions.KeyValuePair, config *manifest.Schema2Config) error { | func updateLabels(labels []instructions.KeyValuePair, config *manifest.Schema2Config) error { | ||||||
| 	existingLabels := config.Labels | 	existingLabels := config.Labels | ||||||
| 
 | 	if existingLabels == nil { | ||||||
|  | 		existingLabels = make(map[string]string) | ||||||
|  | 	} | ||||||
| 	// Let's unescape values before setting the label
 | 	// Let's unescape values before setting the label
 | ||||||
| 	for index, kvp := range labels { | 	for index, kvp := range labels { | ||||||
| 		unescaped, err := util.ResolveEnvironmentReplacement(kvp.Value, []string{}, false) | 		unescaped, err := util.ResolveEnvironmentReplacement(kvp.Value, []string{}, false) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue