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

Galaxy deploy collection #216

Merged
merged 8 commits into from
Feb 27, 2023
Merged

Galaxy deploy collection #216

merged 8 commits into from
Feb 27, 2023

Conversation

staticdev
Copy link
Collaborator

@staticdev staticdev commented Feb 22, 2023

Closes #186

@staticdev staticdev force-pushed the ci/galaxy-deploy-collection branch 2 times, most recently from 190e00b to ec23d37 Compare February 22, 2023 07:13
galaxy-deploy.yml Outdated Show resolved Hide resolved
Copy link
Member

@aalaesar aalaesar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted that this workflow is run at every merge into main.
but for the collection we don't want this.
The ansible-collection build the archive with the content as is and use the version metadata to generate the archive name.
This will break/fail on every commit in main that are not tags. (release_tag won't have the proper value on non tag event)
So we should probably change-the trigger or add-a-new workflow for release on tag only, if possible

@staticdev staticdev force-pushed the ci/galaxy-deploy-collection branch 2 times, most recently from 36876d8 to bbabdd4 Compare February 22, 2023 17:00
@staticdev
Copy link
Collaborator Author

I noted that this workflow is run at every merge into main. but for the collection we don't want this. The ansible-collection build the archive with the content as is and use the version metadata to generate the archive name. This will break/fail on every commit in main that are not tags. (release_tag won't have the proper value on non tag event) So we should probably change-the trigger or add-a-new workflow for release on tag only, if possible

For now I would keep it to check if deployment is ok like this and we can create another issue to improve it if you agree.

@staticdev
Copy link
Collaborator Author

staticdev commented Feb 23, 2023

I noted that this workflow is run at every merge into main. but for the collection we don't want this. The ansible-collection build the archive with the content as is and use the version metadata to generate the archive name. This will break/fail on every commit in main that are not tags. (release_tag won't have the proper value on non tag event) So we should probably change-the trigger or add-a-new workflow for release on tag only, if possible

I see @aalaesar, maybe this will happen but I expect it to work. I propose we do a couple of tests as it is. If we get problems every merge I will make a PR to check for new tag. My idea is to try to have as many releases as possible to identify and correct errors more easily also.

@aalaesar
Copy link
Member

For testing you can change the condition to trigger the action for every commit in this branch.
So we'll see right away

Signed-off-by: staticdev <staticdev-support@protonmail.com>
@staticdev
Copy link
Collaborator Author

For testing you can change the condition to trigger the action for every commit in this branch. So we'll see right away

Fair enough, I just tried that.. current problem is that on the new repo there must be a secret set for Ansible Galaxy:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "A valid ANSIBLE_GALAXY_TOKEN must be set."}

@aalaesar
Copy link
Member

aalaesar commented Feb 23, 2023

Fair enough, I just tried that.. current problem is that on the new repo there must be a secret set for Ansible Galaxy:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "A valid ANSIBLE_GALAXY_TOKEN must be set."}

The secret is still here but it was named GALAXY_TOKEN when we first needed it.
Any way, I'll add it again with the ANSIBLE_ prefix 😄
Nope it needs to be set in the step.

.github/workflows/release.yml Outdated Show resolved Hide resolved
Co-authored-by: Marc Crebassa <aalaesar@gmail.com>
Signed-off-by: staticdev <staticdev-support@proton.me>
@staticdev
Copy link
Collaborator Author

@aalaesar the problem now it that the namespace is diverging on galaxy.yml from one on repo name.

@staticdev staticdev force-pushed the ci/galaxy-deploy-collection branch 4 times, most recently from c066113 to 220f3bc Compare February 24, 2023 17:47
Signed-off-by: staticdev <staticdev-support@proton.me>
@staticdev
Copy link
Collaborator Author

staticdev commented Feb 24, 2023

@aalaesar I added hardcoded the old namespace and name to test... Now I get:

Error: derr": " [ERROR]: Galaxy import error message: Import Task \"25916\" failed: Invalid\ncollection metadata. 'tag' has invalid format: self-hosted\nERROR! Galaxy import process failed: Invalid collection metadata. 'tag' has invalid format: self-hosted (Code: None)",

There is an ongoing issue with that ansible/galaxy#1563

Workaround: use underscore instead.

After that now I get:

Error: WARNING]: Galaxy import warning message: plugins/modules/run_occ.py:104:1:\nF401 'ansible.module_utils.basic.missing_required_lib' imported but unused\n [ERROR]: Galaxy import error message: Import Task \"25917\" failed:\n'requires_ansible' in meta/runtime.yml is mandatory, but no meta/runtime.yml\nfound\nERROR! Galaxy import process failed: 'requires_ansible' in meta/runtime.yml is mandatory, but no meta/runtime.yml found (Code: None)",

After fixing that:

Warning: rr": "[WARNING]: Galaxy import warning message: plugins/modules/run_occ.py:104:1:\nF401 'ansible.module_utils.basic.missing_required_lib' imported but unused",
    "stderr_lines": [
Warning: [WARNING]: Galaxy import warning message: plugins/modules/run_occ.py:104:1:",
        "F401 'ansible.module_utils.basic.missing_required_lib' imported but unused"
    ],
    "stdout": "Publishing collection artifact '/home/runner/work/ansible-collection-nextcloud-admin/ansible-collection-nextcloud-admin/aalaesar-nextcloud-1.9.2.tar.gz' to default [https://galaxy.ansible.com/api/\nCollection](https://galaxy.ansible.com/api//nCollection) has been published to the Galaxy server default [https://galaxy.ansible.com/api/\nWaiting](https://galaxy.ansible.com/api//nWaiting) until Galaxy import task https://galaxy.ansible.com/api/v2/collection-imports/25918/ has completed\nCollection has been successfully published and imported to the Galaxy server default https://galaxy.ansible.com/api/",

image

.github/workflows/release.yml Outdated Show resolved Hide resolved
galaxy-deploy.yml Show resolved Hide resolved
meta/runtime.yml Outdated Show resolved Hide resolved
@staticdev
Copy link
Collaborator Author

@aalaesar @wiktor2200 TL;DR it works. Now fixing the errors from ansible-lint, there are a few.

@staticdev staticdev force-pushed the ci/galaxy-deploy-collection branch 4 times, most recently from 95f48e9 to 7d6dc53 Compare February 24, 2023 18:58
Signed-off-by: staticdev <staticdev-support@proton.me>
Co-authored-by: wiktor2200 <wiktor2200@users.noreply.github.com>
Signed-off-by: staticdev <staticdev-support@proton.me>
@aalaesar
Copy link
Member

Hello there
Well done @staticdev !
I think I might not understand completely how the code behaviour, but it worked ! ( But ansible page display 0 modules...)

So if the namespace and name are now hard coded in the playbook command, we should set the version to 2.0.0 and merge it after #209, once the namespace has been created.

@wiktor2200
Copy link
Collaborator

wiktor2200 commented Feb 24, 2023

Great work @staticdev! I've left one more small comment (plus confirmation that we won't leak galaxy token), but apart from that LGTM and can be merged. :)

Regarding Galaxy collection, it's weird, maybe counter would be aggregated later, because when you click on Content button you can see 1 role, 1 module and 3 plugins, so all what expected.
screen

@staticdev staticdev force-pushed the ci/galaxy-deploy-collection branch 3 times, most recently from 12fb5c1 to 75bdfc2 Compare February 25, 2023 09:45
@staticdev
Copy link
Collaborator Author

@aalaesar LGTM?

@aalaesar
Copy link
Member

@aalaesar LGTM?

The tests have messed up a little bit the tags and the release (no pb it's fixable).
I still want the next release to be 2.0.0 as the collection is a breaking change
When I'll delete the tags 1.9.x, will the release drafter regenerate the release description from scratch or do I have to put back the current text in the draft ?

@staticdev
Copy link
Collaborator Author

staticdev commented Feb 25, 2023

@aalaesar LGTM?

The tests have messed up a little bit the tags and the release (no pb it's fixable). I still want the next release to be 2.0.0 as the collection is a breaking change When I'll delete the tags 1.9.x, will the release drafter regenerate the release description from scratch or do I have to put back the current text in the draft ?

Ah, Yeah I messed up. Not drafter fault, I did a couple of releases. I just did a clean up of the tags and releases but we will need to manually do the description to 2.0.0.. One time thing..

@wiktor2200
Copy link
Collaborator

Hi @staticdev @aalaesar!
That's not a problem at all :)
My RSS reader has it cached, so I pasted "1.9.0" description to draft :)

galaxy.yml Outdated Show resolved Hide resolved
Signed-off-by: staticdev <staticdev-support@proton.me>
Copy link
Member

@aalaesar aalaesar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@staticdev
Copy link
Collaborator Author

I see LGTM from @wiktor2200 also so doing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust ansible galaxy to import the collection from the nextcloud namespace
3 participants