mirror of
				https://github.com/docker/build-push-action.git
				synced 2025-11-04 08:20:55 +00:00 
			
		
		
		
	Added new trace-Data input. changed label value to link to dockerfile
Signed-off-by: Jyotsna <Josh-01@github.com>
This commit is contained in:
		
					parent
					
						
							
								e2bf0d0cc1
							
						
					
				
			
			
				commit
				
					
						cf7e6e140f
					
				
			
		
					 3 changed files with 20 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -70,7 +70,10 @@ inputs:
 | 
			
		|||
  ssh:
 | 
			
		||||
    description: "List of SSH agent socket or keys to expose to the build"
 | 
			
		||||
    required: false
 | 
			
		||||
 | 
			
		||||
  trace-data:
 | 
			
		||||
    description: "Flag to indicate whether link to dockerfile is added to image labels or not"
 | 
			
		||||
    default: 'false'
 | 
			
		||||
    required: false
 | 
			
		||||
outputs:
 | 
			
		||||
  digest:
 | 
			
		||||
    description: 'Image content-addressable identifier also called a digest'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								dist/index.js
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								dist/index.js
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -12083,20 +12083,16 @@ function getInputs(defaultContext) {
 | 
			
		|||
            cacheTo: yield getInputList('cache-to', true),
 | 
			
		||||
            secrets: yield getInputList('secrets', true),
 | 
			
		||||
            githubToken: core.getInput('github-token'),
 | 
			
		||||
            ssh: yield getInputList('ssh')
 | 
			
		||||
            ssh: yield getInputList('ssh'),
 | 
			
		||||
            traceData: core.getInput('trace-data') || 'false'
 | 
			
		||||
        };
 | 
			
		||||
        if (userInputs.load == true ||
 | 
			
		||||
        if (userInputs.traceData == 'true' && //if user explictly asks to add traceData
 | 
			
		||||
            (userInputs.load == true ||
 | 
			
		||||
                userInputs.push == true ||
 | 
			
		||||
            userInputs.outputs.find(val => val.indexOf('type=image') > -1 || val.indexOf('type=registry') > -1)) {
 | 
			
		||||
            //Add repo as source-label if not already supplied by user
 | 
			
		||||
            const sourceLabelKey = 'org.opencontainers.image.source';
 | 
			
		||||
            if (userInputs.labels.find(val => val.startsWith(sourceLabelKey) == true) == null) {
 | 
			
		||||
                const githubOwnerRepoUrl = defaultContext.split('#')[0];
 | 
			
		||||
                userInputs.labels.push(`${sourceLabelKey}=${githubOwnerRepoUrl}`);
 | 
			
		||||
            }
 | 
			
		||||
            //Add dockerfile path as label
 | 
			
		||||
                userInputs.outputs.find(val => val.indexOf('type=image') > -1 || val.indexOf('type=registry') > -1))) {
 | 
			
		||||
            //Add link to dockerfile as label
 | 
			
		||||
            let dockerfilePath = userInputs.file;
 | 
			
		||||
            userInputs.labels.push(`dockerfile-path=${dockerfilePath}`);
 | 
			
		||||
            userInputs.labels.push(`dockerfile-path=${defaultContext}/${dockerfilePath}`);
 | 
			
		||||
        }
 | 
			
		||||
        return userInputs;
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,24 +73,19 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
 | 
			
		|||
    cacheTo: await getInputList('cache-to', true),
 | 
			
		||||
    secrets: await getInputList('secrets', true),
 | 
			
		||||
    githubToken: core.getInput('github-token'),
 | 
			
		||||
    ssh: await getInputList('ssh')
 | 
			
		||||
    ssh: await getInputList('ssh'),
 | 
			
		||||
    traceData: core.getInput('trace-data') || 'false'
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (
 | 
			
		||||
    userInputs.load == true ||
 | 
			
		||||
    userInputs.traceData == 'true' && //if user explictly asks to add traceData
 | 
			
		||||
    (userInputs.load == true ||
 | 
			
		||||
      userInputs.push == true ||
 | 
			
		||||
    userInputs.outputs.find(val => val.indexOf('type=image') > -1 || val.indexOf('type=registry') > -1)
 | 
			
		||||
      userInputs.outputs.find(val => val.indexOf('type=image') > -1 || val.indexOf('type=registry') > -1))
 | 
			
		||||
  ) {
 | 
			
		||||
    //Add repo as source-label if not already supplied by user
 | 
			
		||||
    const sourceLabelKey = 'org.opencontainers.image.source';
 | 
			
		||||
    if (userInputs.labels.find(val => val.startsWith(sourceLabelKey) == true) == null) {
 | 
			
		||||
      const githubOwnerRepoUrl = defaultContext.split('#')[0];
 | 
			
		||||
      userInputs.labels.push(`${sourceLabelKey}=${githubOwnerRepoUrl}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Add dockerfile path as label
 | 
			
		||||
    //Add link to dockerfile as label
 | 
			
		||||
    let dockerfilePath = userInputs.file;
 | 
			
		||||
    userInputs.labels.push(`dockerfile-path=${dockerfilePath}`);
 | 
			
		||||
    userInputs.labels.push(`dockerfile-path=${defaultContext}/${dockerfilePath}`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return userInputs;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue