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

Publishing collections fails on the second run #397

Open
myllynen opened this issue May 20, 2024 · 2 comments
Open

Publishing collections fails on the second run #397

myllynen opened this issue May 20, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@myllynen
Copy link

With a local automation hub and collection version 2.0.6 + PR 386 using the following with the needed namespace created earlier the publish role works on the first run but fails on the second run:

ah_collections:
  - collection_name: myllynen.rhel_ansible_roles
    git_url: https://github.com/myllynen/rhel-ansible-roles
    version: v1.8.0
  - collection_name: myllynen.rhel_image
    git_url: https://github.com/myllynen/rhel-image
    version: v1.3.1
TASK [infra.ah_configuration.publish : Publish Collection | Wait for finish the publish creation] **********
...
FAILED - RETRYING: [localhost]: Publish Collection | Wait for finish the publish creation (45 retries left).                                                                                                                                  
failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j587721783571.6249', 'results_file': '/home/admin/.ansible_async/j587721783571.6249', 'changed': False, '__ah_collection_file': '/var/tmp/myllynen.rhel_ansible_roles/myllynen-rhel_ansible_roles-1.8.0.tar.gz', 'ansible_loop_var': '__ah_collection_file'}) =>                                                                                                                                    
    __publish_job_async_result_item:                                                                                                                                                                                                          
        __ah_collection_file: /var/tmp/myllynen.rhel_ansible_roles/myllynen-rhel_ansible_roles-1.8.0.tar.gz                                                                                                                                   
        ansible_job_id: j587721783571.6249                                                                                                                                                                                                    
        ansible_loop_var: __ah_collection_file                                                                                                                                                                                                
        changed: false                                                                                                                                                                                                                        
        failed: 0                                                                                                                                                                                                                             
        finished: 0                                                                                                                                                                                                                           
        results_file: /home/admin/.ansible_async/j587721783571.6249                                                                                                                                                                           
        started: 1                                                                                                                                                                                                                            
    ansible_job_id: j587721783571.6249                                                                                                                                                                                                        
    ansible_loop_var: __publish_job_async_result_item                                                                                                                                                                                         
    attempts: 7                                                                                                                                                                                                                               
    changed: false                                                                                                                                                                                                                            
    finished: 1                                                                                                                                                                                                                               
    msg: |-                                                                                                                                                                                                                                   
        Upload of collection failed: insert or update on table "core_contentartifact" violates foreign key constraint "core_contentartifact_artifact_id_f5d9a66b_fk_core_artifact__id"                                                        
        DETAIL:  Key (artifact_id)=(018f9551-4b04-79eb-a59a-d0ed441adcab) is not present in table "core_artifact".                                                                                                                            
    results_file: /home/admin/.ansible_async/j587721783571.6249                                                                                                                                                                               
    started: 1                                                                                                                                                                                                                                
    stderr: ''                                                                                                                                                                                                                                
    stderr_lines: <omitted>                                                                                                                                                                                                                   
    stdout: ''                                                                                                                                                                                                                                
    stdout_lines: <omitted>                                                                                                                                                                                                                   
FAILED - RETRYING: [localhost]: Publish Collection | Wait for finish the publish creation (50 retries left).                                                                                                                                  
...
FAILED - RETRYING: [localhost]: Publish Collection | Wait for finish the publish creation (1 retries left).
failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j92391990330.6269', 'results_file': '/home/admin/.ansible_async/j92391990330.6269', 'changed': False, '__ah_collection_file': '/var/tmp/myllynen.rhel_image/myllynen-rhel_image-1.3.1.tar.gz', 'ansible_loop_var': '__ah_collection_file'}) => 
    __publish_job_async_result_item:
        __ah_collection_file: /var/tmp/myllynen.rhel_image/myllynen-rhel_image-1.3.1.tar.gz
        ansible_job_id: j92391990330.6269
        ansible_loop_var: __ah_collection_file
        changed: false
        failed: 0
        finished: 0
        results_file: /home/admin/.ansible_async/j92391990330.6269
        started: 1
    ansible_job_id: j92391990330.6269
    ansible_loop_var: __publish_job_async_result_item
    attempts: 50
    changed: false
    finished: 0
    results_file: /home/admin/.ansible_async/j92391990330.6269
    started: 1
    stderr: ''
    stderr_lines: <omitted>
    stdout: ''
    stdout_lines: <omitted>

Looks like the role does not detect that the collection version already exist and then needlessly clones it, builds it, and tries to upload it. This causes issues with CaC/GitOps where ideally there could be only one yml file listing collections and collections could be updated individually as new versions become available. Thanks.

@myllynen myllynen added bug Something isn't working new labels May 20, 2024
@djdanielsson djdanielsson added enhancement New feature or request help wanted Extra attention is needed and removed bug Something isn't working labels May 28, 2024
@djdanielsson
Copy link
Contributor

so this isn't a bug this would be a change in how the role works itself, I am updating the labels to fit

@djdanielsson djdanielsson removed the new label May 28, 2024
@myllynen
Copy link
Author

I'm not sure about the labels and classification but the hope here is that the role would be idempotent. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants