HodorNV / ALOps

ALOps
59 stars 24 forks source link

Possible to add path to dependency apps ALOpsAppCompiler@2? #610

Open NAVFreak opened 1 year ago

NAVFreak commented 1 year ago

Is your feature request related to a problem? Please describe. I think this is a feature request.

I would like to do a multiversion compile of my app. So in one go it will compile it for several versions. This works as expected image

I would also like to do this for apps that has dependencies. But in my scenario I would like version X to compile and use the dependency apps version X in a certain folder. Is it possible to add a parameter where it should find the none-standard dependencies on the agent?

Describe the solution you'd like A parameter to specify where none-standard dependencies are located

waldo1001 commented 1 year ago

Not sure I'm following. Afaik, the Compiler is already compiling all apps in the right order (not using that myself, but that's how it was designed).

Can you share the pipeline for the multi-compile?

NAVFreak commented 1 year ago

This was more of a theoretical question which perhaps is not needed.

I have set up so my "leaf-apps" in the dependency tree is compiled in the last four major versions, 18-21 in one pipeline. image

Now I want to compile my MasterApp in the last four major versions in the same pipeline. When I wrote this I thought that I needed to compile each version with the same version of the dependency apps. image

But then I tried to download the lowest version of the dependency apps from their pipelines used as symbols for compilations for all the versions of the masterApp. This seems to work but I'm not sure if it is good 🤔. image

I just imagined that if I would download all dependencies in all versions and then compile it would always use the latest dependencies. So when I compile MasterApp v19 it would use the v21 dependency versions.

waldo1001 commented 1 year ago

I'm losing you completely, I'm afraid :-).

In case you just want to compile with a certain version of the MS Apps:

You could also have multiple repos - where the pipeline of one repo triggers the other pipeline.

In case you want multiple versions of your app being built

I hope this makes sense...

NAVFreak commented 1 year ago

Oh, all these apps are in separate repos. Each leafapp are in a separate repo. In each pipeline I want to compile different version of the app. Which I does with following code which works well for leaf apps. The problem arise when I do it for app with dependencies. No problem with downloading the right version of the dependency from its pipeline. But it will work if I download it oldest version, compile oldest version, download next oldest version, compile next oldest version. Then it will compile with the same version of the dependencies

# This one gets/sets the following variabels
  #  $(VersionLatest), $(Major)
  #   $(VersionSecond), $(MajorSecond)
  #   $(VersionThird), $(MajorThird)
  #   $(VersionFourth), $(MajorFourth)
- template: ./Get5LatestArtifactsVersion.yml@Templates 
  parameters:
    artifactcountry: '${{ parameters.artifactcountry }}'                          
    artifacttype: '${{ parameters.artifacttype }}'                         

- template: ./Compile.yml@Templates
  parameters:
    app_name: '${{ parameters.app_name }}'
    display_app_name: '(latest-3) ${{ parameters.app_name }}'
    artifactversion: '$(VersionFourth)'                       
    artifactcountry: '${{ parameters.artifactcountry }}'                          
    artifacttype: '${{ parameters.artifacttype }}'                         
    version_select: 'Closest'                          
    appversiontemplate: '$(MajorFourth).0.[yyyyWW].*'                   
    app_file_suffix: '${{ parameters.app_file_suffix  }}'
    file_filter: '*${{ parameters.app_name }}*$(MajorFourth)*${{ parameters.app_file_suffix }}.app'          
    failed_on_warnings: '${{ parameters.failed_on_warnings }}'
    targetproject: '${{ parameters.TargetProject }}'        
    CodeAnalyzers: '${{ parameters.CodeAnalyzers }}'

- template: ./Compile.yml@Templates
  parameters:
    app_name: '${{ parameters.app_name }}'
    display_app_name: '(latest-2) ${{ parameters.app_name }} '
    artifactversion: '$(VersionThird)'                   
    artifactcountry: '${{ parameters.artifactcountry }}' 
    artifacttype: '${{ parameters.artifacttype }}'       
    version_select: 'Closest'                          
    appversiontemplate: '$(MajorThird).0.[yyyyWW].*'   
    app_file_suffix: '${{ parameters.app_file_suffix  }}'
    file_filter: '*${{ parameters.app_name }}*$(MajorThird)*${{ parameters.app_file_suffix }}.app'            
    failed_on_warnings: '${{ parameters.failed_on_warnings }}'
    targetproject: '${{ parameters.TargetProject }}'      
    CodeAnalyzers: '${{ parameters.CodeAnalyzers }}'

- template: ./Compile.yml@Templates
  parameters:
    app_name: '${{ parameters.app_name }}'
    display_app_name: '(latest-1) ${{ parameters.app_name }}'
    artifactversion: '$(VersionSecond)'                      
    artifactcountry: '${{ parameters.artifactcountry }}'         
    artifacttype: '${{ parameters.artifacttype }}'              
    version_select: 'Closest'                          
    appversiontemplate: '$(MajorSecond).0.[yyyyWW].*'                   
    app_file_suffix: '${{ parameters.app_file_suffix  }}'
    file_filter: '*${{ parameters.app_name }}*$(MajorSecond)*${{ parameters.app_file_suffix }}.app'            # Default: *_APP.app" 
    failed_on_warnings: '${{ parameters.failed_on_warnings }}'
    targetproject: '${{ parameters.TargetProject }}'  
    CodeAnalyzers: '${{ parameters.CodeAnalyzers }}'

- template: ./CompileLatest.yml@Templates
  parameters:
    app_name: '${{ parameters.app_name }}'
    artifactcountry: '${{ parameters.artifactcountry }}'                            # Default: se
    artifacttype: '${{ parameters.artifacttype }}'                           # Default: Sandbox
    app_file_suffix: '${{ parameters.app_file_suffix  }}'
    failed_on_warnings: '${{ parameters.failed_on_warnings }}'
    targetproject: '${{ parameters.TargetProject }}'  
    CodeAnalyzers: '${{ parameters.CodeAnalyzers }}'

And this is the compile

- task: ALOpsAppCompiler@2  #Documentation: https://github.com/HodorNV/ALOps/blob/master/Documentation/BuildSteps_v2.md
  displayName: 'Compile ${{ parameters.display_app_name }}'
  inputs:
    usedocker: true
    artifactversion:  ${{ parameters.artifactversion }}                   
    artifacttype:  ${{ parameters.artifacttype }}                  
    artifactcountry: ${{ parameters.artifactcountry }}
    versionselect: ${{ parameters.version_select }}
    #nav_app_version: ${{ parameters.bc_app_version }} #
    appversiontemplate: ${{ parameters.appversiontemplate }}
    appfilenametemplate: "%APP_PUBLISHER%_%APP_NAME%_%APP_VERSION%${{ parameters.app_file_suffix }}.app"
    alsourcepath:  ${{ parameters.targetproject }}
    failonwarnings : ${{ parameters.failed_on_warnings }}
    #app_file_suffix: ${{ parameters.app_file_suffix }}                              
    alcodeanalyzer: ${{ parameters.CodeAnalyzers }}
    ruleset:  "./../MyRuleset.ruleset.json"
waldo1001 commented 1 year ago

Did you apply the "release branch strategy".

Just imagine: all your leaf apps have the same release branch - that way, you'd be able to download the right apps from the right branchs (assuming you're building for all those branches as well)?

NAVFreak commented 1 year ago

No. I did a template tree. Each app has a get-app template that takes branch and version no as template. There I have hardcoded which pipeline should be used for each version if that is needed. It downloads the app with the correct version from the correct pipeline. If it is possible one pipeline is compiling an app for multiple versions image

So when I want to compile a master app I make sure I'll do it i the right order with the lowest version first. I get the artifacts from the latest major and the first artifact from the other majors. Before compiling the lowest major its gets the dependency apps for that major and then it compiles. Then it does the same for the next and the next. Since ALOps always uses the latest version of dependent apps with will compile with the right version of dependet apps. Hence why I start with the lowest major.