How to get rid of CRLF will be replaced by LF while deploying code from . yaml file
i tried to put git config --global core.autocrlf true but it didnt work.
Error:
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/3593ff85-827d-4f46-b0bc-685e80981d5c.sh
warning: CRLF will be replaced by LF in GTVisualization/src/gtvisualization.py.
The file will have its original line endings in your working directory
diff --git a/GTVisualization/src/gtvisualization.py b/GTVisualization/src/gtvisualization.py
index f42a167..7fe52ae 100644
--- a/GTVisualization/src/gtvisualization.py
+++ b/GTVisualization/src/gtvisualization.py
this is my yaml file :
# Docker
# Build a Docker image
# https://learn.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- master
resources:
- repo: self
variables:
tag: "$(Build.BuildId)"
imageName: 'pipelines-pytest-docker'
dockerfilePath: $(Build.SourcesDirectory)/GTEstimation/Dockerfile
workdir: /opt/app
stages:
- stage: Check
jobs:
- job: CheckJob
displayName: Build
pool:
vmImage: "ubuntu-latest"
steps:
- task: Cache@2
inputs:
key: "$(Agent.OS) | docker | db-lz-check"
path: $(Pipeline.Workspace)/docker
cacheHitVar: DOCKER_CACHE_RESTORED
displayName: "Caching Docker image"
- checkout: self
clean: true
lfs: true
path: src/
displayName: "Check out repository"
- script: git config --global core.autocrlf true
displayName: "Line endings new"
- script: git diff --exit-code
displayName: "Line endings"
- script: |
docker load < $(Pipeline.Workspace)/docker/dockerfile-lint.tar
docker load < $(Pipeline.Workspace)/docker/autopep8.tar
condition: and(not(canceled()), eq(variables.DOCKER_CACHE_RESTORED, 'true'))
displayName: "Load docker images"
- script: |
mkdir -p $(Pipeline.Workspace)/docker
docker pull projectatomic/dockerfile-lint
docker save projectatomic/dockerfile-lint > $(Pipeline.Workspace)/docker/dockerfile-lint.tar
docker pull unibeautify/autopep8
docker save unibeautify/autopep8 > $(Pipeline.Workspace)/docker/autopep8.tar
condition: and(not(canceled()), or(failed(), ne(variables.DOCKER_CACHE_RESTORED, 'true')))
displayName: "Store docker images to cache"
- task: Bash@3
inputs:
targetType: "filePath"
filePath: "ci-scripts/docker-linter.sh"
displayName: "Docker linter"
- task: Bash@3
inputs:
targetType: "filePath"
filePath: "ci-scripts/python-formatter.sh"
displayName: "Python format PEP 8"
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
displayName: Build an image
inputs:
command: build
dockerfile: "$(Build.SourcesDirectory)/src/Dockerfile"
tags: |
$(tag)
- stage: Test
jobs:
- job: Test
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
displayName: Build an image
inputs:
repository: $(imageName)
command: build
dockerfile: $(dockerfilePath)
tags: |
$(tag)
- script:
docker run $(imageName):$(tag) bash -c "pylint $(workdir)/src/map_matched.py"
- script:
docker run $(imageName):$(tag) bash -c "pytest -v --cov-report xml --cov=. --junitxml=/tests/test-reports/pytest-report.xml"
Since i'm new to azure devops and docker, if i'm going in wrong direction then please correct me.
anything wrong with my git attributes files? below is the file.
# .gitattributes
# More information about this file:
# https://git-scm.com/docs/gitattributes
#
# Set default behavior to automatically normalize line endings.
* text=auto
* text eol=crlf