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

Create a kubearmor-integrations /docs directory #2

Closed
johnwalicki opened this issue Aug 29, 2022 · 11 comments · Fixed by #4 or #6
Closed

Create a kubearmor-integrations /docs directory #2

johnwalicki opened this issue Aug 29, 2022 · 11 comments · Fixed by #4 or #6
Assignees

Comments

@johnwalicki
Copy link
Member

The Open Horizon documentation site can incorporate documentation from various Open Horizon repositories. We use a GitHub Action to copy over markdown / images / etc files from the subproject repo into the https://open-horizon.github.io/ site.

Once there is a /docs directory in this repo, we can implement the GHA.
open-horizon/open-horizon.github.io#304

@johnwalicki
Copy link
Member Author

The KubeArmor team is welcome to join the Sept 06 2022 Open Horizon Documentation Working Group meeting to discuss this additional documentation integration. See
https://wiki.lfedge.org/display/OH/Documentation+Working+Group

@johnwalicki
Copy link
Member Author

johnwalicki commented Sep 2, 2022

@Ankurk99 noticed a leading / in the copy-docs.yaml GHA and fixed it in: #8
I pushed a change to the README.md See: 958bef7
I merged the PR #10 and the Copy-Docs GHA ran: https://github.com/open-horizon/kubearmor-integration/actions/runs/2981031544
but failed with

fatal: could not read Password for 'https://***@github.com': No such device or address

@johnwalicki johnwalicki reopened this Sep 2, 2022
@johnwalicki
Copy link
Member Author

We're trying to use the open-horizon org secret PERSONAL_TOKEN from
https://github.com/organizations/open-horizon/settings/secrets/actions
but the copy-docs.yaml dst_owner: open-horizon
doesn't work.

It says

Secrets are environment variables that are encrypted. Anyone with collaborator access to the repositories with access to each secret can use it for Actions. 

@Ankurk99
Copy link
Member

Ankurk99 commented Sep 2, 2022

Ah! Just noticed something:
The PR 6fbc82c removed the previous changes added in the PR #4 (But I am still confused why it was not removed in the PR #5 itself). So currently we don't have the docs folder. Also I think we also will need to update the src_path (https://github.com/open-horizon/kubearmor-integration/blob/main/.github/workflows/copy-docs.yml#L19) in the GA.
But I am still not sure if the error to not be able to read password be fixed with these changes.

@johnwalicki
Copy link
Member Author

Quite possibly we can edit L19 to remove the leading /
In the GHA run I see the double slash.
Copying "kubearmor-integration//README.md" and pushing it to open-horizon/open-horizon.github.io

@johnwalicki
Copy link
Member Author

Before we ran the GHA, I created a docs/kubearmor-integration/tmpfile in the open-horizon.github.io repo. See open-horizon/open-horizon.github.io@70f1402

Maybe I should have also created a docs/kubearmor-integration/docs directory too.

@Ankurk99
Copy link
Member

Ankurk99 commented Sep 2, 2022

I have restored the docs folder and have tried to updated the GA to replicate the format of other open-horizon github actions, please take a look if the fix is fine.

@johnwalicki
Copy link
Member Author

It looks correct. GHA fails on the secret / password.

  3 files changed, 259 insertions(+)
 create mode 100644 docs/kubearmor-integration/docs/OH-detailed.png
 create mode 100644 docs/kubearmor-integration/docs/OH-edge-kubearmor.png
 create mode 100644 docs/kubearmor-integration/docs/README.md
fatal: could not read Password for 'https://***@github.com': No such device or address

@johnwalicki
Copy link
Member Author

I'm looking at the source code for the CopyCat GHA
https://github.com/andstor/copycat-action/blob/master/entrypoint.sh

@johnwalicki
Copy link
Member Author

I cloned and built the copycat container on my local system. Figured out what params to pass it by studying the output of one of the GHA copycat runs.
Still failed with the same error. With some additional experiments:

[master 0dcaf29] Update file(s) "docs" from "open-horizon/kubearmor-integration"
 3 files changed, 259 insertions(+)
 create mode 100644 docs/kubearmor-integration/docs/OH-detailed.png
 create mode 100644 docs/kubearmor-integration/docs/OH-edge-kubearmor.png
 create mode 100644 docs/kubearmor-integration/docs/README.md
git push with this syntax
git push origin master
fatal: remote origin already exists.
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/open-horizon/open-horizon.github.io.git/'
Copying complete 

I modified the entrypoint.sh for copycat to use my PAT based the answer in this StackOverflow discussion.
https://stackoverflow.com/questions/31159275/how-do-i-generate-the-github-oauth-token-for-organization-accounts

I replace the git push origin with

    git remote show origin
    git remote set-url origin https://<john-PAT-with-org-admin-privs>@github.com/open-horizon/open-horizon.github.io.git
    git push -u origin ${DST_BRANCH}

Running it local finally succeeded (using a PAT that I created over in github/johnwalicki) This isn't the right answer but it shows the problem with trying to use this GHA in an Org, not a personal github account.

@johnwalicki
Copy link
Member Author

I learned a lot about how the CopyCat GitHub Action executes. I offered to improve their documentation so others can run it in a GitHub Org. See andstor/copycat-action#65

Closing this ticket as complete. Thanks to the AccuKnox team for contributing to Open Horizon.

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