84308

How to get git commit sha1 using kubectl cmd?

<h3>Question</h3>

How can I using kubectl cmd to get specific pod's commit sha1 like:

kubectl get git_commit_sha1 [pod_name]
<h3>Answer1:</h3>

There is no way to achieve what you want at the moment using kubectl. They only possible way would be if your docker image have git command built in. In that case you could use kubectl exec to get the information you want.

Example:

$ kubectl exec -ti podname -- git show

Alternatively, if you really think your idea makes sense and may be useful to more people, you can open a feature request on kubernetes github issues page.

来源:https://stackoverflow.com/questions/62258567/how-to-get-git-commit-sha1-using-kubectl-cmd

Recommend

  • Bash: expand parameters from variable. How?
  • spring security client_credentials grant_type - support for refresh token
  • Kotlin Higher Order Function Composition
  • Amazon API generating a request signature in C# .NET
  • Calling SaveAsync method sends email to attendees for existing appointment?
  • How to sort the union datastream of flink without watermark
  • How to expire a session if user leave an interface for 2 minutes? ASP.NET
  • C# Spell checker Problem
  • how can i open a webpage in a webview from a fragment with buttons?
  • How deleteLater() actually works in qt?
  • How to read config files with section in bash shell
  • Remove Textmate Git Bundle
  • Http Requests not getting routed to Https NodeJs
  • Why doesn't the tray icon context menu work for my RemoteApp?
  • How to send binary with spring boot websocket?
  • Should the client have the same keystore as the server?
  • Google Chrome compositor-driven animation affected by jam in main thread
  • In Moment.js, how do you get the date of the next occurrence of a specific month (ex: 'next Jan
  • CSS style for container with transparent border images
  • Access to database zend framework
  • Jenkins sending notifications to the wrong commit id
  • Videos won't upload
  • I need a PHP mySQL Login script that directs user to specific URL based on username and password
  • Sample deviceQuery cuda program
  • First dynamically-added TinyMCE editor displays, others do not
  • How to resolve this in PHPUnit where it is asking me to set KERNEL_DIR in my phpunit.xml?
  • Java .policy file - how to prevent java.util.Date() from being accessible
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Tensorflow Dataset API restore Iterator after completing one epoch
  • Create an average of multiple excel chart without the data source
  • Google Spreadsheet Script to Blink a range of Cells
  • Python 3x- Compression Makes File Bigger :(
  • Cloud Code: Creating a Parse.File from URL
  • how to snap two objects in runtime in unity?
  • Another “Cannot make static reference…” Question
  • Bind selectedDates Aggregation for Calendar
  • calling IO Operations from thread in ruby c extension will cause ruby to hang
  • Call Microservice from another Microservice within Docker
  • How to mutate multiple variables without repeating codes?
  • Create/delete users from text file using Bash script