Skip to content
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

Feature Request - Render "Views As Images" when a model is published #106

Open
PaulComis opened this issue Jul 4, 2019 · 8 comments
Open

Comments

@PaulComis
Copy link

One of my use-cases is to share views with people who are not Archi users.

Currently I have to save the "view as image", and then copypasta into an email (or save to sharepoint or similar).

It would be really helpful, if when a model is published to git(hub) if it would also render the views as images, and then I could send the URLs to those links (with out the need for people to install Archi and the collaboration plugin).

Thanks in advance

@Phillipus
Copy link
Member

Phillipus commented Jul 4, 2019

Sorry, but that's out of scope for the collaboration plug-in, as the repo should only contain model information.

A better way to do this is to generate and publish an online HTML report when a push is done.

@jbsarrodie
Copy link
Member

Hi,

One option is simply to export your model as HTML and then send them a ZIP containing the whole export.

If you really don't want to provide them access to the whole model, you can easily create a jArchi script that would take the selected views and deleted anything else before exporting as HTML.

Of course, these html pages can be hosted wherever you want (can) instead of sharing a ZIP file.

@WatchTh1
Copy link

WatchTh1 commented Jul 7, 2019 via email

@PaulComis
Copy link
Author

PaulComis commented Jul 16, 2019

@Phillipus @jbsarrodie @WatchTh1 appreciate the feedback.

I've got the desired effect by pushing my exported (html) model to a new repo and publishing using gh-pages (and sending the link to my non-archi colleagues so we can discuss the views)

My next experiment is to see if I can do the same, publishing to the gh-pages branch of the repo where the actual model is stored (using the collaboration plug-in).

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

@jbsarrodie
Copy link
Member

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

That's basically the purpose of Archi Collaboration Server on which we have been working of for some months now. Even if there is no official publication asof now, you can join the public beta by droping me a private message on Archi's forum.

Just a remark about gh-pages: these pages are publicly accessible (not sure of the exact visibility if you use GitHub Enterprise though, but I doubt they use access rights defined for the repository).

@PaulComis
Copy link
Author

@jbsarrodie - Indeed - for this particular use case I'm using GitHub Enterprise which is not publicly accessible.

As an aside; I'm also trying to promote the use of ArchiMate and Archi within my sphere of influence ... if I can get a handful more like-minded people then the collaboration server may really help.

@WatchTh1
Copy link

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

That's basically the purpose of Archi Collaboration Server on which we have been working of for some months now. Even if there is no official publication asof now, you can join the public beta by droping me a private message on Archi's forum.

Just a remark about gh-pages: these pages are publicly accessible (not sure of the exact visibility if you use GitHub Enterprise though, but I doubt they use access rights defined for the repository).

Would it be possible to deploy and instance of a such application in private environment, such as isolated enterprise network segment ?

@TitaniumIT
Copy link

for azure devops i created this pipeline.yml to display changed images in the description field of the PullRequest

 steps:
          - pwsh:  | 
              curl --fail --output $(Agent.TempDirectory)/archimate.tgz https://www.archimatetool.com/downloads/archi.php?/5.0.2/Archi-Linux64-5.0.2.tgz
              curl --fail --output $(Agent.TempDirectory)/coArchi.archiplugin https://www.archimatetool.com/downloads/coarchi/coArchi_0.8.8.archiplugin
            displayName: Download
          - pwsh: |
              ls -l
              tar zxvf archimate.tgz
              unzip coArchi.archiplugin -d Archi/plugins/
            displayName: Extact
            workingDirectory: $(Agent.TempDirectory)
          - pwsh: |
              xvfb-run ./Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --modelrepository.loadModel $(Build.Repository.LocalPath) --html.createReport $(Pipeline.Workspace)/html
            displayName: Create Html
            workingDirectory: $(Agent.TempDirectory)/Archi
          - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}:
            - pwsh: |
                 $commitsUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/commits?api-version=7.0"
                 $commits = Invoke-WebRequest -Uri $commitsUrl -Method GET -Headers @{Authorization = "Bearer $(System.AccessToken)"} -ContentType "application/json" | ConvertFrom-Json

                 $changedFiles =@()

                 foreach ( $commit in $commits.value ){
                   $commitId = $commit.commitId 
                   $changesUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/commits/$($commitId)/changes?api-version=7.0"
                   Write-Host "processing commit id" $changesUrl
                   
                   $changes = Invoke-WebRequest -Uri $changesUrl -Method GET -Headers @{Authorization = "Bearer $(System.AccessToken)"} -ContentType "application/json" | ConvertFrom-Json
                   foreach ( $change in $changes.changes ){
                      $changedFiles += $change.item.path
                   }
                 }
                 Write-Host $changedFiles
                 $images = Get-ChildItem -path */images/*
                 $description = ""
                 foreach ( $img in $images ){
                   Write-Host Processing $img.Basename
                   if ( $changedFiles.Where( { $_.contains( $img.Basename) }).count -gt 0 ){
                      $filename = "$(New-Guid)"+$img.Extension
                      $url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/attachments/$($filename)?api-version=7.0"

                      Write-Host $url

                      $result = Invoke-WebRequest -Uri $url -Method POST -Headers @{Authorization = "Bearer $(System.AccessToken)"} -InFile $($img.FullName) -ContentType "application/octet-stream" | ConvertFrom-Json

                      Write-Host $result
                      $comment = "![]("+$result.url+")`n"
                      $link = $result.url
                    
                      $description += "![]($link)`n"
                    }
                 }
                 
                 $body = @"
                  { 
                     "description": "$description"
                  }
                 "@ 

                 Write-Host $body
                 $commenturl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)?api-version=7.0"

                  Invoke-WebRequest -Uri $commenturl -Method PATCH -Headers @{Authorization = "Bearer $(System.AccessToken)"} -body $body -ContentType "application/json"
              displayName: Show Images
              env:
                tempdir: $(Agent.TempDirectory)
                buildid: $(Build.BuildId)
                
              workingDirectory: $(Pipeline.Workspace)/html

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants