Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sync] dockerfile infer sync mode not working as expected. #4898

Open
tejal29 opened this issue Oct 10, 2020 · 3 comments
Open

[sync] dockerfile infer sync mode not working as expected. #4898

tejal29 opened this issue Oct 10, 2020 · 3 comments
Labels
area/sync build/docker good first issue Good for newcomers kind/friction Issues causing user pain that do not have a workaround priority/p2 May take a couple of releases

Comments

@tejal29
Copy link
Member

tejal29 commented Oct 10, 2020

I have a dockerfile for a ruby app project here

FROM library/ruby:2.3.0
  
# Install essential Linux packages
RUN apt-get update -qq && apt-get install -y \
    build-essential \
    nodejs

RUN mkdir /dashboard
WORKDIR /dashboard

# Copy Gemfile and Gemfile.lock
COPY Gemfile /dashboard/

# Speed up nokogiri install
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1
ENV BUNDLER_VERSION=2.1.4

RUN gem install bundler -v 2.0.2
RUN gem update bundler
RUN bundle install

EXPOSE 3030

COPY .  /dashboard

CMD dashing start -p 3030 --address 0.0.0.0

I want to configure sync for one the css file. As per the docs, i do the following

apiVersion: skaffold/v2beta7
kind: Config
metadata:
  name: github-dashing
build:
  artifacts:
  - image: github-dash
    sync:
      infer:
        - 'assets/**/*'
deploy:
  kubectl:
    manifests:
    - k8s/deployment.yaml
portForward:
  - resourceType: deployment
    resourceName: github-dash
    port: 3030
    localPort: 8080

However, when i make change to one of the files in assets assets/javascripts/application.coffee , a re-build is triggered.

  1. first case, since i had opened the project in intellij, a change to /Users/tejaldesai/workspace/github-dashing/.idea/workspace.xml is detected. This file is not added in .docerignore and hence triggers a re-build.
DEBU[0039] Change detected notify.Write: "/Users/tejaldesai/workspace/github-dashing/assets/javascripts/application.coffee" 
DEBU[0039] Change detected notify.Write: "/Users/tejaldesai/workspace/github-dashing/.idea/workspace.xml" 
TRAC[0039] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
Port forwarding deployment/github-dash in namespace default, remote port 3030 -> address 127.0.0.1 port 8080
DEBU[0039] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
DEBU[0039] Running command: [kubectl --context minikube port-forward --pod-running-timeout 1s --namespace default deployment/github-dash 8080:3030] 
INFO[0039] files modified: [.idea/workspace.xml assets/javascripts/application.coffee] 
TRAC[0039] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
DEBU[0039] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
INFO[0039] Changed file .idea/workspace.xml does not match any sync pattern. Skipping sync 
Generating tags...
 - github-dash -> DEBU[0039] Running command: [git describe --tags --always] 
DEBU[0039] Command output: [2662512
]                   
  1. After adding a idea/* to .dockerignore, sync was triggered.
DEBU[0021] Change detected notify.Write: "/Users/tejaldesai/workspace/github-dashing/assets/javascripts/application.coffee" 
DEBU[0021] Command output: [], stderr: tar: Removing leading `/' from member names 
Watching for changes...
DEBU[0021] Change detected notify.Write: "/Users/tejaldesai/workspace/github-dashing/.idea/workspace.xml" 
TRAC[0022] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
DEBU[0022] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
DEBU[0022] Skipping excluded path: .idea/vcs.xml        
DEBU[0022] Skipping excluded path: .idea/.gitignore     
DEBU[0022] Skipping excluded path: .idea/workspace.xml  
DEBU[0022] Skipping excluded path: .idea/modules.xml    
DEBU[0022] Skipping excluded path: .idea/github-dashing.iml 
DEBU[0022] Skipping excluded path: .idea/misc.xml       
INFO[0022] files modified: [assets/javascripts/application.coffee] 
TRAC[0022] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
DEBU[0022] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
DEBU[0022] Skipping excluded path: .idea/vcs.xml        
DEBU[0022] Skipping excluded path: .idea/.gitignore     
DEBU[0022] Skipping excluded path: .idea/workspace.xml  
DEBU[0022] Skipping excluded path: .idea/modules.xml    
DEBU[0022] Skipping excluded path: .idea/github-dashing.iml 
DEBU[0022] Skipping excluded path: .idea/misc.xml       
Syncing 1 files for github-dash:0b1e6dbd6fc5ff49b703a553f8770cc1a72fef212d97a5b18f19cbe06762cb71
  1. Because i have COPY . /dashboard in my dockerfile, a rebuild happens when git object change
EBU[0335] Change detected notify.Write: "/Users/tejaldesai/workspace/github-dashing/.git/FETCH_HEAD" 
DEBU[0335] Change detected notify.Remove: "/Users/tejaldesai/workspace/github-dashing/.git/objects/maintenance.lock" 
DEBU[0335] Change detected notify.Create: "/Users/tejaldesai/workspace/github-dashing/.git/objects/maintenance.lock" 
TRAC[0336] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
DEBU[0336] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
DEBU[0336] Skipping excluded path: .idea/vcs.xml        
DEBU[0336] Skipping excluded path: .idea/.gitignore     
DEBU[0336] Skipping excluded path: .idea/workspace.xml  
DEBU[0336] Skipping excluded path: .idea/modules.xml    
DEBU[0336] Skipping excluded path: .idea/github-dashing.iml 
DEBU[0336] Skipping excluded path: .idea/misc.xml       
INFO[0336] files modified: [.git/FETCH_HEAD]            
TRAC[0336] Checking base image library/ruby:2.3.0 for ONBUILD triggers. 
DEBU[0336] Found dependencies for dockerfile: [{Gemfile /dashboard true} {. /dashboard false}] 
DEBU[0336] Skipping excluded path: .idea/vcs.xml        
DEBU[0336] Skipping excluded path: .idea/.gitignore     
DEBU[0336] Skipping excluded path: .idea/workspace.xml  
DEBU[0336] Skipping excluded path: .idea/modules.xml    
DEBU[0336] Skipping excluded path: .idea/github-dashing.iml 
DEBU[0336] Skipping excluded path: .idea/misc.xml       
INFO[0336] Changed file .git/FETCH_HEAD does not match any sync pattern. Skipping sync 
Generating tags...

Expected:
Infer rule 'assets/**/*' should not trigger rebuild.

  • .git/ folder objects
  • .idea/*
  • vscode config files.

Document or Warn users when Copy . is present in dockerfile and add following rules to dockerignore.

.idea/*
.git/*
@tejal29 tejal29 changed the title [sync [sync] dockerfile infer sync mode not working as expected. Oct 10, 2020
@tejal29 tejal29 added area/sync build/docker good first issue Good for newcomers kind/friction Issues causing user pain that do not have a workaround priority/p2 May take a couple of releases labels Oct 10, 2020
@briandealwis
Copy link
Member

Can you try ./?

sync:
      infer:
        - './assets/**/*'

@tejal29
Copy link
Member Author

tejal29 commented Nov 2, 2020

hmm interesting. Let me try that and report back.

@MarlonGamez
Copy link
Contributor

@tejal29 did you ever have an update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sync build/docker good first issue Good for newcomers kind/friction Issues causing user pain that do not have a workaround priority/p2 May take a couple of releases
Projects
None yet
Development

No branches or pull requests

3 participants