def run_step(self, data): for instruction in file_util.get_lines(DockerFileStep.FILE_DOCKERFILE): if self.is_instruction_entrypoint(instruction): message = self.get_change_message(instruction, data) self.log.warning(message) slack.send(message) return data
def test_get_content_as_array(self): rows_in_file = 3 current_path = os.path.dirname(os.path.abspath(__file__)) os.environ[environment.PROJECT_ROOT] = os.path.join( current_path, '../data') self.assertEqual(rows_in_file, len(file_util.get_lines('/.scanignore')))
def run_step(self, data): data[pipeline_data.CONFIGURATION_FILE] = file_util.get_absolue_path( self.conf_file) conf_lines = self.trim(file_util.get_lines(self.conf_file)) if self.has_missing_conf_vars(conf_lines): self.handle_step_error( 'Missing the following configuration variables in `{}`: {}'. format(self.conf_file, self.get_missing_conf_vars(conf_lines))) data = self.add_conf_vars(conf_lines, data) return data
def test_get_docker_conf_lines(self): os.environ[environment.PROJECT_ROOT] = self.get_test_data_project_root() ReadConfFileStep('docker.conf', [environment.IMAGE_NAME, pipeline_data.IMAGE_VERSION]) result = file_util.get_lines("/docker.conf") self.assertEqual(len(result), 13) self.assertEqual(result[12], 'ADDITIONAL_ENV="Some value"')
def get_from_line(): rows = file_util.get_lines(DockerFileStep.FILE_DOCKERFILE) for row in rows: if "FROM " in row.upper(): return row return None
def get_ignore_patterns(self): result = file_util.get_lines(RepoSupervisorStep.SCANIGNORE_FILE) result.extend(RepoSupervisorStep.DEFAULT_PATTERNS) return result