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

Add encrypted CRC_PULL_SECRET #648

Merged

Conversation

majamassarini
Copy link
Member

@majamassarini majamassarini commented Mar 5, 2025

Fixes #564

Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 0abb1c6 to 6b95f96 Compare March 5, 2025 10:28
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 6b95f96 to 7d0aff7 Compare March 5, 2025 10:41
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 7d0aff7 to c7467d1 Compare March 5, 2025 10:44
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from c7467d1 to 40ee5f3 Compare March 5, 2025 11:12
Copy link
Contributor

Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 400934a to 2eb1e75 Compare March 5, 2025 12:38
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 2eb1e75 to fd1b5cf Compare March 5, 2025 13:07
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from fd1b5cf to 0349c77 Compare March 5, 2025 13:11
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 0349c77 to bd7a86e Compare March 5, 2025 13:21
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch 2 times, most recently from 84e22e3 to cb40675 Compare March 5, 2025 13:30
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from cb40675 to d47e43b Compare March 5, 2025 13:54
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from d47e43b to afa686c Compare March 5, 2025 14:53
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from afa686c to 861cb75 Compare March 5, 2025 14:55
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 861cb75 to 83532f6 Compare March 6, 2025 08:39
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 83532f6 to 6a8a424 Compare March 6, 2025 14:31
@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 638a056 to e960d56 Compare March 7, 2025 14:14
Copy link
Contributor

Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 784452a to 67a55c3 Compare March 10, 2025 08:51
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 67a55c3 to 7f081d0 Compare March 10, 2025 08:57
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 7f081d0 to f159fc7 Compare March 10, 2025 09:05
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from f159fc7 to 53efadb Compare March 10, 2025 09:10
Copy link
Contributor

Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 01e3426 to 065af09 Compare March 10, 2025 09:36
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from 065af09 to c2a2a8b Compare March 10, 2025 10:39
Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from c2a2a8b to ebd8a85 Compare March 10, 2025 10:55
Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

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

looks good!

@@ -130,3 +130,47 @@ In both cases you have to do some tweaks before using them:
- `id_ed25519[.pub]`: replace with your ssh keys

Not all services use all of them. For example `copr` is needed only by `packit` service.

## Encrypting Secrets for OpenShift Tests in Testing Farm
Copy link
Member

Choose a reason for hiding this comment

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

if this is needed only for running from forks, I would mention it explicitly in the title, and also add a note in the beginning that if you have the access and create branches in the repo itself, this process is not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

If you don't run the test from a fork, someone still has to go through this procedure and encrypt the CRC pull secret against the main packit repo. So I think the title is ok. I should probably make it clearer in the description below. I will try to rephrase it.

Comment on lines +15 to +29
- name: Look for pull_secret (splitted in small parts due to testing farm encryption)
ansible.builtin.set_fact:
pull_secret_part_1: "{{ lookup('env', 'CRC_PULL_SECRET_PART_1') }}"
pull_secret_part_2: "{{ lookup('env', 'CRC_PULL_SECRET_PART_2') }}"
pull_secret_part_3: "{{ lookup('env', 'CRC_PULL_SECRET_PART_3') }}"
pull_secret_part_4: "{{ lookup('env', 'CRC_PULL_SECRET_PART_4') }}"
pull_secret_part_5: "{{ lookup('env', 'CRC_PULL_SECRET_PART_5') }}"
pull_secret_part_6: "{{ lookup('env', 'CRC_PULL_SECRET_PART_6') }}"
pull_secret_part_7: "{{ lookup('env', 'CRC_PULL_SECRET_PART_7') }}"
when: pull_secret == ""

- name: Rebuild pull_secret from its parts
ansible.builtin.set_fact:
pull_secret: "{{ pull_secret_part_1 }}{{ pull_secret_part_2 }}{{ pull_secret_part_3 }}{{ pull_secret_part_4 }}{{ pull_secret_part_5 }}{{ pull_secret_part_6 }}{{ pull_secret_part_7 }}"
when: pull_secret == "" and pull_secret_part_1 != ""
Copy link
Member

Choose a reason for hiding this comment

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

could this be simplified using a list, like pull_secret_parts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure I follow, you mean simplify with a loop? I am not sure I can dynamically create variable names in ansible. I would not know hot to do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you mean, instead, recreate the secret outside of ansible, it can be done, but since I have some checks here I preferred to do it here.

Copy link
Member

Choose a reason for hiding this comment

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

I meant the first way. But I don't know the details on how to do this with ansible, so I am ok with leaving as it is.

Copy link
Member

Choose a reason for hiding this comment

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

I think I have an idea for this…

Copy link
Contributor

@majamassarini majamassarini force-pushed the openshift-tests-with-tf-secrets branch from c7d5777 to f5f03bd Compare March 11, 2025 14:14
Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

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

🙏

@majamassarini majamassarini added the mergeit When set, zuul wil gate and merge the PR. label Mar 11, 2025
@majamassarini majamassarini marked this pull request as ready for review March 12, 2025 08:22
@majamassarini majamassarini merged commit 0c2fdf7 into packit:main Mar 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Move Openshift tests to Testing Farm] Enable secrets
3 participants