Gitlab Ci/CD Creating Setup for WPF Application - wpf

I have created a WPF project. It is using .net6 (no Blazor or Razor), and it is using WebView2. The Problem I have is with automated creating a Setup.exe or Msi File or what ever. And I already have a setup.exe, but something is strange with the executable of my application after installing my application with the setup.exe What I tried: WIX (but I got a tip of using innosetup, because it's free and easy to use) So I tried innosetup, and I am so extremely close to got it to work, that I do not want to give up yet. I achieved to create my Setup.iis file and I created a setup.exe. For this I used Gitlab-CE and a Runner. And the amake/innosetup image This one here
Tool_Build:
stage: build
image: mcr.microsoft.com/dotnet/sdk:6.0
only:
- master
script:
- dotnet build "$CI_PROJECT_DIR/Tool/Tool.csproj" /p:Version=$VERSION --configuration Release
- dotnet publish -p:PublishProfile=FolderProfile
tags:
- runner
artifacts:
expire_in: 1 day
paths:
- "$CI_PROJECT_DIR/Tool/bin/publish"
- "$CI_PROJECT_DIR/ATASetup.iss"
Tool_Setup:
stage: setup
image:
name: amake/innosetup
entrypoint: [""]
dependencies:
- Tool_Build
only:
- master
tags:
- runner
script:
- iscc "ATASetup.iss"
artifacts:
expire_in: 1 day
paths:
- "Output/Setup.exe"
The current problem I have is. when I install my application. It runs, BUT the EXE works strange. It opens a console, and this opens my application. When I use the EXE in my "publish" folder of the project, everything works well. When I use my innosetup on my pc manually, it works perfect. Has anyone some help for me? I am just a beginner, and I am so close to get it done (i hope )
in short: i am relatively new to programming and CI/CD.
i just could need a patient helping hand =)

Related

Sanity Deployment in Azure Pipeline

I'm trying to deploy my sanity react app, here's the repo:
https://github.com/sebastian-meckovski/sanity-admin-area
here's my yml file:
trigger:
- main
- feature/*
pool:
vmImage: 'ubuntu-latest'
variables:
SANITY_AUTH_TOKEN: $(SanityDeployAPIToken)
SANITY_STUDIO_PROJECT_BASEPATH: /studio
steps:
- task: NodeTool#0
inputs:
versionSpec: '14.x'
- task: CmdLine#2
inputs:
script: |
cd src/Studio
npm install -g #sanity/cli
npm install
sanity deploy
been using this article for help: https://blog.novacare.no/deploy-sanity-studio-with-azure-devops/
I'm getting this error in cmdline in azure:
Your project has not been assigned a studio hostname.
To deploy your Sanity Studio to our hosted Sanity.Studio service,
you will need one. Please enter the part you want to use.
any ideas?
Sanity Deployment in Azure Pipeline
That is because you would be asked to choose a unique hostname for your Studio when you first deploy sanity.
This is a pop-up verification window that needs to interact with our developers.
But the hosted agent is in the service mode instead of Interactive. Please check the docuement Azure Pipelines agents for some more details.
In this case, the verification window will not pop-up for the hosted agent. That is the reason why you get the error the project has not been assigned a studio hostname.
To resolve this issue, you need to create your private agent and set it as Interactive mode.
Self-hosted Linux agents
Or you could just deploy it from your local with command line, so that you could assign a studio hostname.
Of course, a more complete solution would be to have Sanity pre-specify the hostname somewhere (a json-like file) and then read it when deploying Sanity without specifying it during the process. But I'm not a Sanity expert and it's not clear if there is such a way.

Accessing Cloud SQL from Cloud Build

I want to configure CI/CD from Cloud Repositories that builds my CMS (Directus) when I push to main repository.
In the build-time, the project needs to access Cloud SQL. But I get this error:
I tried this database configuration with gcloud app deploy and it connects Cloud SQL and runs.
cloudbuild.yaml (It crashes at second step, so I didn't add other steps for simplicity):
steps:
- name: node:16
entrypoint: npm
args: ['install']
dir: cms
- name: node:16
entrypoint: npm
args: ['run', 'start']
dir: cms
env:
- 'NODE_ENV=PRODUCTION'
- 'EXTENSIONS_PATH="./extensions"'
- 'DB_CLIENT=pg'
- 'DB_HOST=/cloudsql/XXX:europe-west1:XXX'
- 'DB_PORT="5432"'
- 'DB_DATABASE="XXXXX"'
- 'DB_USER="postgres"'
- 'DB_PASSWORD="XXXXXX"'
- 'KEY="XXXXXXXX"'
- 'SECRET="XXXXXXXXXXXX"'
Node-pg (node library) adds /.s.PGSQL.5432 at the end automatically. That's why it is not written in DB_HOST.
IAM roles:
How can I solve this error? I read so many answers in Stackoverflow but none of them helped me. I found this article but I didn't fully understand how to implement it in my case (https://cloud.google.com/sql/docs/postgres/connect-build).
Without your full Cloud Build yaml, it's hard to say for sure - but, it looks like you aren't following the steps in the documentation correctly.
Roughly what you should be doing is:
Downloading the cloud_sql_proxy into your container space
In a follow up step, start the cloud_sql_proxy then (in the same step) run your script, connecting to the proxy via either tcp or unix socket.
I don't see your yaml describing the proxy at all.

Release fails when deploying React app to Azure Web App with Azure DevOps

I cannot get a Release pipeline in Azure DevOps to successfully deploy build files from a React app to an Azure App Service.
This is the YAML file for the app:
trigger:
- main
variables:
buildConfiguration: 'Release'
stages:
- stage: Build
displayName: 'Build my web application'
jobs:
- job: 'Build'
displayName: 'Build job'
pool:
vmImage: ubuntu-latest
demands:
- npm
steps:
- task: NodeTool#0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- script: |
npm install
npm run build
displayName: 'npm install and build'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: 'build'
ArtifactName: 'drop'
publishLocation: 'Container'
displayName: 'Build artifact'
As you'd expect, this puts the resultant build files in 'drop'. I can confirm this by inspecting the contents of 'drop' as it is a Published Artifact I can click on in the Summary tab for the Build process.
It's the Release that fails. This is the log for the release:
2022-03-28T11:29:39.9940600Z ##[section]Starting: Azure Web App Deploy: my-app-serv
2022-03-28T11:29:39.9952321Z ==============================================================================
2022-03-28T11:29:39.9952723Z Task : Azure Web App
2022-03-28T11:29:39.9953008Z Description : Deploy an Azure Web App for Linux or Windows
2022-03-28T11:29:39.9953295Z Version : 1.200.0
2022-03-28T11:29:39.9953540Z Author : Microsoft Corporation
2022-03-28T11:29:39.9953833Z Help : https://aka.ms/azurewebapptroubleshooting
2022-03-28T11:29:39.9954210Z ==============================================================================
2022-03-28T11:29:40.3697650Z Got service connection details for Azure App Service:'my-app-serv'
2022-03-28T11:29:42.3999385Z Package deployment using ZIP Deploy initiated.
2022-03-28T11:30:18.0663125Z Updating submodules.
2022-03-28T11:30:18.0670674Z Preparing deployment for commit id 'dc023bbe-d'.
2022-03-28T11:30:18.0672154Z Repository path is /tmp/zipdeploy/extracted
2022-03-28T11:30:18.0673178Z Running oryx build...
2022-03-28T11:30:19.1423345Z Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 16 -i /tmp/8da10ae4b1f9200 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log
2022-03-28T11:30:19.1431972Z Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
2022-03-28T11:30:19.1453191Z You can report issues at https://github.com/Microsoft/Oryx/issues
2022-03-28T11:30:19.1453685Z
2022-03-28T11:30:19.1454256Z Oryx Version: 0.2.20211207.1, Commit: 46633df49cc8fbe9718772a3c894df221273b2af, ReleaseTagName: 20211207.1
2022-03-28T11:30:19.1457307Z
2022-03-28T11:30:19.1463475Z Build Operation ID: |DTbD+7CrQyM=.49dfa157_
2022-03-28T11:30:19.1465355Z Repository Commit : dc023bbe-d46e-46f2-9d49-6e8157706c19
2022-03-28T11:30:19.1465695Z
2022-03-28T11:30:19.1466122Z Detecting platforms...
2022-03-28T11:30:19.1466558Z Could not detect any platform in the source directory.
2022-03-28T11:30:19.1467416Z Error: Couldn't detect a version for the platform 'nodejs' in the repo.
2022-03-28T11:30:19.1469069Z Error: Couldn't detect a version for the platform 'nodejs' in the repo.\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 16 -i /tmp/8da10ae4b1f9200 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log
2022-03-28T11:30:19.1469950Z Deployment Failed.
2022-03-28T11:30:19.1510175Z ##[error]Failed to deploy web package to App Service.
2022-03-28T11:30:19.1525344Z ##[error]To debug further please check Kudu stack trace URL : https://$my-app-serv:***#my-app-serv.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
2022-03-28T11:30:19.1527823Z ##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
2022-03-28T11:30:30.1233247Z Successfully added release annotation to the Application Insight : my-app-serv
2022-03-28T11:30:32.2997996Z Successfully updated deployment History at (CUT)
2022-03-28T11:30:34.0322983Z App Service Application URL: http://my-app-serv.azurewebsites.net
2022-03-28T11:30:34.0390276Z ##[section]Finishing: Azure Web App Deploy: my-app-serv
The Release uses Azure Web App Deploy. App Type is 'Web App on Linux'. 'Package or Folder' is the 'drop' folder. Runtime stack is '16 LTS (NODE|16-lts)' (but it also doesn't work if that's empty).
The drop folder does not contain zipped output. I don't understand why the Release operation is referred to as a Zip Deploy. Am I missing something to avoid the error 'Error: Couldn't detect a version for the platform 'nodejs' in the repo.'?
I'm just expecting the contents in the 'drop' folder to be successfully copied to App Service, and the web app run so I can test it (and in the long time, setup automated tests).
I've tried a number of different things with the Build, including zipping the build artifacts, with no luck. I don't think the build is the problem though, as the files in the 'drop' folder are the files I want copied.
So I think it's the Release that's the problem. But that looks so simple.
I start with an Agent and add an Azure Web App deployment task. It seems to successfully pickup the drop folder, as I've tried other values that show an obvious error when that is wrong. The target App Service is Linux, so the Web App Deploy App type is set to 'Web App on Linux'.
I've seen a few different approaches in stackoverflow, but no answers to this approach. Maybe I'm going about this the wrong way, but on the surface it looks right, as if I get this right, I can easily manage manual deployments, authorisations, etc. as supported by Releases.
Thanks in advance
One of the possible workarounds that you can try is to make the SCM_DO_BUILD_DURING_DEPLOYMENT= FALSE.
After making this as false, you should be able to deploy the app.
Also please refer these links with similar issue for more information.
Reference 1 ,
Reference 2

GitLab CI Pipeline Job gives error JavaScript heap out of memory

We have a WordPress plugin written in JS with the help of the tool wp-reactivate.
Our goal is to make a GitLab CI Pipeline that increases the version in all places, builds the project and deploys it to the WordPress.org SVN repository. So far, the SVN deployment does work, incrementing the version number is unimplemented yet, but we have a problem building the project. The GitLab CI Runner refuses to finish the process since it ran out of available memory.
We have already tried (with no effect):
Setting GENERATE_SOURCEMAP=false
Setting NODE_OPTIONS="--max_old_space_size=8192"
Running node --max-old-space-size=8192
Our .gitlab-ci.yml file:
stages:
- build
- deploy
default:
image: node
BuildApp:
stage: build
before_script:
- GENERATE_SOURCEMAP=false
- NODE_OPTIONS=\"--max_old_space_size=8192\"
- node --max-old-space-size=8192
script:
- yarn
- yarn prod
PluginSVN:
stage: deploy
before_script:
- apt-get install subversion
- curl -o /usr/bin/deploy.sh https://git-cdn.e15r.co/open-source/wp-org-plugin-deploy/raw/master/scripts/deploy.sh
- chmod +x /usr/bin/deploy.sh
script: /usr/bin/deploy.sh
when: on_success
Is there any way to increase the amount of available memory, or reduce the amount of memory required for building the project?
Check Gitlab Forum:
Every runner only have 1CPU, 4GB RAM,
which means you don't have to adjust node options, it won't work.
For me, self-hosted is an option.
what ever I install gitlab-runner on self host, or docker, I got same issue.
Finally I got the root cause. The ec2 instance I created is too low, t2.micro
After I adjust it to t3.medium (you should be fine to adjust to any, with 4GB+ memory), it works without this issue any more.

How do i build deploy and server a React application locally using Ansible?

I would like to install, configure, deploy and serve a local react application using Ansible but i cannot get any valuable information to do it.
Is there anybody who can guide me on how to achieve this?
Thanks in advance.
First off, ansible has a REALLY extensive wiki here. That will show you the many modules that can be used to do specific tasks. However, this is not where I would start for writing your first playbook, it gets rather daunting.
However, I started and would recommend you start on this tutorial on how to make your first playbook. you would make a yaml file and run it using the 'ansible-playbook' command on a host that has ssh enabled, ansible installed, and a key pair setup (easily done with ssh-copy-id user#hostname). If you need a way to quickly provision these machines, I personally use Hashicorp's Vagrant to quickly make simple Virtual Machines, however it is possible to use Docker or something else.
As for the specifics for installing specific applications using apt; use the apt module in ansible should serve you right. If you need to install NPM or something of the sort, chances are there's a module for that too. As for copying configs you would want the copy module. Things are pretty straight forward. a good way to structure the google searches to find specific modules would be something like "ansible copy files" and find something from docs.ansible
I realize that this is rather vague; however, I'm not completely sure on your use case in this scenario simply because of the broadness of the question.
Thanks a lot for your input, it was very helpful.
I finally achieved what i was looking for, and for reference here's how i made it. Hope this is useful for other users.
Assuming you have already installed Ansible in your machine, the following should do the job.
vim inventory
[appserver]
127.0.0.1 ansible_connection=local
vim playbook.yml
---
- hosts: appserver
tasks:
- name: Installing nodejs
apt: name=nodejs update_cache=yes
- name: Installing npm
apt: name=npm update_cache=yes
- name: Installing dependencies
command: npm install
- name: Building
command: npm run build
- name: Installing web server
command: npm install serve
- name: Running app on http://localhost:8080
command: chdir=./build serve -p 8080
To run it, just place the following in your CLI
sudo ansible-playbook -i inventory playbook.yml

Resources