Store the project_dir in the statefile in dagster-cloud ci init, and use it when determining the build directory path #32614
      
        
          +37
        
        
          −24
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary & Motivation
In most of our examples, the project_dir is just the current folder and the dagster_cloud.yaml file is at the root. But you might also do something in your CI/CD like clone a repo with a dagster_cloud.yaml in it into a subfolder and try to init it using the project_dir argument to ci init. Unfortuntately, that does not work very well - the ci build command will still look for a setup.py at the current folder and be unable to find it. And if you try to fix it by changing your dagster_cloud.yaml file, the path has to be relative to the cwd rather than the project_dir.
This fixes that by saving the project_dir at ci init time and incorporating it into the build folder. Relative paths in the dagster_cloud.yaml are assumed to be relative to the project_dir (which was already the case in the more common case when the project dir was the same as the current directory).
Fixed an issue where setting a custom project_dir in a serverless github action resulted in the 'daggster-cloud ci build' step being unable to find the correct path.
How I Tested These Changes
New tests, run ci init and ci build locally