Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Gitlab::Get-source is different between BM and Otter for credentials



  • Hello
    I was looking to create a shared libray with Otter and BM and I meet the following probem with the Gitlab extension:
    The credentials are not call in the same way, so it is not possible to share it.

    In Otter:

                    GitLab::Get-Source
                    (
                        Credentials: gitlab-inedo,
                        Group: ansible/playbooks,
                        Project: $tolower($PLAYBOOK),
                        DiskPath: $DOSSIER,
                        Branch: master,
                        KeepInternals: false,
                        GitExePath: /usr/bin/git,
                        CleanWorkspace: true
                    );
    

    in BuildMaster:

    GitLab::Get-Source global::GitLab
    (
        Namespace: ansible/playbooks,
        Project: $tolower($PLAYBOOK),
        DiskPath: $DOSSIER,
        Branch: master,
        KeepInternals: false,
        GitExePath: /usr/bin/git,
        CleanWorkspace: true
    );
    

    When do you think the extension will be the same ?
    I can bypass the problem, it is just to know.

    Best regards
    PhilippeC.


  • inedo-engineer

    Otter uses Inedo.SDK 1.6, where as BuildMaster is on Inedo.SDK 1.7. The major addition to 1.7 is SecureResources and SecureCredentials, which replace ResourceCredentials. However, it's still backwards compatible.

    The current (1.7) version of GitLab::Get-Source has two changes:

    • Changed Credentials property to From (but keeps Credentials as an alias)
    • Added From as the default property, so it will be used as argument right after the operation name

    This keeps it backwards compatible.

    We will add SDK 1.7 to Otter later this year, but in the mean time you can use the Otter version code and create a ResourceCredential in BuildMaster of the same name.



  • @atripp
    Thanks for the reply



  • Hello @atripp

    I was still looking trying to share the same library in OTTER and Buildmaster despite the difference of the function Gitlab::source.
    Is it possible that you create a built-in variable like

    $InedoProgram=<Otter | BuildMaster>
    

    in some next release, so I could bypass the problem in my module like this.

    If $InedoProgram = Otter
    {
            # OTTER
            {
                GitLab::Get-Source
                (
                    Credentials: gitlab-inedo,
                    Group: ansible/playbooks,
                    Project: $tolower($PLAYBOOK),
                    DiskPath: $DOSSIER,
                    Branch: master,
                    KeepInternals: false,
                    GitExePath: /usr/bin/git,
                    CleanWorkspace: true
                );
            }
    
    }
    else
    {
            # BUILDMASTER
            {
            GitLab::Get-Source global::GitLab
            (
                Namespace: ansible/playbooks,
                Project: $tolower($PLAYBOOK),
                DiskPath: $DOSSIER,
                Branch: master,
                KeepInternals: false,
                GitExePath: /usr/bin/git,
                CleanWorkspace: false
            );
    }
    

    I did the trick with my own variable but it would be nice to have such variable.

    " small steps for Inedo, giant leap for me" 😊

    Best Regards
    PhilippeC.


  • inedo-engineer

    Hi @philippe-camelio_3885,

    Do you know how to create your own extension? If not, check out creating an extension using the SDK.

    To create an $InedoProduct and $InedoProductVersion variables, you can create a couple of new classes extending Inedo.Extensibility.ScalarVariableFunction. Then simply implement the ExecuteScalar method and have it return Inedo.SDK.ProductName or Inedo.SDK.ProductVersion. You can see an example of this with the ServerNameVariableFunction in the Inedox-InedoCore extension on GitHub. If you can submit a pull request, I'll be happy to test it and get it published right away!

    Thanks,
    Rich



  • Hi @rhessinger

    I am an old sysadmin so I am really not fluent with .Net stuff and I don't have VS on my computer 😬
    but you give me a good starting point, I will make a try.

    Best Regards
    PhilippeC.



  • Stupid question : is it possible to use VSCode to compile inedo extension ?


  • inedo-engineer

    Hi @philippe-camelio_3885,

    Technically you can use VSCode, but you will still have to at least install the MS Build Tools for Visual Studio 2019. Then you will have to run the msbuild.exe to compile your code. Here is Microsoft's guide for how to work with C# in VSCode. Hope this helps!

    Thanks,
    Rich



  • @rhessinger
    Thanks a lot.
    I will try it.



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation