I have two repositories (materials) git1 and git2.
On git1 commit I need pipeline to trigger, clone git2 repo, and perform some job. How to do it?
The problem is if I add git2 as a pipeline material, it would trigger on this material too, while I need to fetch git2 only to perform the job.
You add both repositories as materials, and use the ignore filters * (all top-level files) and **/* (all files in subdirectories) in the second git repo:
<git url="https://github.com/somebody/repo2.git"
dest="some-directory">
<filter>
<ignore pattern="*" />
<ignore pattern="**/*" />
</filter>
</git>
That way, the current version of repo2 will be checked out, but pushes to repo2 don't trigger a new build.
Related
I am trying to delete an item, but I am getting an error:
The trees Content-CompanySites-MySite1-Data and Content-CompanySites-MySite1-Data-Configuration both contained the global path /sitecore/content/CompanySites/MySite1/Data/Configuration/Features/Project/ProjectOverviewPage - overlapping trees are not allowed.
Same thing happens when I tried to install package or add new item
Review your Unicorn config files.
it is not allowed to have overlapping trees, however you can use Children exclusion patterns to have a root item config, and multiple child configurations.
In other words, the same item would be in several unicorn serialization folders, which of course is also asking for problems. Below some suggestions to fix this.
Search for Content-CompanySites-MySite1-Data and add
<exclude children="true" />
Example
<include name="Content-CompanySites-MySite1-Data" database="master"
path="/Content/CompanySites/MySite1/Data">
<exclude children="true"/> <!-- include /nochildren, exclude all of /nochildren's children -->
</include>
Or remove the /sitecore/content/CompanySites/MySite1/Data/Configuration/Features/Project/ProjectOverviewPage config, or make a exception for this feature.
Example
<include name="Content-CompanySites-MySite1-Data" database="master"
path="/Content/CompanySites/MySite1/Data">
<exclude path="/sitecore/content/CompanySites/MySite1/Data/Configuration/Features/" />
</include>
See also TestConfiguration.xml to get an idea of the possibilities to solve your specific issue.
See /sitecore/admin/showconfig.aspx to get insight of your merged config and where the patches came from.
Im trying to edit a version variable when I build my applications, but I can't get any scripts to run using the cordova hooks at all.
I want to get the version from the package.json and the last 5 digits of the git commit so i can have something like 1.0.0.89gkt as my versions.
In the past for ionic 1 and using grunt or gulp I was able to add the scripts into the build process easily.
I've tried both the old way using the hooks/hook_name/script format and using the hook tag in the config.xml and neither work for me.
Overwriting the ionic scripts via the package.json allows me to change the scripts that are automatically run, but I want to avoid that if I can. Though I can easily add my text replace to one of the copy scripts or something (ill need to work out which one is best)
If someone knows a better way or a reason as to why the hooks wont fire, please let me know.
This is the solution that I ended up using.
scripts/before_prepare_increment_build_number.js
var fs = require('fs');
var git = require('git-rev-sync')
console.log('Incrementing Build Number');
var file = fs.readFileSync('www/build/main.js', 'utf8');
var str = git.short();
console.log('short', str)
var result = file.replace(/{{GITVERSIONSTRING}}/g, str);
fs.writeFileSync('www/build/main.js', result);
console.log('Incrementing Build Number Completed');
config.xml
<hook src="scripts/before_prepare_increment_build_number.js" type="before_prepare"/>
I needed to ensure that everything was happening synchronously otherwise the built in scripts would start copying before the strings had been replaced.
Currently its targeting the whole main.js that is generated by the default ionic-app-scripts so all comparisons and replacements can be added as required.
This solution uses the built in cordova hook before_prepare
Another solution that can be used to make it a bit more efficient is targeting the individual files as required and adding the script before the build/serve scripts in the package.json and have npm control and manage it.
Inside your package.json you could add a script to a prepare hook.
"scripts": {
"prepare": "node increment_build_number.js",
}
I'm trying to use a custom appender in a clojure application using logback & clojure tools.logging.
My config looks like this:
<appender name="Sentry" class="net.kencochrane.raven.logback.SentryAppender">
<dsn>some-dsn</dsn>
</appender>
This results in the following runtime error:
The following loggers will not work because they were created during the default configuration phase of the underlying logging system.....
A quick google search turns up a document to use a JoranConfigurator programatically to perform a multi-step configuration, but I actually don't see an exposed method in tools.logging to perform multi-step configuration. Any advise other than modifying tools.logging? Am I missing something obvious? Thanks for your time.
tools.logging doesn't do any configuration of the underlying logging system. In the case of logback it just talks to the logging system via slf4j. The configuration of the actual logging is totally on the logback side.
An easy way might be to use a logback.xml config file and Logback dependencies with clojure/tools.logging. Based on Sentry docs it looks like you need the following dependencies:
[org.clojure/tools.logging "0.3.1" :exclusions [org.clojure/clojure]]
[org.slf4j/slf4j-api "1.7.25"]
[org.codehaus.janino/janino "3.0.7"] ; for conditional config processing
[ch.qos.logback/logback-classic "1.2.3"]
[ch.qos.logback/logback-core "1.2.3"]
[com.getsentry.raven/raven-logback "8.0.2"]
The Sentry docs page also has snippets of Logback XML config that you can use. For MDC attributes, you may want to take a look at Cambium.
here's a simple setup using sentry-java-logback,
with deps:
[org.clojure/tools.logging "0.4.1"]
[ch.qos.logback/logback-classic "1.2.3"]
[io.sentry/sentry-logback "3.2.0"]
and logback.xml:
<!-- Sentry -->
<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<encoder>
<pattern>${defaultPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<options>
<dsn>https://........</dsn>
<release>1.0.0</release>
<serverName>ABCDE</serverName>
<environment>production</environment>
</options>
<minimumBreadcrumbLevel>DEBUG</minimumBreadcrumbLevel>
</appender>
<!-- ....THIS MIGHT CHANGE.... -->
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
<appender-ref ref="SENTRY"/>
</root>
you can read more on Sentry docs
My SQL files aren't being executed when I install or update a new component. Initially I found it weird that my workmate needed to execute his SQL files directly into PHPMyAdmin, but isn't Joomla! supposed to automatically run the files?
Here's how I set up my XML:
ReforcoDigital.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" client="site" method="upgrade">
<name>Reforco Digital</name>
<author>Rodrigo Pereira</author>
<creationDate>14/05/2013</creationDate>
<copyright>Copyright</copyright>
<license>Licença</license>
<authorEmail>rodrigo-c-pereira#hotmail.com</authorEmail>
<authorUrl>http://www.site.com</authorUrl>
<version>0.1</version>
<description>Sistema de Reforço Digital</description>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<files folder="site">
<folder>language</folder>
<folder>models</folder>
<folder>views</folder>
<filename>reforcodigital.php</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
</files>
<administration>
<menu>Reforco Digital</menu>
<files folder="admin">
<folder>sql</folder>
<folder>views</folder>
<filename>controller.php</filename>
<filename>reforcodigital.php</filename>
<filename>index.html</filename>
</files>
</administration>
</extension>
Folder admin/sql has the install.mysql.utf8.sql file, and admin/sql/updates/mysql has the file 0.1.sql; both have the very same SQL code. What am I possibly missing here?
The fact that I was updating my component with a 0.1.sql over and over was the problem. Changed the filename to 0.2.sql and it did the job.
My understanding is that Joomla! will look for the update files in alphabetical order, and judge if that version has been used or not; correct me if that's wrong. Since there was a higher version than 0.1, it did the job.
I commented earlier that I was having the same problem as you, but I'm not. Mine is a completely different problem that I'll describe after I explain what's happening with your file.
So, your sql folder resides within your admin component folder (this is normal), but your install/uninstall sql XML entries don't describe this. So, I believe that if you make this change, you'll find it working as expected:
<install>
<sql folder="admin">
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
My problem is that the update section will only execute a schema update when a schema exists in the #__schema table - and install.sql isn't executed on update. So if you're upgrading your extension and adding a table to it, you can't really rely on the XML installer to create your new table unless your extension already had tables before the update.
I'm going with an install.php file to search for and create the table if necessary.
I'm using ant, ivy and nexus repo manager to build and store my artifacts. I managed to get everything working: dependency resolution and publishing. Until I hit a problem... (of course!).
I was publishing to a 'release' repo in nexus, which is locked to 'disable redeploy' (even if you change the setting to 'allow redeploy' (really lame UI there imo). You can imagine how pissed off I was getting when my changes weren't updating through the repo before I realised that this was happening.
Anyway, I now have to switch everything to use a 'Snapshot' repo in nexus. Problem is that this messes up my publish. I've tried a variety of things, including extensive googling, and haven't got anywhere whatsoever. The error I get is a bad PUT request, error code 400.
Can someone who has got this working please give me a pointer on what I'm missing.
Many thanks,
Alastair
fyi, here's my config:
Note that I have removed any attempts at getting snapshots to work as I didn't know what was actually (potentially) useful and what was complete guff. This is therefore the working release-only setup.
Also, please note that I've added the XXX-API ivy.xml for info only. I can't even get the xxx-common to publish (and that doesn't even have dependencies).
Ant task:
<target name="publish" depends="init-publish">
<property name="project.generated.ivy.file" value="${project.artifact.dir}/ivy.xml"/>
<property name="project.pom.file" value="${project.artifact.dir}/${project.handle}.pom"/>
<echo message="Artifact dir: ${project.artifact.dir}"/>
<ivy:deliver
deliverpattern="${project.generated.ivy.file}"
organisation="${project.organisation}"
module="${project.artifact}"
status="integration"
revision="${project.revision}"
pubrevision="${project.revision}" />
<ivy:resolve />
<ivy:makepom
ivyfile="${project.generated.ivy.file}"
pomfile="${project.pom.file}"/>
<ivy:publish
resolver="${ivy.omnicache.publisher}"
module="${project.artifact}"
organisation="${project.organisation}"
revision="${project.revision}"
pubrevision="${project.revision}"
pubdate="now"
overwrite="true"
publishivy="true"
status="integration"
artifactspattern="${project.artifact.dir}/[artifact]-[revision](-[classifier]).[ext]"
/>
</target>
Couple of ivy files to give an idea of internal dependencies:
XXX-Common project:
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="com.myorg.xxx"
module="xxx_common"
status="integration"
revision="1.0">
</info>
<publications>
<artifact name="xxx_common" type="jar" ext="jar"/>
<artifact name="xxx_common" type="pom" ext="pom"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>
XXX-API project:
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="com.myorg.xxx"
module="xxx_api"
status="integration"
revision="1.0">
</info>
<publications>
<artifact name="xxx_api" type="jar" ext="jar"/>
<artifact name="xxx_api" type="pom" ext="pom"/>
</publications>
<dependencies>
<dependency org="com.myorg.xxx" name="xxx_common" rev="1.0" transitive="true" />
</dependencies>
</ivy-module>
IVY Settings.xml:
<ivysettings>
<properties file="${ivy.project.dir}/project.properties" />
<settings
defaultResolver="chain"
defaultConflictManager="all" />
<credentials host="${ivy.credentials.host}" realm="Sonatype Nexus Repository Manager" username="${ivy.credentials.username}" passwd="${ivy.credentials.passwd}" />
<caches>
<cache name="ivy.cache" basedir="${ivy.cache.dir}" />
</caches>
<resolvers>
<ibiblio name="xxx_publisher" m2compatible="true" root="${ivy.xxx.publish.url}" />
<chain name="chain">
<url name="xxx">
<ivy pattern="${ivy.xxx.repo.url}/com/myorg/xxx/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${ivy.xxx.repo.url}/com/myorg/xxx/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<ibiblio name="xxx" m2compatible="true" root="${ivy.xxx.repo.url}"/>
<ibiblio name="public" m2compatible="true" root="${ivy.master.repo.url}" />
<url name="com.springsource.repository.bundles.release">
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
w00h00t.
(There's something cathartic about asking the world for help. Usually you fix the problem much faster, even without a response).
Anyway, for the interested it came down to a couple of things:
a) the addition of -SNAPSHOT to all revisions. This involved forking a second ivy.xml -> ivy.SNAPSHOT.xml and referencing that explicitly in the ivy ant tasks.
b) given that this is a manual addition I had to go through my entire tree of build files and provide parallel paths for release and snapshot flows. This, in my opinion, is lame. But, as I guess we're extremely unlikely to invent any other type of flow, this probably won't bloat, and 2 parallel flows is where it will stay.
c) I specified various hints to ivy to check for updates to the snapshots. e.g. checkUpdated="true" and changePattern=".*-SNAPSHOT" on the resolver. And the addition of
<modules org="myorg" name=*" resolveMode="dynamic" />
Still, it'd be nice if there had been automatic integration with snapshot stuff. A bit of (optional) cleverness on the part of ivy. Let's face it, maven repos like nexus ARE really useful and I'm certainly using ivy only to get round maven's crappy build process. I like using nexus.
Anyway. If anyone ever wants to question further on this, feel free.
I'm not sure if this would help with the problem of having 2 sets of configurations, but at least the build.xml would be a little bit simpler.
You can define the revision attribute on the info element in ivy.xml as ${project.revision}.
You can then omit the revision="${project.revision}" attributes on ivy elements in build.xml.
See my answer on this another question for example:
https://stackoverflow.com/a/8853823/1148030
It should be noted, the only necessary step is to include the '-SNAPSHOT' to revision when publishing to Nexus. The other steps listed in the answer are optional/improvements. To pull the published item down, you need to add '-SNAPSHOT' to the revision as well.