How to change creation time of objects during run time if the repository is shared repository? - hp-uft

I am trying launch browser using UFT without closing existing instances of browsers. I know that we can use SetTOProperty method to change creation time during runtime.but this is not working for shared repositories as they are associated to the action in read-only mode. If there is no solution for this, is there any way to copy the objects in the shared repository into local repository?
Thanks.

Related

How can I make one single `.gradle` cache for multiple projects?

We are trying to use one single .gradle cache among our multiple build workers (in jenkins) by creating .gradle in NFS mount which is shared with all the workers.
Now when we run multiple projects using gradle builds, they get failed with following errors:
Timeout waiting to lock artifact cache (/common/user/.gradle/caches/modules-2). It is currently in use by another Gradle instance.
Owner PID: 1XXXX
Our PID: 1XXXX
Owner Operation: resolve configuration ':classpath’
Our operation: resolve configuration ':classpath’
Lock file: /common/user/.gradle/caches/modules-2/modules-2.lock
What is the suggestive method to use .gradle cache sharing among multiple users. This model works fine for maven .m2 cache.
We cannot have .gradle for each workers as it occupies lot of space to store the jars in cache.
Because of the locking mechanism Gradle uses for its dependency cache, you can't have multiple instances write to the same cache directory.
However, you can create a shared, read-only dependency cache that can be used by multiple Gradle instances. You can find instructions in the docs. The basic mechanism is to create a folder that's pre-populated with the dependencies you think your builds will need, then set the GRADLE_RO_DEP_CACHE environment variable to point to that folder.
This cache, unlike the classical dependency cache, is accessed without locking, making it possible for multiple builds to read from the cache concurrently.
Because this cache is read-only, you would need to add dependencies to it beforehand. The builds themselves can't write their dependencies back to the read-only shared cache. The cache needs to follow the folder structure that Gradle expects, though, which isn't something that can really be set up by hand. In practice the way to get a working shared cache is to copy the dependency cache that was created by an existing Gradle instance.
The read-only cache should be sourced from a Gradle dependency cache that already contains some of the required dependencies. [...] In a CI environment, it’s a good idea to have one build which "seeds" a Gradle dependency cache, which is then copied to a different directory. This directory can then be used as the read-only cache for other builds.
The shared cache doesn't need to contain all of the dependencies, though. Any that are missing will be fetched by each individual build as normal, as if the shared cache wasn't there.
https://docs.gradle.org/current/userguide/dependency_resolution.html#sub:shared-readonly-cache
Using "ascii" graphics in the gradle manual isn't very instructive, but there they say:
run a regular gradle build.
now go into, on windows, %USERPROFILE%.gradle\caches, where you find a folder named 'modules-2'
grab the modules-2 folder, as is, move it into a directory accessible to all your builds, so that you have <mygradle_ro_cache>\modules-2...
delete any .lock or gc.* files from <mygradle_ro_cache>\modules-2\
set the env variable GRADLE_RO_DEP_CACHE to <mygradle_ro_cache>
Done.

How to prevent GitLab CI/CD from deleting the whole build

I'm currently having a frustrating issue.
I have a setup of GitLab CI on a VPS server, which is working completely fine, I have my pipelines running without a problem.
The issue comes after having to redo a pipeline. Each time GitLab deletes the whole folder, where the build is and builds it again to deploy it. My problem is that I have a "uploads" folder, that stores all user content, that was uploaded, and each time I redo a pipeline everything gets deleted from this folder and I obviously need this content, because it's the purpose of the app.
I have tried GitLab CI cache - no luck. I have also tried making a new folder, that isn't in the repository, it deletes it too.
Running my first job looks like so:
Job
As you can see there are a lot of lines, that says "Removing ..."
In order to persist a folder with local files while integrating CI pipelines, the best approach is to use Docker data persistency, as you'll be able to delete everything from the last build while keeping local files inside your application between your builds, while maintains the ability to start from stretch every time you start a new pipeline.
Bind-mount volumes
Volumes managed by Docker
GitLab's CI/CD Documentation provides a short briefing on how to persist storage between jobs when using Docker to build your applications.
I'd also like to point out that if you're using Gitlab Runner through SSH, they explicitly state they do not support caching between builds when using this functionality. Even when using the standard Shell executor, they highly discourage saving data to the Builds folder. so it can be argued that the best practice approach is to use a bind-mount volume to your host and isolate the application from the user uploaded data.

Is it possible to use a Nexus Repository to store a Gradle Remote Build Cache?

I have access to a private Nexus Repository and would like to speed up my CI builds and thought that I could use the private repository to store and access my build cache. Is this a possibility or a dead end?
It works like a breeze.
Just create a "Raw" repository and give a user write permission for it.
This user then is used to fill the cache and you can use another user or anonymous access to read from the cache.
I just tried it minutes ago.
Any web server that supports PUT for storing files and GET for retrieving the same files should be fine with the default HttpBuildCache implementation.
You can even provide an own client-side implementation to use any remote service you want as build cache.
No.
Gradle's remote build cache is one of the selling points of Gradle Enterprise. So it's not something you can just "plugin" to another piece of software like Nexus.
There is however a Docker image that is designed to work with Gradle Enterprise. Maybe you could make use of that somehow.
But again, the remote build cache is a selling point of Gradle enterprise and as a result is designed to work with Gradle enterprise.
https://gradle.com/build-cache/

Can I keep Maven local repository on another machine and use it in my project?

Where are Maven and pom.xml file kept in a real-time project if the code is at GitHub. I mean can I keep my local repository somewhere in another machine and use it in my project. If yes, how?
Local repositories are not meant for sharing. They are also not "thread-safe" in any way, so accessing them simultaneously from two different builds might break things.
They are populated by the artifacts Maven downloads from MavenCentral and other repositories, and also the stuff you build yourself. As they are more or less a form of cache, there is no need to share them.
If you need a repository that is used from different machines or by different users, set up a Nexus/Artifactory server.

Howto handle infinispan cache creating and deployment

We have a infinispan cluster serving as cache server for our applications. Every time we need a new cache, we have to edit the config files, and redeploy the cluster, which is problematic. For obvious reasons, we don't want to redeploy the cache cluster.
We can add the new cache definition through web interface, or cli. But it has downside of not recording this configuration in a repo. Ideally I want to be able to add cache definitions in a way that is persistent in my code repo. So that in case of a disaster, I can simply redeploy the cache cluster.
We looked into creating cache definition through the source code, at application startup, but that doesn't seems to be possible.
Does anyone has an idea about the best practises for this issue?
After some R&D, this is what we found:
Programatic creation of the caches, are possible through jcache implementation in Infinispan, but we could not find a way to properly configure it. End result is just an empty cache definition, with no properties
What we ended up doing is to create caches using jboss cli. Use an script to create the cache definitions, and commit that script to version control system. This way you can recreate your cache server anytime by rerunning that script. The downside of this approach is that you are going to need to install jboss-cli on your deploying machine - CI probably- which is very inconvenient. We just decided to do this step manually for time being.

Resources