//Using wget to download sources from SCM-Manager/SVN repository

  • avatar

    Using wget to download sources from SCM-Manager/SVN repository

    sbiallas – 26. July 2021, 16:15 h

    Hi, need some help to download sources via wget from a SVN Repository which I´m using in SCM-Manager. In general, using svn client might work. But in my situation, I have a system without any chance connecting to a repo to download the necessary package. So, the only option is wget. Connecting to subversion service, I am able to download with the following comand: wget -d --user=username --ask-password --no-check-certificate (if needed) https://IP/repo/name/trunk/README.md

    Running this against the SCM-Manager currently using: wget -d --user=username --ask-password --no-check-certificate https:/IP/scm/repo/namespace/reponame/trunk/README.md it always creates just a file which is absolutely not the same as the one I´d like to see. Independant which file I try to download, it contains always the following:

    cat README.md

    <base href="/scm">
    <title>SCM-Manager</title>
    
    <link rel="stylesheet" type="text/css" href="/scm/assets/ui-styles.css">
    <script>
      var modernBrowser = (
        'fetch' in window &&
        'assign' in Object
      );
      if ( !modernBrowser ) {
        var scriptElement = document.createElement("script");
        scriptElement.async = false;
        scriptElement.src = "/scm/assets/polyfills.bundle.js";
        document.head.appendChild(scriptElement);
      }
    </script>
    
    You need to enable JavaScript to run this app.
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.
    
      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.
    
      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
    <script>
      window.ctxPath = "/scm";
      window.scmStage = "PRODUCTION";
    </script>
    <script src="/scm/assets/runtime.bundle.js"></script>
    <script src="/scm/assets/vendors~webapp.bundle.js"></script>
    <script src="/scm/assets/webapp.bundle.js"></script>
    

    What needs to be done to be able to use wget also in combination with the SCM-Manager / SVN repo?

    Cheers, Sascha

  • Last change: 26. July 2021, 16:17 h
  • avatar
    eheimbuch – 27. July 2021, 06:51 h

    Hey Sascha,

    this is because you download the html page instead the direct file.

    Try the rest api like this:

    https://${IP}/scm/api/v2/repositories/${namespace}/${name}/content/${revision}/trunk/README.md

    To get the HEAD revision use -1. Also you most likely need to use --auth-no-challenge on your wget.

    Hope this helps.

    Eduard

  • Last change: 27. July 2021, 07:23 h
  • avatar
    sbiallas – 27. July 2021, 08:37 h

    Hey Eduard,

    thanks for the information. Works fine for me now. May I ask for some information why --auth-no-challenge is needed here? Doesn´t work without it.

    Thanks a lot, Sascha

  • avatar
    pfeuffer – 27. July 2021, 10:14 h

    Hi Sascha,

    SCM-Manager does not send an authentication challenge for the api, but without this, wget does not send authentication credentials. That's about it. See for example the reply on this page: https://bugzilla.redhat.com/show_bug.cgi?id=446949

    Regards

    René

  • avatar
    sbiallas – 27. July 2021, 10:58 h

    Hi René, got it. Thanks for the explanation.

    Many thanks and best regards, Sascha

  • Last change: 27. July 2021, 11:44 h