Skip to content

Commit

Permalink
Handle nonexistent deploy path (#196)
Browse files Browse the repository at this point in the history
* Handle nonexistent deploy path

* Update main.go

Co-authored-by: lpusok <7979773+lpusok@users.noreply.github.com>

* Update main.go

Co-authored-by: lpusok <7979773+lpusok@users.noreply.github.com>

---------

Co-authored-by: lpusok <7979773+lpusok@users.noreply.github.com>
  • Loading branch information
ofalvai and lpusok committed Feb 21, 2024
1 parent 54d460c commit 2a49db6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ workflows:
- notify_email_list: $NOTIFY_EMAIL_LIST
- is_enable_public_page: "true"
- debug_mode: "true"
- path::./:
title: Deploy path points to invalid path
inputs:
- build_url: $BITRISE_BUILD_URL
- build_api_token: $BITRISE_BUILD_API_TOKEN
- is_compress: "false"
- deploy_path: /tmp/nonexistent
- notify_user_groups: $NOTIFY_USER_GROUPS
- notify_email_list: $NOTIFY_EMAIL_LIST
- is_enable_public_page: "true"
- debug_mode: "true"
- script:
title: Output (generated by the Step) tests
inputs:
Expand Down
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,18 @@ func clearDeployFiles(filesToDeploy []string) []string {
}

func collectFilesToDeploy(absDeployPth string, config Config, tmpDir string) (filesToDeploy []string, err error) {
pathExists, err := pathutil.IsPathExists(absDeployPth)
if err != nil {
return nil, fmt.Errorf("failed to check if %s exists: %s", absDeployPth, err)
}
if !pathExists {
log.Warnf("Nothing to deploy at %s", absDeployPth)
return
}

isDeployPathDir, err := pathutil.IsDirExists(absDeployPth)
if err != nil {
return nil, fmt.Errorf("failed to check if DeployPath (%s) is a directory or a file, error: %s", absDeployPth, err)
return nil, fmt.Errorf("failed to check if %s is a directory or a file: %s", absDeployPth, err)
}

if !isDeployPathDir {
Expand Down

0 comments on commit 2a49db6

Please sign in to comment.