I am new to artifactory, and have managed to get my artifacts uploaded, using the following filespec:
{
"files": [
{
"target": "generic-local/MyAppName/${bamboo.BUILD_MAJOR}.${bamboo.BUILD_MINOR}.${bamboo.BUILD_STREAM}.${bamboo.buildNumber}/",
"pattern": "Output/Release/*.*"
}
]
}
This appears to work, I have a project folder, with a folder for each version below it, and the artifacts within.
How can I write an unrelated download task to get the latest build artifacts? By unrelated, I mean no knowledge of the build counters.
Thanks.
If you're uploading files to Artifactory using File Specs, you have the option of including these files as part of the build-info, which can also be published to Artifactory. If you're using Bamboo, you just need make sure the "Collect build-info" option is selected in Artifactory Deploy task, and that the Publish Build-Info task is added after ther Artifactory Deploy task.
You can then download these artifacts, using the Artifactory Resolve task, using the following File Spec:
{
"files": [
{
"pattern": "generic-local",
"build": "the-build-name"
}
]
}
Notice that this spec includes only the repository where the artifacts are in, and the build name. This will download the artifacts of the latest build run published to Artifactory.
If you'd like to download the artifacts of a specific build rum, just add the buiod number as follows:
{
"files": [
{
"pattern": "generic-local",
"build": "the-build-name/the-buil;d-number"
}
]
}
This functionality is not specific to Bamboo only. It is supported by all of JFrog Artifactory's CI integrations.
You can read more about File Spec here.
To resolve artifacts from Artifactory, use the Artifactory Generic Resolve task.
In the file spec, use "sortBy" and "limit" to get the latest artifacts.
Related
I can't figure out how to register a local directory as a composer package. I found lots of information about registering a local folder that is either a git repository or a composer package or even a zip hosted somewhere.
However I want to register a folder on my local machine, residing in the same repository as my wordpress installation (using wordplate) that is neither a git repository nor a composer package as it doesn't contain any composer.json.
What I try at the moment is to register it like this under repositories:
{
"type": "package",
"package": {
"name": "local/contact-form-7-mailchimp-extension",
"type": "wordpress-plugin",
"version": "dev-master",
"source": {
"type": "path",
"url": "resources/plugins/contact-form-7-mailchimp-extension",
"reference": "master"
}
}
}
Add "local/contact-form-7-mailchimp-extension": "*" under "require",
add "local/contact-form-7-mailchimp-extension" in "public/plugins/{$name}" under "extras" > "installer-paths".
Running composer install however doesn't install it and gives no information at all. Don't even know if it found the url or not..
Is it even possible to install a local directory like that?
You can use the path repository to install packages from a different path into your project.
However I want to register a folder on my local machine, residing in the same repository as my wordpress installation (using wordplate) that is neither a git repository nor a composer package as it doesn't contain any composer.json.
For this to work, your plugin inside the folder will need a composer.json, though. This is necessary for composer to recognize this folder as a package in the first place. Fortunately, it can be as simple as this:
{
"name": "local/contact-form-7-mailchimp-extension",
"description": "My Contact Form-extension using mailchimp",
"type": "wordpress-plugin",
"version": "dev-master"
}
Assuming the plugin is in the directory resources/plugins/contact-form-7-mailchimp-extension, you can now register this path as a repository path, meaning composer will look inside this folder for a composer.json and when your wordpress-project requires the provided package it will (by default) be symlinked into vendor.
The wordpress project's composer.json then needs these entries (the options for the repository are the defaults and can be left out, this is just to show how to disable symlinking, should you need that):
{
...,
"repositories": [
{
"type": "path",
"url":"resources/plugins/contact-form-7-mailchimp-extension",
"options": {
"symlink": true
}
}
],
"require": {
"local/contact-form-7-mailchimp-extension": "dev-master",
...
}
}
When composer installs the package, it should tell you where it installed it from, i.e. you should find the path from the repository in there.
I am currently installing phpunit on a per project basis.
This works extremely well, however, the install takes time because I install the directories from cache each time. Is there a way to symlink the directories to one install, or some kind of clever trick I can use to make it do that.
If I do a path repository like this, with phpunit cloned and composer installed on my disk:
"require-dev": {
"phpunit/phpunit": "dev-master"
},
"repositories": [
{
"type": "path",
"url": "../phpunit",
"options": {
"symlink": true
}
}
],
This installs only links the phpunit/phpunit directory, and not the rest of the dependencies like:
"phpunit/php-code-coverage": "^5.2",
"phpunit/php-file-iterator": "^1.4",
"phpunit/php-text-template": "^1.2",etc
Composer can install packages globally and then you can refer to the files via it's path, or put the appropriate directory into your PATH variable (in ~/.composer/vendor/bin). Another, often more popular method is to download the phpunit.phar file, and use that to run PHPunit. This also has the advantage of being a single file that can also be committed to a project - though you will want to occasionally update it to the latest version (at least within the major version, 5.7+ or 6.1+). The .Phar file can also be installed globally on the server, in the same way that composer is suggested to.
I have the project structure:
/src
- common
- common-x
+ project.json
- module-a
- project-a
+ project.json
- project-a-tests
+ project.json
+ global.json
I'm trying to include the common-x project using relative file paths in the global.json file.
The global.json file in the module-a directory is as follows:
{
"projects": [
"project-a",
"project-a-tests",
"../common/common-x"
]
}
and the project.json file in project-a is
{
// Default config options are also in this...
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"common-x": {
"target": "project"
}
}
}
project-a-tests has no problem referencing project-a since they are in the same directory, but project-a can't find the common-x project. I receive a "Unable to resolve ..." error from dotnet restore.
I have tried using absolute paths but that doesn't work either. The closest solution so far is to use symlinks but that is not preferable.
Note: This is all being run on Ubuntu 16.04.
You should only need to specify top level folders in your global.json file, since sub-folders will be scanned automatically. Global.json reference.
So your global.json should look like this.
{
"projects": [ "src" ]
}
If you are still getting any dependencies issues that might related to compatibility problems between projects/modules, however I would need to see the exact output you are getting to troubleshoot that.
UPDATE
A few tips that might be useful:
Delete old project.json.lock files
Add a .sln solution file if you don't have one created.
UPDATE 2
As per your comment, the working solution was to move global.json into src folder, and list your top-level folders in the projects array.
This seems like something which should be pretty easy to do, but for whatever reason, I'm being defeated.
I'm trying to use the firebase-tools CLI to interact with my database. I'm able to login without any trouble, and when I type firebase list, I get a list of all my current apps. It also tells me which app I'm currently connected to.
My problem is, I want to connect to one of the other apps. I'm running queries on my staging app, and I need to run them on my production app. I can see the production app in the list, but I'm not finding any way to switch to that app.
Thoughts?
Found some useful information here Firebase CLI Reference.
The following code works for me.
firebase use <project_id>
I rather use scripts. Consider a project structure like this:
your-project
├── .firebaserc
└── functions
├── package.json
└── index.js
Go to .firebaserc and follow the next example
{
"projects": {
"default": "project-name",
"prod": "other-name"
}
}
Then go to package.json and add the following scripts (changeToProd, and changeToDev).
{
...
"scripts": {
...
"changeToProd": "firebase use prod",
"changeToDev": "firebase use default"
},
"dependencies": {
...
},
...
}
If your IDE support npm scripts you can run them using the IDE UI, otherwise it can be run using the command console. Make sure you are inside the functions folder.
npm run-script changeToProd
You can verify your current project by running the following command from the terminal or added to the scripts as we just did
firebase use
If you are using Node.js on windows, your answer should be
firebase use <project_id>
but without the <> for example
firebase use chat-app-2a150
You can use the following code to view all your projects so as to pick the correct project ID to use
firebase projects:list
2020:
The officially recommended way is to use "alias":
In your .firebaserc, set different project IDs like this:
{
"projects": {
"production": "my-project-id",
"testing": "my-testing-project-id"
}
}
// you can also add them interactively with `firebase use --add`
Then switch projects in CLI with firebase use testing , firebase use production.
Note: switching projects won't create any git diff, it's simply remembered in your local machine. Use firebase use to see which project is currently being used.
Uncommon cases:
If you want to use your own ID without committing changes to the project owner's .firebaserc, do firebase use my-own-id locally as mentioned in the accepted answer.
If you want people to fork your code then use their own IDs, add .firebaserc into .gitignore.
In the directory where you run firebase list, there will be a file called firebase.json. If you open that in a text editor, you will see the app name in there. You can change it there or delete firebase.json to change the app.
Or save yourself the hassle of editing a text file and do as Jason says: use firebase init.
you can just use a command line switch
--project=my-firebase-project
I may be wrong but it seems that the original question was about changing apps within a given project, rather than simply changing projects.
This answer is about changing apps and site_IDs within a project.
In my case I have a project (CoolProject) with 2 web apps:
an assessment form: form
a main website: website
Both apps are in separate repos both locally and in GitHub.
Each app has its own specific site_ID:
form: coolproject-form[.web.app]
website: coolproject-website[.web.app]
I first setup the form app and deployed without any issue to coolproject-form. But when I created the web app (and associated coolproject-website site_ID) and tried to deploy it using firebase deploy --only hosting or firebase deploy --only hosting:website it incorrectly deployed it to coolproject-form overwriting the form app.
This is how I eventually solved the issue (based on this Firebase documentation):
Check that both apps and corresponding site_IDs are correctly setup:
firebase apps:list
firebase hosting:sites:list
Setup up the website deploy target for hosting (via .firebaserc)
firebase target:apply hosting website coolproject-website
Update firebase.json (for the website app):
...
"hosting": [{
"target": "website",
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}],
...
Deploy
firebase deploy --only hosting
With this the website app is now correctly deployed to coolproject-website.web.app.
Addition #cutiko's answer
In package.json
"scripts": {
...
"prod": "echo \"Switch to Production environment\" && firebase use prod && npm run runtimeconfig",
"dev": "echo \"Switch to Development environment\" && firebase use default && npm run runtimeconfig"
...
npm run runtimeconfig to get custom config environment
In .firebaserc
{
"projects": {
"default":"{project-dev-id}",
"prod": "{project-prod-id}"
}
}
to change firebase app destination project you can type "firebase use myProjectName" . i also used the above answeres "firebase list" to check what project i have
( work for me in firebase cli 7.4 with angular 7 app)
The project.json file can contain a prepublish entry to execute some scripts before publishing of a package. There are several variables available in those scripts, according to their wiki, for example %project:Directory%
"scripts": {
"prepublish": [ "dir %project:Directory%" ]
}
Is there any way to access the input and output directory used for publishing? I see in visual studio the actual paths:
Publishing files to E:\Projects\WebPlatform\artifacts\bin\DemoLauncher\Release\PublishOutput
Executing command ["C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:contentPath='C:\Users\xxxxx\AppData\Local\Temp\PublishTemp\DemoLauncher70\' -dest:contentPath='E:\Projects\WebPlatform\artifacts\bin\DemoLauncher\Release\PublishOutput'
However i cannot seem to get the values in "prepublish" script. I would like something like:
"scripts": {
"prepublish": [ "dir %outputDirectory%" ]
}
It turn's out that dnx/dnu publish command doesn't support this, however the commands will be replaced with dotnet publish which will provide publish:OutputPath variable.
The ticket for is available here and relevant code here