mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 18:08:51 +08:00 
			
		
		
		
	 bb2b47dc70
			
		
	
	bb2b47dc70
	
	
	
		
			
			Support swagger testing and optional runtime updates similar to the current golangci-lint tool. This allows developers to update the version of swagger at runtime if needed. Otherwise new CI VM images will pick up the prescribed version at image build-time via `make install.tools`. Signed-off-by: Chris Evich <cevich@redhat.com>
		
			
				
	
	
		
			32 lines
		
	
	
		
			821 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			821 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| # This script is intended to be a convenience, to be called from the
 | |
| # Makefile `.install.swagger` target.  Any other usage is not recommended.
 | |
| 
 | |
| BIN="$BINDIR/swagger"
 | |
| 
 | |
| die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }
 | |
| 
 | |
| function install() {
 | |
|     echo "Installing swagger v$VERSION into $BIN"
 | |
|     curl -sS --retry 5 --location -o $BIN \
 | |
|         https://github.com/go-swagger/go-swagger/releases/download/v$VERSION/swagger_${GOOS}_${GOARCH}
 | |
|     chmod +x $BIN
 | |
|     $BIN version
 | |
| }
 | |
| 
 | |
| for req_var in VERSION BINDIR GOOS GOARCH; do
 | |
|     [[ -n "${!req_var}" ]] || die "\$$req_var is empty or undefined"
 | |
| done
 | |
| 
 | |
| if [ ! -x "$BIN" ]; then
 | |
|     install
 | |
| else
 | |
|     $BIN version | grep "$VERSION"
 | |
|     if [[ "$?" -eq 0 ]]; then
 | |
|         echo "Using existing $BIN"
 | |
|     else
 | |
|         install
 | |
|     fi
 | |
| fi
 |