Github action: Stuck on "Start deployment (Y/n)?" - SAPUI5 - github-actions

We are trying to deploy a SAPUI5 application via github actions. Right now we call the deploy command via npm run deploy in the github action. The step wont proceed since it is asking the user to confirm the deployment.
Start deployment (Y/n)?
However, the third party script responsible for the deployment has no option to always default to "Y".
Is there a way to let github actions enter a "Y" in such cases? Do you have another idea how to solve this problem?

Just use
yes | npm run deploy
This will automatically choose y when deploying.

I was doing the same kind of thing with Django. I tried this and it worked.
echo 'yes' | python manage.py collectstatic
The prompt was like mentioned below:
[enter image description here][1]
You have requested to collect static files at the destination
location as specified in your settings:
/home/path-to-staticfiles/
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue or 'no' to cancel:
I was running the command from my github-actions. The 'yes' is automatically picked for the prompt.

Related

Context error : Where does Azure CLI command run?

I'm actually setting up a devops environement using Github Actions and Microsoft Azure services. One of the steps i use in my pipeline is building a Docker image and pushing it to Azure Container Registry (ACR). To do that, i'm using the official action.
The problem is that when my Dockerfile is built , the server cannot find the path for the files i used in it.
To make it work, i tried to change the folder i passed to the action but with no result. Despite my Dockerfile is at the root of my project ( the default value in the action ), i get an error even when i'm explicitely giving the path.
I understood that the context of the server in which it runs is way different than mine. Knowing that in my workflow i build the project (to generate the JAR file) before trying to build the Docker image so the JAR file exists on the server which runs the workflow (Github server). I tried to debug the Build action, and the line which fails is 26 : az acr build ..., i'm actually 99% sure that all arguments are correct, but i still get the context error.
I tried to understand by myself and searched in the Azure CLI documentation but couldn't find the information. So now the question i'm asking myself is : does the az acr build run locally on the shell which called it (check scenario 1 image) ? or on an azure server which would explains why the server cannot find the JAR file (scenario 2) ?
And if it is scenario 2, is there a way to make pass the JAR file to az acr build and influence the server context ? Or should i ignore the official action and rewrite an action by myself which build the image locally not using the az acr build command ?
My Dockerfile (Spring Boot project) :
FROM openjdk:11
COPY target/devOps-0.0.1-SNAPSHOT.jar devOps-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "/devOps-0.0.1-SNAPSHOT.jar"]
The error i get :
Step 2/3 : COPY target/devOps-0.0.1-SNAPSHOT.jar devOps-0.0.1-SNAPSHOT.jar
COPY failed: file not found in build context or excluded by .dockerignore: stat target/devOps-0.0.1-SNAPSHOT.jar: file does not exist
2022/11/02 08:16:14 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 1
Scenario 1 :
Scenario 2 :

What server URL should be used for the `oc login` command when using OpenShift's PaaS?

What do I provide for the server URL in the oc login tool, when using the OpenShift PaaS?
I'm trying to migrate my OpenShift Online v2 app to v3, following the instructions for PHP apps linked to from OpenShift's Migration Center. That page says to run something following the pattern oc new-app https://github.com/<github-id>/<repo-name>.git --name=<app-name> -e <ENV_VAR_NAME>=<env_var_value>. After tracking down a download for oc (which wasn't easy), I tried running that command with my repo URL*; this results in:
$ oc new-app https://USERNAME#bitbucket.org/USERNAME/PROJECTNAME.git --name=PROJECTNAME
error: Missing or incomplete configuration info. Please login or point to an existing, complete config file:
1. Via the command-line flag --config
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
To view or setup config directly use the 'config' command.
Not knowing what subcommand of oc config to use, I searched and found Get Started with the CLI, which says to use oc login to start the configuration process. But when I run that, I get:
Server [https://localhost:8443]:
What do I provide for the URL here, when using the OpenShift PaaS (i.e. not a local installation)? I've tried things like https://openshift.com/ and the URL of my web app, but both of them result in
error: The server was unable to respond - verify you have provided the correct host and port and that the server is currently running.
* I decided to use Bitbucket instead of GitHub; I'm not sure if this is unsupported, or (if it's supported) whether I should be providing USERNAME#bitbucket.org.
It is right over there in the web console.
Click on (?) help icon right beside your user name on top right corner. Select 'Command Line Tool' from the drop down menu.
Alternatively, it is there in the URL :
http://<openshift url>/console/command-line
e.g. it is mentioned on the below URL for me:
https://console.starter-ca-central-1.openshift.com/console/command-line
Hope it helps.
In the RedHat OpenShift Online web console, click on the (?) help icon right beside your user name in the top right corner. Select 'Command Line Tools' from the drop down menu.
A pop-up window appears with a section "oc - OpenShift Command Line Interface (CLI)", and there's a link for Copy Login Command. Click that and it takes you to a page like
https://oauth-openshift.apps.ca-central-1.starter.openshift-online.com/oauth/token/display?code=Ge.....
(You may be prompted at this point to log into the Redhat Portal, do that if necessary.)
The page will then show the text
Display Token
Click Display Token
It will show output similar to this:
Log in with this token
oc login --token=... --server=https://api.ca-central-1.starter.openshift-online.com:6443
On the web console, click in your profile and then you can see "copy Login command" like this:
Then you just click on it and do it again on the button "Display token" in the new browser tab. Here is what your token looks like:
I just tried actually signing up for an OpenShift v3 Starter plan (which I hadn't done before because I didn't want to get ahead of myself, and the migration guide hadn't said to do so yet). That course of action did give me access to the "Command Line Tools" menu item under the ? menu, which gives the command line as oc login https://api.starter-us-east-1.openshift.com --token=<hidden>. (The hidden token is copied to the clipboard if you click the clipboard icon to the right of that line.)
I created an account for OpenShift v3 Starter plan.
Then I installed OC Tool available here.
I created a project called spike1 on US west.
Finally when running oc login and set Server URL to https://console.starter-us-west-1.openshift.com/
Hope this helps.
Once you create a project in public OpenShift. It redirect to my console
starter-us-west-1.openshift.com/console/
If you wana login to openshift using CLI.
command is
oc login https://console.starter-us-west-1.openshift.com

Clone Openshift application in scalable

I have an application in Openshift free plan with only one gear. I want to change it to scalabe and take usage of all of 3 free gears.
I read this blog post from openshift and I found that there is a way to do it. I should clone my current application to a new one as a scalable which will use the 2 remaining gears and then I will delete the original application. Thus, the new one will have 3 free gears.
The way that blog suggest is: rhc create-app <clone> --from-app <existing> --scaling
I have the following error: invalid option --from-app
Update
After running the command gem update rhc, I don't have the error above but...A new application with the given name has created with the same starting package (Python 2.7) just like the existing one, but all the files are missing. It actually create a blank application and not a clone of the existing.
Update 2
Here is the structure of the folder:
-.git
-.openshift
-wsgi
---static
---views
---application
---main.py
-requirements.txt
-setup.py
From what we've talked on IRC, your problem was around missing SSH configuration on Windows machine:
Creating application xxx ... done
Waiting for your DNS name to be available ...done
Setting deployment configuration ... done
No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.
I've double checked it, and it appears to be working without any problem.
The only requirement is to have the latest rhc client and putty or any other
SSH client. I'd recommend going through this tutorial once again and double-check everything to make sure everything is working properly.
Make sure you are using the newest version of the rhc gem with "gem update rhc" to make sure that you have access to that feature from the command line.
The --from-app will essentially do a 'rhc snapshot save & snapshot restore` (amoung other things) as you can see here from the source:
if from_app
say "Setting deployment configuration ... "
rest_app.configure({:auto_deploy => from_app.auto_deploy, :keep_deployments => from_app.keep_deployments , :deployment_branch => from_app.deployment_branch, :deployment_type => from_app.deployment_type})
success 'done'
snapshot_filename = temporary_snapshot_filename(from_app.name)
save_snapshot(from_app, snapshot_filename)
restore_snapshot(rest_app, snapshot_filename)
File.delete(snapshot_filename) if File.exist?(snapshot_filename)
paragraph { warn "The application '#{from_app.name}' has aliases set which were not copied. Please configure the aliases of your new application manually." } unless from_app.aliases.empty?
end
However this will not copy over anything in your $OPENSHIFT_DATA_DIR directory so if you're storing files there, you'll need to copy them over manually.

How to configure Post build tasks in Hudson?

Hi I am using Hudson for source code management. I am able to correctly download the required code from my feature branch and successfully build it.
But I also require to trigger an .exe file once my build has been successful which I am unable to figure out.
Do I have to use some plugin or there is some other way? If it is a plugin please specify how to set up.
Additional Details: I can trigger the exe perfectly from the command prompt but when I write the same command in the Build step of my job, I just get a "Finished: Success" message but not exe has been triggered
You can use Post build task plugin : http://wiki.hudson-ci.org//display/HUDSON/Post+build+task.
To add this plugin in your project, just search for 'post build' on plugin's search page and install it.
After that you can configure on your job's page. It will appear a checkbox with this label: 'Post build task'.

Hudson svn credentials

How to enter subversion credentials in Hudson by shell?
I've tried to generate file hudson.scm.SubversionSCM.xml in HUDSON_HOME and reload configuration, but changes weren't applied.
The easiest way to enter a credential from the shell is to use "svn" executable. Hudson recognizes the ~/.subversion/auth directory that it creates.
Under Windows the global credenentials are stored under %APPDATA%\Subversion\auth. The following Groovy code helps generating these credentials:
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url))
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(SVNWCUtil.defaultConfigurationDirectory,"AD\user","password",true)
repository.setAuthenticationManager(authManager)
repository.getDir("", -1, null ,(Collection)null) // or some random SVN operation
Libraries used in the code above (example in Gradle):
compile 'org.tmatesoft.svnkit:org.tmatesoft.svnkit:1.7.8'
compile 'net.java.dev.jna:jna:3.4.0' // so wincrypt is available
Make sure you run the code with the same user Hudson runs on the Windows machine.
Just start with the Hudson.
Install all required Plug-Ins.
Hit the link,EX:-localhost:8080/hudson
Click on the add job/Create job.
While choosing the options SVN will be present there,Give the SVN location.
Credentials link is present out there.Click on that link.
A form will get open,provide valid credentials for that location of SVN.
Observe the Success message on the screen and then get back to the Create job,Complete with Job creation and Build the task.