@@ -81,8 +81,9 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
81
81
}
82
82
83
83
func (p * PostProcessor ) PostProcess (ctx context.Context , ui packer.Ui , artifact packer.Artifact ) (a packer.Artifact , keep bool , forceOverride bool , err error ) {
84
+ isAmazonArtifact := contains (AmazonBuilderIds , artifact .BuilderId ())
84
85
var image string
85
- if contains ( AmazonBuilderIds , artifact . BuilderId ()) {
86
+ if isAmazonArtifact {
86
87
s := strings .Split (artifact .Id (), ":" )
87
88
image = s [1 ]
88
89
} else {
@@ -91,11 +92,20 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
91
92
92
93
if os .Getenv ("TEAMCITY_VERSION" ) != "" {
93
94
ui .Message (fmt .Sprintf ("##teamcity[setParameter name='packer.artifact.%v.id' value='%v']" , p .config .PackerBuildName , image ))
95
+
96
+ if isAmazonArtifact {
97
+ s := strings .Split (artifact .Id (), ":" )
98
+ region , ami := s [0 ], s [1 ]
99
+ ui .Message (fmt .Sprintf ("##teamcity[setParameter name='packer.artifact.%v.aws.region' value='%v']" , p .config .PackerBuildName , region ))
100
+ ui .Message (fmt .Sprintf ("##teamcity[setParameter name='packer.artifact.%v.aws.ami' value='%v']" , p .config .PackerBuildName , ami ))
101
+ } else {
102
+ ui .Message (fmt .Sprintf ("##teamcity[setParameter name='packer.artifact.last.id' value='%v']" , image ))
103
+ }
94
104
}
95
105
96
106
if p .config .TeamCityUrl != "" {
97
107
var url string
98
- if contains ( AmazonBuilderIds , artifact . BuilderId ()) {
108
+ if isAmazonArtifact {
99
109
url = fmt .Sprintf (
100
110
"%v/httpAuth/app/rest/projects/id:%v/projectFeatures/type:CloudImage,property(name:image-name-prefix,value:%v)/properties/amazon-id" ,
101
111
strings .TrimRight (p .config .TeamCityUrl , "/" ),
0 commit comments