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 support for OneDev devops platform #423
Conversation
Thank you for taking up this feature. Could you please add some test cases to cover this new integration? I would also appreciate if you could create a PR on the documentation website repo to cover the new config options and link to it here in this PR. |
I hope I used the correct repository for the documentation: eduardoboucas/staticman.net#28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some small suggestions. Thanks again for submitting this and for your patience with the review. Looking forward to getting this merged
Sorry, I linked from mobile and GH must redirect to the app. This is indeed the correct repo. I'll review but wait to approve the docs change till this PR is also ready. |
Hi, I am trying to test 1dev support. It is not clear to me however if the implementation supports setting 1dev through env variables. This is essential to run Staticman from Docker. |
The ENV variables are |
Also, there is staticman section in project's _config.yml file. |
Have a look at the documentation: https://github.com/eduardoboucas/staticman.net/pull/28/files |
I have added the suggestions and mentioned the env variables in the doc PR. |
Thank you for relying but I was asking about Staticman endpoint configuration in
So, is there a corresponding |
Looks like there is However, and unfortunately I cannot get it working. After switching my Staticman setup from GitLab (working) to my own OneDev installation it no longer works. I am trying to test it from command line using curl:
Such a call works with my GitLab setup, however, when I change setup to my OneDev installation I am consistently getting the error:
I spent some time to dig into this and found lots of references related to a similar error coming from using There is more on the internet. Looking at Staticman source code I can see that implementation for GitHub and GitLab do not use Unfortunately I have no idea on how to fix it or even implement some workaround. So any hints on how to get it working would be very much appreciated. I can provide more details on my environment if necessary. |
Does your OneDev instance use https? I used OneDev in a docker container with http for my tests. |
Yes, my OneDev runs over HTTPS. It is a bit more complex though. |
I reconfigured Staticman to have it connect directly to 1dev over http. This time I got a different error:
However, the error does not have any details, therefore I have no idea what was not found. |
I have tested it again with Workaround: const http = require('http');
const https = require('https');
const urlToOptions = require('got/dist/source/core/utils/url-to-options').default;
export default class OneDev extends GitService {
constructor(options = {}) {
super(options.username, options.repository, options.branch);
this.api = got.extend({
prefixUrl: config.get('onedevBaseUrl'),
username: config.get('onedevUsername'),
password: config.get('onedevPassword'),
responseType: 'json',
request: (url, options, callback) => {
if (url.protocol === 'https:') {
return https.request({...options, ...urlToOptions(url)}, callback);
}
return http.request({...options, ...urlToOptions(url)}, callback);
}
});
} Or migrate from |
For your 404 error: You need to specify the repository id instead of the repository name in the url. The OneDev api sadly does not use the names. Here is how I tested it:
{
"onedevBaseUrl": "https://code.onedev.io/api",
"onedevUsername": "KN4CK3R",
"onedevPassword": "password or token",
"rsaPrivateKey": "-----BEGIN RSA PRIVATE KEY---- ... -----END RSA PRIVATE KEY-----",
"port": 3000
}
Result: |
I created a second PR to replace the |
Hi, I merged the PR #431 into my staticman repository: https://1dev.just-4.dev/projects/staticman Both errors went away but I am not sure if I moved further because now staticman fails with the following error:
And I am running the staticman from a command line to test it like this:
My config/production.json:
I would appreciate if you have any suggestions. |
Somehow you are missing |
Thank you. With suggestions from your last comment I was able to run it successfully from command line and it all worked. However, it seems like applying all changes from both PR results in Staticman not working within Docker container. As Staticman compiles source files at startup time, it needs development dependencies which are not automatically available. It seems that older version of node and modules might have worked differently. Also, the current version requires that configuration file exists, even if it is empty, otherwise it will not start. So, this is something the project maintainer has to be aware of, that accepting this PR will break the docker installation. I managed to get it working with the following Dockerfile and a minor change in In any case, it is all working for me. If there is anything I need to do to release the bounty for the implementation, please let me know. |
Hm, strange. Both PRs do not change how Staticman should be build but I haven't tested that.
You just need to close your issue #422. 👍 |
I see the problem but it's not from my PRs. |
Ok, issue is closed. |
There's one additional docs change I'd like before we merge this PR. I want to merge both at the same time. I merged the mailgun dependency upgrade, but now there's a merge conflict on this PR that needs resolved as well. Really close to getting this merged, thanks. |
fixes #422
This PR adds support for OneDev. As OneDev lacks some needed API endpoints this Pull Request needs to merged first: