Can I run a jenkinsfile from an already made freestyle project? - bash

I am currently making a jenkins project on an EC2 instance using ubuntu and have learned about jenkinsfiles. My already made pipeline to automatically detect changes to a github repo is the one I want to make run the jenkinsfile which as of now has only echo commands. Is this possible? I cannot seem to find much at all about this.
I have tried looking it up on youtube and google to no avail. Youtube videos show people creating new pipelines but I am wondering if its at all possible to do it on an already made freestyle project.

I don't think you can do that. When you create a new job you have to chose if it's a pipeline or not. There may be some workaround to run a jenkinsfile from some magic shell script, but that's already sounds making more problems than how many it solves.

Related

How to migrate Github Actions YAML to Bitbucket Pipelines?

Both Github Actions and Bitbucket Pipelines seem to fill similar functions at a surface level. Is it trivial to migrate the YAML for Actions into a Pipeline - or do they operate fundamentally differently?
For example: running something simple like SuperLinter (used on Github Actions) on Bitbucket Pipelines.
I've searched for examples or explanations of the migration process but with little success so far - perhabs they're just not compatible or am I missing something. This is my first time using Bitbucket over Github. Any resources and tips welcome.
They are absolutely unrelated CI systems and there is no straightforward migration path from one to another.
Both systems base their definitions in YAML, just like GitLab-CI, but the only thing that can be reused is your very YAML knowledge (syntax and anchors).
As CI systems, both will start some kind of agent to run a list of instructions, a script, so you can probably reuse most of the ideas of your scripts. But the execution environment is very different so be ready to write tons of tweaks like Benjamin commented.
E.g: about that "superlinter", just forget about it. Instead, Bitbucket Pipelines has a concept of pipes which have a similar purpose but are implemented in a rather different approach.
Another key difference: GHA runs on VMs and you configure whatever you need with "setup-actions". BBP runs on docker containers that should feature most of the runtime and tooling you will need upfront, as "setup-pipes" can not exist. So you will end up installing tooling on every run (via apt, yum, apk, wget...) so as to not maintain and keep updated a crazy amount of images with tooling and language runtimes: https://stackoverflow.com/a/72959639/11715259

Drone - build based on branch

I am using Drone as my CI/CD tool and now I'm facing an issue with this. My team consists of developers and testers (who also are developers), and the Test Team wants to put a specific branch in the staging environment, to test everything before merge it. The issue is: how to do that?
Drone has many configurations that can be found in the documentation. I am searching for something that allows my team to enter a Job and specify the branch in some sort of Dropdown component, then run the Job using that branch. This can be done so easily with Jenkins. Is there any way of doing that in Drone?
Thanks for any help.
Drone is very git-commit driven, which took some getting used to when we transitioned away from Jenkins.
You can probably do what you described with promotions. Promotions let you re-run a previous build with specific parameters. This lets you run different pipeline steps, or even completely different pipelines, depending on the promotion target specified.
I think a combination of promotions and triggers will get you where you need to go. Here is documentation on triggers .
So I would create a promotion that is triggered by the 'staging' branch. You can also ask more questions in the community slack for drone

Can you host a bitbucket pipeline internally?

We are currently using bitbucket cloud to host our grails-app repository. We want to set up some pipelines to do things like run unit tests and make sure the app compiles before being able to merge a branch to master.
I know this can pretty easily be done by letting them host the pipeline and committing a well written pipe file, however there is a problem standing that our app is very large, and even on brand new macbook pros takes 20 minutes to compile, on some older ones it can take 2 hours or more. Grails, thankfully, only compiles files that have changes in them from the last compilation. However, this can't be used on a bitbucket pipe that's working off a fresh pull of the app every time it runs.
My solution to this was wanting to set up a pipeline to run for us internally so that it can already have the app pulled, and just switch to the desired branch and run from there. This still might take time if switching between 2 very diverged branches, but it's better than compiling from fresh every time.
I can't seem to find any documentation on hosting a pipeline internally with bitbucket cloud, does anyone know if this is possible, and if so where there is documentation for it?
It would also be acceptable to find a solution to the long compilation problem itself with bitbucket hosted pipelines.
A few weeks ago, self hosted runners was made available as a public beta. Here are the details: https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Bitbucket-Pipelines-Runners-is-now-in-open-beta/ba-p/1691022
Additionally, if you're looking to retain some of your files from one build to the next to save doing the same work over and over again, have a look at caches: https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/ there are some built ones that you could use, but you can define your own custom ones as well. Essentially it's just a way of preserving the contents of a directory for a future build.

Jenkins pipeline usage for xcode

Are there instructions for using the xcode plugin from a jenkins pipeline?
I'm moving some freestyle projects to pipeline and have realised I've left a step out: Import developer profile. I'd like to know how to do that from a jenkins pipeline. I assume this should involve the xcode plugin, but it does not come up in the snippet editor and I see no documentation.
I got a steer to this on the Jenkins site.
IF on the snippet generator, you look under steps, there is something that generates xcode-related fragments. Don't know why this does not come out under xcode, like other plugins, but I guess that is a different matter.
I have not yet worked out how to do my original scenario but I guess I need to sit down some time and give it a good try. In the meantime, I'm using secret text for the password I need.

How to add some prebuild steps to jenkins?

I am a Jenkins newbie and need a little hand holding because we only maintain parts of our app in SVN. I have basic Jenkins install setup.
This is what I do to get a local DEV environment setup and need that translated to Jenkins in order to make a build:
DO SVN checkout (and get the 2 folders that are under SVN)
Delete the folders
Copy over the full app from FTP location
Do SVN restore
download sql file
Import into MySQL
How would I get the above mentioned steps in Jenkins? I know there are some post build steps that I can use. Just not sure how to put it all together. Any help will be much appreciated.
Tell Jenkins about the SVN repository and it will check it out automatically when a new build is started. That should take care of 1. 2-5 would be build steps (i.e. execute shell commands). Basically, you can set up Jenkins to do exactly what you do on the command line, except that the first step is taken care of automatically if you tell Jenkins about the repository.
Rather than trying to do these sort of things in Jenkins, you'll likely save yourself some trouble if you make use of something like Ant or NAnt to handle the complexities for your build.
I've found that doing my builds this way gives me added flexibility (ie, if it can be done via the command-line, I can use it in my build, rather than needing a Jenkins plugin to support it), and makes maintenance easier as well (since my NAnt scripts become part of the project and are checked into the VCS system, I can go back if I make a change that doesn't work out.
Jenkins has some build-history plugins, but over time I've found it easier to keep the majority of my 'build' logic and complexity outside of the CI environment and just call into it instead.

Resources