[Automatic Deployment] Continuous integration with Outsystems

[Automatic Deployment] Continuous integration with Outsystems

  
Forge Component
(7)
Published on 14 Mar by Remco Dekkinga
7 votes
Published on 14 Mar by Remco Dekkinga

I just installed the application and unfortunately got an error about not being able to connect to the Lifetime API since the server does not have a valid SSL certificate.

However, by looking at the implementation, I am suspecting it does not cover our use case. Maybe you could clarify?

What we have been trying to accomplish is this:

- Each morning Jenkins runs a daily build in the development environment during which an existing solution is republished so that each module is refreshed to start using latest dependencies. If the build fails a radiator turns to red.

- Every 10-30 minutes Jenkins checks whether the existing solution contains any references that are incompatible. If this happens another radiator turns red.

The questions we have are: is Automatic Deployment able to republish an existing solution? Or could this be done with the Lifetime API?

Also, is it able to check whether a solution contains incompatible references? Or could that be done using the Lifetime API?

All of this information is available in Service Center when checking manually. Do you have any advice how to automate and provide the information to the radiators?

Br,

Toni

Hi Toni,

1. LifeTime only works via https (with a valid SSL certificate). Can you explain more about the SSL issue you have?

2. Republishing solutions is not possible. The possibilities of the Deployment API are focussed on the Deployment from environment A to B. I've tried, but got an error when deploying from A to A (like a redeployment). It is currently not possible to do a redeployment other than via the ServiceCenter Solution publication.

3. With incompatible references, you mean broken reference or just outdated references? I believe they can be checked via the OSSYS tables in the database. I can't tell you out of my head which tables to use for this.

4. If the information is available in ServiceCenter and not in LifeTime, I can tell you not to use the LifeTime API, but create your own webservice that uses the information from one or more OSSYS tables. The redeployment can't be automated in the current version. You can setup a second environment where you deploy to, after which the result of the 2nd environment is the same as the redeployment on the first environment would have been.

Kind regards,

Remco Dekkinga

Hi Remco,

Thanks for the quick response. Here are some more details:

1. I just haven't set up s trusted SSL certificate, so that's most likely the reason. I don't think we will need to address this issue now.

2. This is unfortunate. We'll use Selenium to click through Service Center to do a republish.

3. With incompatible references I mean broken references that can be fixed only by manually opening the eSpace and updating it's references. I found an example query here: https://www.outsystems.com/forums/discussion/6467/discussion/

But when executing this query 

SELECT prd.name as producer, e_ref.name as reference, e_ref.kind, csn.name as consumer, e_ref.CONSUMER_VERSION_ID, e_ref.*
FROM ossys_Espace prd
join ossys_Espace_Reference e_ref on prd.ss_key = e_ref.PRODUCER_SS_KEY
 join ossys_Espace_Version csn_ver on e_ref.CONSUMER_VERSION_ID = csn_ver.id
join ossys_Espace csn on csn_ver.id = csn.version_id and csn.id = csn_ver.espace_id
WHERE
  prd.is_active = 1 and csn.is_active = 1 and e_ref.is_broken = 1;

I don't get the same output that I see when opening the solution. My solution currently contains several eSpaces for which Outsystems says "Some eSpace modules have outdated references that are incompatible. "

I guess this means I cannot use is_broken field for detecting broken references but instead it's something else?

4. This is good, we'll create a web service for detecting when solution contains broken references once we get the SQL right. Do you have any ideas regarding that?


Thanks,

Toni



Hi Toni,

1. OK

2. Nice work-around until OutSystems provides a better solution. You might post an idea on the forum for this functionality.

3&4. The query you got is showing exactly which elements are broken/missing on which eSpace, which is the detail of the eSpaces with the red crosses. You also want the outdated references and therefore you can use the table "OSSYS_ESPACE_RUNTIME" to check which eSpaces have broken, outdated or missing references.

Kind regards,

Remco Dekkinga

Thanks for the reply,

I'm struggling a bit with the query. By adding the ossys_espace_runtime table I'm able to see all references and their status between my two eSpaces: producer Tenants and consumer APITests. Here I'm inspecting objects that start with the word "Trial"

SELECT prd.name as producer, e_ref.name as reference, e_ref.kind, csn.name as consumer, e_ref.CONSUMER_VERSION_ID,
run.broken_references, run.outdated_references, run.missing_references, run.outdated_missing_references, run.oldproducer_references, run.outdated_broken_references, run.*
FROM ossys_Espace prd
join ossys_Espace_Reference e_ref on prd.ss_key = e_ref.PRODUCER_SS_KEY
join ossys_Espace_Version csn_ver on e_ref.CONSUMER_VERSION_ID = csn_ver.id
join ossys_Espace csn on csn_ver.id = csn.version_id and csn.id = csn_ver.espace_id
join ossys_Espace_Runtime run on run.id = csn.id
WHERE
  -- prd.is_active = 1 and csn.is_active = 1
  -- and run.oldproducer_references = 1
  -- and run.outdated_references = 1
  -- and run.broken_references = 1;
  -- and e_ref.is_broken = 1;
e_ref.name like 'Trial%'
and csn.name = 'APITests'
and prd.name = 'Tenants';

This query now shows that there are 6 references like that it also says there are no incompatibilities (see image 2).

However, in the image 1 you can see that Service Studio still says 4 out of the 6 references actually are incompatible.

Do you have any idea why the query is not detecting the incompatible references?

Br,
Toni

Image 2 attached.

Hi Toni,

I've checked the queries and the OutSystems database.

It seems to be impossible to create the query you need. The table I referred to, only shows which eSpaces are broken, not which elements in the eSpace are broken. To get to this detail, OutSystems probably uses some internal services which we can't access.

Is the identification of broken issues on eSpace level not enough for you? You can create an automatic report with the eSpaces that need attention from the developers.

Kind regards,

Remco

Hi Remco,

Did you check the table ossys_espace_reference? It contains several columns that could serve our purpose and it can be joined to ossys_espace_reference which contains a name which can be an Outsystems action or entity name.

ossys_Espace_Reference:

ID
ESPACE_ID
BROKEN_REFERENCES
OUTDATED_REFERENCES
MISSING_REFERENCES
OUTDATED_MISSING_REFERENCES
OLDPRODUCER_REFERENCES
UNASSIGNED_PHONES
REQUIRES_COMPILATION
DISABLED
USERPROVIDER_VERSION_ID
OUTDATED_USERPROVIDER
MISSING_USERPROVIDER
OLDPRODUCER_USERPROVIDER
OUTDATED_BROKEN_REFERENCES
SECURITYSETTINGSCHANGED

Please see my query above and the results in image Clipboard02.png.

For us it would be enough to see if a specific eSpace is broken or not, but I cannot come up with a query that would tell us that. ossys_espace_reference.is_broken was still false for my scenario described above.

Br,

Toni


Hi Toni,

I've checked the table and found out that it can't be used in the way you want it. The outdated_references should be 1 in some cases, but only turns 1 when also the broken_references is 1. In basis this looks like a bug in the platform, but since it's a system entity which is undocumented, OutSystems is allowed to change it in any way they want, whenever they believe it's needed. The usage of these tables should be kept to a minimum.

As far as I can see is that only the broken_references is working correctly.

kind regards,

Remco Dekkinga

If broken_references is equivalent to what service center reports as "outdated references that are incompatible" then it does not seem to work correctly. See image Clipboard01.png where there are incompatible references and still query returns 0 for column broken_references (Clipboard02.png). Or what do you think is the meaning of broken_references column?

Hi Toni,

Broken references equals the red cross and outdated references equals to the yellow exclamation mark.

See the following screenshot for the difference and where these database settings are used:

Solution

I got it working with help from Outsystems support. See attached image for the correct query. You'll also need to set the filters to detect only outdated/incompatible references.

Solution
I'm trying to do this, too, Toni.

The filter is only that?
E_ref.name like 'Trial%'
And csn.name = 'APITests'
And prd.name = 'Tenants';

Another thing in Jenkins which plugins used to read the webservices to do automanction?

The filter is:

1:

Espace_Consumer.Is_Active = True

2:

Espace_Producer.Is_Active = True

3:

Espace_Runtime.Broken_References > 0 or 
Espace_Runtime.Outdated_Broken_References  > 0 or
Espace_Runtime.Missing_References  > 0 or
Espace_Runtime.Outdated_Missing_References > 0 or
Espace_Runtime.OldProducer_References > 0 or
Espace_Runtime.Requires_Compilation = True


However, the end result is not exactly what I desired. It will output all the references between two eSpaces e.g. if there are more than 0 Broken_References. I would have wanted to see only the references that are broken.

It could be possible to tweak this further so let me know if you find a solution.

Br,

Toni


Also, in Jenkins we have installed the VSTest plugin that runs a Visual Studio test project. The test project contains this method that calls the REST interface that queries the incompatible references:


[TestMethod]
public void Fast_IncompatibleReferences()
{
    string response;
    using (var client = new TestRestClient(false, TimeSpan.FromMinutes(60)))
    {
        response = client.GetAsync($"{APITESTS_URL}/APITestUtils/IncompatibleReferences");
    }

    List<EspaceReference> references = JsonConvert.DeserializeObject<List<EspaceReference>>(response);

    Assert.IsFalse(references.Any(), "Incompatible references found: " + references.ToJSON());
}


Thank you Toni

I changed the select and from what I saw I did tests only brought me the ones with the broken reference. I also added a group by for understanding question.

I made a sqlAdvance for better understanding.


SyntaxEditor Code Snippet

SELECT 
    {Espace}.*,
    {Espace_Runtime}.*    
FROM 
    {Espace} 
    inner join {Espace_Version} on {Espace}.[Id] = {Espace_Version}.[eSpace_Id] and  {Espace}.Version_Id = {Espace_Version}.Id
    inner join {Espace_Reference} on {Espace_Version}.[Id] = {Espace_Reference}.[Consumer_Version_Id]
    inner join {Espace} Producer on {Espace_Reference}.[Producer_SS_Key] = Producer.[SS_Key]
    left join {Espace_Runtime} on {Espace}.[Id] = {Espace_Runtime}.[Espace_Id]
where 
    {Espace}.[Is_Active] = 1 and 
    Producer.[Is_Active] = 1 and 
    {Espace}.[Name] like 'sipv%' and
    {Espace_Runtime}.[Missing_References] > 0 and
    ({Espace_Runtime}.[Broken_References] > 0 or 
     {Espace_Runtime}.[Outdated_References] > 0 or   
     {Espace_Runtime}.[Outdated_Missing_References] > 0 or 
     {Espace_Runtime}.[OldProducer_References] > 0 or 
     {Espace_Runtime}.[Requires_Compilation] = 1)
group by 
    {Espace}.*,
    {Espace_Runtime}.*    
order by 
    {Espace}.[Name]
    

Result Sql

Service Center

It looks to me that you still only get the information about which eSpaces contain broken references between them, but not which exact object is broken. E.g. is it an action or an entity and what's the name of the action or entity. Right?

got it.
I'm going to study better.