code: public JobIdentifier findJob(String pipelineName, String pipelineCounter, String stageName, String stageCounter, String buildName, Long buildId) {
          JobConfigIdentifier jobConfigIdentifier = goConfigService.translateToActualCase(new JobConfigIdentifier(pipelineName, stageName, buildName));
  
          PipelineIdentifier pipelineIdentifier;
  
          if (JobIdentifier.LATEST.equalsIgnoreCase(pipelineCounter)) {
              pipelineIdentifier = pipelineService.mostRecentPipelineIdentifier(jobConfigIdentifier.getPipelineName());
          } else if (StringUtils.isNumeric(pipelineCounter)) {
              pipelineIdentifier = pipelineService.findPipelineByNameAndCounter(pipelineName, Integer.parseInt(pipelineCounter)).getIdentifier();
          } else {
              throw new RuntimeException("Expected numeric pipeline counter but received '%s'" + pipelineCounter);
          }
  
          stageCounter = StringUtils.isEmpty(stageCounter) ? JobIdentifier.LATEST : stageCounter;
          StageIdentifier stageIdentifier = translateStageCounter(pipelineIdentifier, jobConfigIdentifier.getStageName(), stageCounter);
  
          JobIdentifier jobId;
          if (buildId == null) {
              jobId = jobResolverService.actualJobIdentifier(new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName()));
          } else {
              jobId = new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName(), buildId);
          }
          if (jobId == null) {
              //fix for #5739
              throw new RecordNotFoundException(String.format("Job '%s' not found in pipeline '%s' stage '%s'", buildName, pipelineName, stageName));
          }
          return jobId;
      }
docs: buildId should only be given when caller is absolutely sure about the job instance
  (makes sense in agent-uploading artifacts/properties scenario because agent won't run a job if its copied over(it only executes real jobs)) -JJ
  <p>
  This does not return pipelineLabel