-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Resource result output, and add support for Git resources.
This change builds upon #1406, and logs the exact Git commit used by a Git input to the ResourceResults field. Some other cleanups are included: - Removing custom TerminationMessagePath from the Image resource. The default is fine. - Test cleanup. - A new helper to write termination messages from resource containers. And finally, this adds a new environment variable to the git resource steps, indicating the name of the resource instance they are running as. We should make this more generic and apply it to all resource steps as part of the extensiblity refactor.
- Loading branch information
Showing
14 changed files
with
291 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2019 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package termination | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
"os" | ||
|
||
v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" | ||
"go.uber.org/zap" | ||
) | ||
|
||
func WriteMessage(logger *zap.SugaredLogger, path string, pro []v1alpha1.PipelineResourceResult) { | ||
jsonOutput, err := json.Marshal(pro) | ||
if err != nil { | ||
logger.Fatalf("Error marshaling json: %s", err) | ||
} | ||
f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0666) | ||
if err != nil { | ||
log.Fatalf("Unexpected error converting output to json %v: %v", pro, err) | ||
} | ||
defer f.Close() | ||
|
||
_, err = f.Write(jsonOutput) | ||
if err != nil { | ||
logger.Fatalf("Unexpected error converting output to json %v: %v", pro, err) | ||
} | ||
if err := f.Sync(); err != nil { | ||
logger.Fatalf("Unexpected error converting output to json %v: %v", pro, err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.