Deploying contents of a source code directory to a server. - ant

I'm trying to create a build that:
checks out my source code from Stash (complete)
grabs files out of a directory
deploys those files to my server (sort of complete)
The file structure is:
/dev/stuff.to.deploy
/random.file
/random.file
When I create the artifact, and deploy it, it always includes the "dev" folder. So my server looks like:
/root/dev/stuff.to.deploy
What I want, is to copy the contents of the dev folder and place them in my server's root directory so that it looks like:
/root/stuff.to.deploy

Related

Copy template folder to current folder with environment variable

I would like to speed up the process of creating folders, I have a template folder with subdirectories that I use often and every time I have to go there in the path where the template folder is and copy it to start a new project.
The thing is, I thought of creating an environment variable that would do this for me, the variable would execute a command like this robocopy "%~d0\model folder\" "%cd%" /e
That is: copy the contents of the model folder path that is on that same drive and paste it in the folder where this command prompt is open.
Obviously this doesn't work, because if the command prompt is already open in a folder it won't be able to access the source path to make the copy...
Any idea how I could make it work?

Accessing assets in an Electron/Svelte project?

I've used Electron and Electron-Builder for a long time and am now learning Svelte and trying to use it in my projects. I've got the simple 'hello world' project up and running using this tutorial but I am confused about how to reference packaged assets– for example images or json files in an included 'assets' folder. An image of my directory structure is below.
If I console.log( __dirname); in my Svelte component I get /Users/UserName/electron_workspace/electron-app-svelte/public – which I understand is the compiled component context - but my 'assets' folder is in the 'src' directory.
Do I put my 'assets' folder in the 'public' directory rather than 'src'? (And I guess 'git-ignore' the 'build' folder?)
It looks like the simple (and obvious, I guess) answer is to store project assets in the 'public' directory of the project, per this 2021 article: Directory and files structure of Svelte projects
public folder
This folder holds the production ready files. So, if
your project has images, videos, other multimedia, svg etc. then they
all will be stored in this folder. When you run npm run build, Svelte
will compile your files, optimize them and store in build folder
within public folder. This build folder can be deployed to server.
I've always stored production assets in the project 'src' directory since that is what gets versioned/stored in git compared to the compiled 'dist' (build) directory which does not. I guess I will need to 'git-ignore' the 'build' directory.

Jenkins not copying folder structure of project

I'm trying to deploy with Jenkins. I'm sending to a server, and the folder www receives the files from the root project, but doesn't receive any of the folders and subfolders. How can I fix this?
I thought it could be permissions, so I tried to give chmod 777 to www, but didn't work anyway.
I have configured my server (hostname, username, and remote directory). Then I create my job with a git config (url, credentials, and branch to watch), job will run every minute. In the Build option, I put source files (*), Exec Command (commands for migrations and things like that). When it runs, my www folder was empty and receives files, but not folders.
I have found this link that explain how to do a best configuration for Jenkins: Jenkins transferring 0 files using publish over SSH plugin and I've discover why Jenkins just send files and not folders, this * should be **/* in Source files.

Jenkins: Copying Artifact (directory) from one Job to another

in Jenkins, I have a job downloadAgents that is responsible of creating a folder and populating it with some files. Then the folder is saved as an artifact with the following folder structure
dev\downloadAgents\target\dependency\ios
Then I need to copy the contents of the ios folder into the workspace of another job (into a specific folder).
I have added the Copy artifacts from another project step. And it does copy the artifacts, but it copies the full path
\dev\downloadIosAgents\target\dependency\ios
How can I tell jenkins to copy only one folder ios and everything that is inside it and, do not copy all folders that are before ios.
Also if there are already files in the destination folder, will it merge the 2 folders?
You can use regex for your copy (under "Artifacts to copy")-
dev\downloadAgents\target\dependency\ios***.*
** - all folders under ios
*.* - all file types
You can also specify the target directory, and you also have a flag for "Flatten directories". This will move all the files without the hierarchy of the folders (flat to your target directory)
Feel free to look at the plugin's home page:
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
In CopyArtifacts plugin specify the pattern: \dev\downloadIosAgents\target\dependency\ios\*.* or \dev\downloadIosAgents\target\dependency\ios\** - I don't remember exactly.
That should do the job.

Prevent Publish to SCP Repository from Maintaining Original Folder Structure

I'm running Jenkins v1.581 and Publish artifacts to SCP Repository v1.8.
I am able to successfully copy my artifacts over SCP to a destination directory; so I know that server names, authentication, etc... are all correct.
My configuration looks something like this:
Source: tmp/distribution/target/deploy/opt/**
Destination: opt
When Jenkins puts the file over SCP it ends up in a directory structure of opt/tmp/distribution/target/deploy/opt/rest_of_path. It looks like it's keeping the original path of the file as it existed as an artifact and appending it to the destination path. This causes my artifacts to be deployed to an unexpected path.
My expectation is that they would end up as opt/rest_of_path. How do I fix this?
I replaced the Publish to SCP Repository with the Send build artifacts over SSH plugin. This plugin has an option for Remove prefix which does exactly what I wanted.

Resources