sregistry/main/gitlab/query.py
def search_all(self, collection, job_id=None):
    '''a "show all" search that doesn't require a query
       the user is shown URLs to 
    '''

    results = [['job_id', 'browser']]
 
    url = "%s/projects/%s/jobs" %(self.api_base, 
                                  quote_plus(collection.strip('/')))

    response = requests.get(url, headers=self.headers) 
    if response.status_code == 200:
        jobs = response.json()

        # We can't get a listing of artifacts
        # https://gitlab.com/gitlab-org/gitlab-ce/issues/51515
        # Parse through jobs (each can have different tags for a collection):
        for job in jobs:

            # Only show jobs that are successful
            if job['status'] == 'success':
                name = job['name']

                for artifact in job['artifacts']:
                    if artifact['filename'].endswith('zip'):
                        
                        # The user must browse to see the names
                        artifact_url = ("%s/%s/-/jobs/%s/artifacts/browse/%s" 
                                        %(self.base , 
                                          collection, 
                                          job['id'],
                                          name))
                        results.append([str(job['id']), artifact_url])   

    if len(results) == 1:
        bot.info("No potential archives found in artifacts.")
        sys.exit(0)

    bot.info("Artifact Browsers (you will need path and job id for pull)")
    bot.table(results)
    return results
def search_all(self, collection, job_id=None):
    '''a "show all" search that doesn't require a query
       the user is shown URLs to 
    '''

    results = [['job_id', 'browser']]
 
    url = "%s/projects/%s/jobs" %(self.api_base, 
                                  quote_plus(collection.strip('/')))

    response = requests.get(url, headers=self.headers) 
    if response.status_code == 200:
        jobs = response.json()

        # We can't get a listing of artifacts
        # https://gitlab.com/gitlab-org/gitlab-ce/issues/51515
        # Parse through jobs (each can have different tags for a collection):
        for job in jobs:

            # Only show jobs that are successful
            if job['status'] == 'success':
                name = job['name']

                for artifact in job['artifacts']:
                    if artifact['filename'].endswith('zip'):
                        
                        # The user must browse to see the names
                        artifact_url = ("%s/%s/-/jobs/%s/artifacts/browse/%s" 
                                        %(self.base , 
                                          collection, 
                                          job['id'],
                                          name))
                        results.append([str(job['id']), artifact_url])   

    if len(results) == 1:
        bot.info("No potential archives found in artifacts.")
        sys.exit(0)

    bot.info("Artifact Browsers (you will need path and job id for pull)")
    bot.table(results)
    return results
a "show all" search that doesn't require a query
       the user is shown URLs to