The Workers Download Workflow outlines the steps for downloading an artifact from the JFrog Artifactory using Workers. This process includes various conditions and responses that can be controlled and modified at each stage. Below is a detailed and structured explanation of the workflow:
Start Download: Initiates when a request to download an artifact is made.
Passing through all filters: Before proceeding with the download, the request passes through a series of filters to assess any constraints or conditions that might apply.
Before Download Request: At this stage, you have the option to stop the download request. The expected responses include:
Status: A directive on how to proceed with the download (for example, allow or block).
If the download is blocked, the flow redirects, and prevents the subsequent steps.
Check for Resource: If the download is allowed, the system checks the availability of the requested resource, categorized into:
Available: The resource exists and can be located.
Cached: A version of the resource is stored locally, allowing quick access.
Local: The resource is present in local storage.
Expired: The resource has a time-sensitive availability status and is no longer accessible.
Resource Found: If the resource is found, the flow proceeds to the next steps. The workflow identifies whether the artifact resides in a local or remote repository.
Resource Not Found: If the resource is not found, the flow stops, and the download fails.
Proceeding with Local/Remote Repository
Local: If the resource is in a local repository, it serves directly from here.
Remote: If it is in a remote repository, it is accessed accordingly. The steps that follow apply to resources found in a remote repository.
Check for Alt Remote Path: Checks for alternate remote path.
Alt Remote Path: You can modify the download process by:
Status: Indicating how to proceed.
modifiedRepoPath: Specifying an alternate response repository path.
Retrieve Info: Retrieves the necessary information about the resource.
Before Remote Info: Before accessing remote information, you can stop the download and add additional headers to the request:
Status: Indicating how to proceed.
requestHeaders: Additional headers to use.
Resource Found: Confirms that the resource has been found.
Alt All Responses: You can modify the response by:
Status: Indicating how to proceed.
ResponseHeaders: Additional response headers.
StatusCode: An alternate status code for the response.
ResponseMessage: An alternate response message.
Size: The size of the alternative InputStream.
InputStream: The alternate content to deliver.
Download and Save: Downloads and saves the resource.
Before Remote Download: Sets conditions before executing the remote download. You can modify the process by:
Status: Indicating how to proceed.
RequestHeaders: Additional request headers to use.
Call Remote Repo: Executes a request to the identified remote repository to fetch the artifact.
After Remote Download: Processes the received content. This is an asynchronous event that can trigger another flow but does not change the context of the Artifactory.
Get Alternate Content: Retrieves alternate content based on specified conditions or preferences.
Alt Remote Content: Fetches alternate content from different remote sources if available. This step accepts:
Status: Indicating how to proceed.
Size: The size of the input stream.
InputStream: The alternate stream to send in response.
Save Resource in Cache Repo Locally: Saves the retrieved and finalized content in the local cache repository for quicker future access.
Get Requested Artifact: Delivers the requested artifact to the client that initiated the download request.
Before Download (Final Pre-Download Check): Just before the actual download takes place, there is another Before Download check similar to the previous step. You may modify the outcome (for example, modifying the response in case of any issues).
Downloaded: Once the download is successfully executed, the entire download process is completed.
After Download Error Handling: If there is any error during the download process, you can change how the error is communicated. They can provide:
ResponseMessage: A custom message regarding the error.
Status Code: A modified code to represent the error state.
Size: The size of the input stream (if any).
Input Stream: An alternative input stream for the content related to the error.
After Download: This is an async event; you can use this event to trigger another flow, but cannot change the context of the Artifactory.
Once all of these processes are completed, the workflow comes to an end, whether successfully through a completed download or through an error state where the users might take corrective actions.