Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase log output readability #837

Merged
merged 2 commits into from
Jul 26, 2021
Merged

Conversation

HeavyWombat
Copy link
Contributor

@HeavyWombat HeavyWombat commented Jul 21, 2021

Changes

The current output of the Git step was using the log style of the controller,
which is configured to be machine consumable. However, the output should be
more aligned with the output that is created by other steps. Tools like Kaniko
or Buildpacks produce more human style output. This is also feedback that we
received from users, especially in the case when the source retrieval failed for
some reason, for example TYPO of the branch name or similar.

Replace ctxlog with log and simplify log output to be human friendly.

Add new end message that contains all relevant details, including HEAD info.

For reference:

  • Before:
    {"level":"info","ts":1626871924.300413,"logger":"git","msg":"ssh","path":"/usr/bin/ssh","version":"OpenSSH_8.1p1, LibreSSL 2.7.3"}
    {"level":"info","ts":1626871924.319007,"logger":"git","msg":"git","path":"/usr/local/bin/git","version":"git version 2.32.0"}
    {"level":"info","ts":1626871924.3794508,"logger":"git","msg":"git-lfs","path":"/usr/local/bin/git-lfs","version":"git-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.5)"}
    {"level":"debug","ts":1626871924.379594,"logger":"git","msg":"/usr/local/bin/git clone --quiet --no-tags --single-branch --depth 1 -- https://github.com/shipwright-io/sample-go /tmp/workspace/source"}
    {"level":"debug","ts":1626871925.524959,"logger":"git","msg":"/usr/local/bin/git -C /tmp/workspace/source submodule update --init --recursive --depth 1"}
  • After:
    2021/07/21 14:39:15 Info: ssh (/usr/bin/ssh): OpenSSH_8.1p1, LibreSSL 2.7.3
    2021/07/21 14:39:15 Info: git (/usr/local/bin/git): git version 2.32.0
    2021/07/21 14:39:16 Info: git-lfs (/usr/local/bin/git-lfs): git-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.5)
    2021/07/21 14:39:16 /usr/local/bin/git clone --quiet --no-tags --single-branch --depth 1 -- https://github.com/shipwright-io/sample-go /tmp/workspace/source
    2021/07/21 14:39:16 /usr/local/bin/git -C /tmp/workspace/source submodule update --init --recursive --depth 1
    2021/07/21 14:39:17 Successfully loaded https://github.com/shipwright-io/sample-go (ref: refs/heads/main) into /tmp/workspace/source
    

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

Improved output messages created by the Git step to be more human readable.

@openshift-ci openshift-ci bot added the release-note Label for when a PR has specified a release note label Jul 21, 2021
@HeavyWombat HeavyWombat added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jul 21, 2021
@SaschaSchwarze0
Copy link
Member

SaschaSchwarze0 commented Jul 23, 2021 via email

cmd/git/main.go Outdated Show resolved Hide resolved
HeavyWombat and others added 2 commits July 26, 2021 17:00
The current output of the Git step was using the log style of the controller,
which is configured to be machine consumable. However, the output should be
more aligned with the output that is created by other steps. Tools like Kaniko
or Buildpacks produce more human style output.

Replace `ctxlog` with `log` and simplify log output to be human friendly.

Add new end message that contains all relevant details, including HEAD info.
Check current HEAD to get the current branch name.

Co-authored-by: Sascha Schwarze <schwarzs@de.ibm.com>
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 26, 2021
@openshift-merge-robot openshift-merge-robot merged commit 4f8179c into main Jul 26, 2021
@SaschaSchwarze0 SaschaSchwarze0 deleted the simplify/git-output branch July 26, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants