export async function annotateAndLabelResources()

in src/strategyHelpers/deploymentHelper.ts [152:188]


export async function annotateAndLabelResources(
   files: string[],
   kubectl: Kubectl,
   resourceTypes: Resource[]
) {
   const defaultWorkflowFileName = 'k8s-deploy-failed-workflow-annotation'
   const githubToken = core.getInput('token')
   let workflowFilePath
   try {
      workflowFilePath = await getWorkflowFilePath(githubToken)
   } catch (ex) {
      core.warning(`Failed to extract workflow file name: ${ex}`)
      workflowFilePath = defaultWorkflowFileName
   }

   const deploymentConfig = await getDeploymentConfig()
   const annotationKeyLabel = getWorkflowAnnotationKeyLabel()

   const shouldAnnotateResources = !(
      core.getInput('annotate-resources').toLowerCase() === 'false'
   )

   if (shouldAnnotateResources) {
      await annotateResources(
         files,
         kubectl,
         resourceTypes,
         annotationKeyLabel,
         workflowFilePath,
         deploymentConfig
      ).catch((err) => core.warning(`Failed to annotate resources: ${err} `))
   }

   await labelResources(files, kubectl, annotationKeyLabel).catch((err) =>
      core.warning(`Failed to label resources: ${err}`)
   )
}