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

docs: Add documentation-test for README #51

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Conversation

mqasimsarfraz
Copy link
Member

This change add support for testing documentation using exec-docs

@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 12:54 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:02 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:14 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:20 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:25 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:25 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:25 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz force-pushed the qasim/exec-docs branch 2 times, most recently from 46b9131 to ef7febc Compare October 27, 2023 13:31
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:37 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:42 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:42 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:42 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 27, 2023 13:48 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz changed the title docs: Add test-docs docs: Add documentation-test Oct 30, 2023
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 09:36 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 09:41 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 09:41 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 09:41 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 09:48 — with GitHub Actions Inactive
Copy link
Member

@blanquicet blanquicet left a comment

Choose a reason for hiding this comment

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

Looking great already!

Comment on lines 272 to 282
- name: Get kubectl-aks from artifact
uses: actions/download-artifact@v3
with:
name: kubectl-aks-linux-amd64-tar-gz
- name: Prepare kubectl-aks binary
shell: bash
run: |
tar zxvf kubectl-aks-linux-amd64.tar.gz
chmod +x kubectl-aks
mv kubectl-aks /usr/local/bin
ls -la
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to install it if it is going to be installed in the README?

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 wanted to ensure that the binary that was built in the previous steps of the CI is actually tested since we eventually ship that in the release. But I need to ensure we clean up all other installation for it.

Copy link
Member

Choose a reason for hiding this comment

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

Yep but currently there is no way to test the README against the just built binary. See my comment in #52 (comment), I think we should separate the README from others docs and the README could only be run for the releases (which makes sense as it describes how to install a released version). WDYT?

Copy link
Member Author

@mqasimsarfraz mqasimsarfraz Oct 30, 2023

Choose a reason for hiding this comment

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

currently there is no way to test the README against the just built binary

I realized it is possible to pass env vars to ie so it can be used to add custom directory to PATH like I did here. This takes care of using the built binary by adding path of the current directory where kubectl-aks (built by kubectl-aks target) is located. In the CI, kubectl-aks is download at correct location and used by the tests. Shouldn't that cover all the cases?

Edit: Need to ensure binaries at different path are used in expected order 🤔

Copy link
Member

@blanquicet blanquicet Oct 31, 2023

Choose a reason for hiding this comment

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

I don't think it covers also the README case as it doesn't make sense to run kubectl krew install aks (which install kubectl-aks in ~/.krew/bin/ and then run kubectl aks version using the binary we compiled in the build CI job.

Then, for the commands documentation, we could use such method. However, I expect to have just one binary at that time given that we are cleaning up everything we install in the README. So, the only binary available in that host will be the one we downloaded from the artifacts.

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 don't think it covers also the README case as it doesn't make sense to run kubectl krew install aks (which install kubectl-aks in ~/.krew/bin/ and then run kubectl aks version using the binary we compiled in the build CI job.

Thanks for catching this. I defined the precedence now krew > local > current directory and it is working as expected krew version, specific version, installed from source. This also ensures the kubectl aks --help is tested against the binary from the PR so any issues will be caught right away.

So, the only binary available in that host will be the one we downloaded from the artifacts.

Yeah, I think for commands testing, it is much simpler. I feel like with above we should be fine for README.md but I am happy to test it separately. What do you say?

Copy link
Member

Choose a reason for hiding this comment

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

I still find it too hacky. Now that you added the cleanup step for all the installation methods, I don't see the need of passing the list of paths in a specific order, there will always be only one binary installed at a time.

The only remaining problem is the kubectl aks help.... Mmmm I'm not sure what to do. We could either use ./kubectl-aks help or remove it as the list of commands are already describe above in the documentation.

What do you think?

.github/workflows/kubectl-aks.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
.gitignore Outdated
@@ -3,6 +3,7 @@
*.exe~
*.dll
*.so
*.log
Copy link
Member

Choose a reason for hiding this comment

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

Is this file generated by the ie? I haven't noticed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, for me. I am getting ie.log once running it. Maybe it is only written if something fails?

Copy link
Member

Choose a reason for hiding this comment

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

I don't know. Please keep track of this things so that we can provide feedback to the InnovationEngine project.

@mqasimsarfraz mqasimsarfraz temporarily deployed to aks October 30, 2023 17:44 — with GitHub Actions Inactive
.github/workflows/kubectl-aks.yml Outdated Show resolved Hide resolved
.github/workflows/kubectl-aks.yml Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks November 1, 2023 09:02 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks November 1, 2023 09:08 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks November 1, 2023 09:08 — with GitHub Actions Inactive
@mqasimsarfraz mqasimsarfraz temporarily deployed to aks November 1, 2023 09:08 — with GitHub Actions Inactive
.github/workflows/kubectl-aks.yml Show resolved Hide resolved
ie.mk Outdated Show resolved Hide resolved
Comment on lines 272 to 282
- name: Get kubectl-aks from artifact
uses: actions/download-artifact@v3
with:
name: kubectl-aks-linux-amd64-tar-gz
- name: Prepare kubectl-aks binary
shell: bash
run: |
tar zxvf kubectl-aks-linux-amd64.tar.gz
chmod +x kubectl-aks
mv kubectl-aks /usr/local/bin
ls -la
Copy link
Member

Choose a reason for hiding this comment

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

I still find it too hacky. Now that you added the cleanup step for all the installation methods, I don't see the need of passing the list of paths in a specific order, there will always be only one binary installed at a time.

The only remaining problem is the kubectl aks help.... Mmmm I'm not sure what to do. We could either use ./kubectl-aks help or remove it as the list of commands are already describe above in the documentation.

What do you think?

@mqasimsarfraz
Copy link
Member Author

The only remaining problem is the kubectl aks help.... Mmmm I'm not sure what to do. We could either use ./kubectl-aks help or remove it as the list of commands are already describe above in the documentation.

I agree. It does look hacky. I removed testing it for now. We can reflect back later on if there is a nicer way to do it. Thanks for all the feedback. I updated the PR.

Copy link
Member

@blanquicet blanquicet left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for working on this.

README.md Outdated Show resolved Hide resolved
This change add support for testing documentation
using exec-docs

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
@mqasimsarfraz
Copy link
Member Author

Thanks for reviews! CI is green! I will merge this!

@mqasimsarfraz mqasimsarfraz merged commit f107567 into main Nov 10, 2023
15 checks passed
@mqasimsarfraz mqasimsarfraz deleted the qasim/exec-docs branch November 10, 2023 14:42
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.

2 participants