I need to get the agent properties that change the activity, is there a way to get the agent properties?
async init(flex, manager) {
flex.Actions.addListener("afterSetActivity", (payload) => {
// Would like to access agent properties here
}
}
The only agent that can set the activity is the logged in agent which you can get using manager.workerClient.
Related
The documentation from the plugin site seems to be wrong: https://github.com/jenkinsci/gitlab-plugin
Example from job dsl documentation: https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.triggers.TriggerContext.gitlabPush
In GitLabPushTrigger you can set secretToken but how can I set it via job dsl?
My current Job:
job('seed-job-v2') {
description('Job that makes sure a service has a build pipeline available')
triggers {
gitlabPush {}
}
...
}
Use the dynamic DSL:
job('example') {
triggers {
gitlab {
secretToken('foo')
}
}
}
The dynamic DSL supports almost all config options.
Alternative would be this
job('Test') {
triggers {
gitlabPush {
}
}
configure {
it / triggers / 'com.dabsquared.gitlabjenkins.GitLabPushTrigger' << secretToken('SECRET')
}
}
There is direct support for this in pipelineTriggers which you can only view in the live API viewer in you jenkins server.
Refer
https://stackoverflow.com/a/66111017/1606098
I have created a credential in Jenkins called AZURE_CLIENT_ID. I have the "Credentials Binding Plugin" installed.
If I create a Job manually in the UI I am able to select the Binding I would like for the Environment and select my Secret Text type.
I want to replicate this in my Jobs DSL script. I have found the following snippet which is very close to what I want to do:
job('example-2') {
wrappers {
credentialsBinding {
usernamePassword('PASSWORD', 'jarsign-keystore')
}
}
}
However the credential I want to inject is Secret Text and I cannot find what the function to it with is, e.g. instead of usernamePassword. Does anyone know what this should be please?
'Secret text' kind credentials are retrieved as 'string()' in the credentialBinding context.
For example:
job('example') {
wrappers {
credentialsBinding {
string('SECRETWORD', 'name_of_credential')
}
}
}
Documentation at: https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.wrapper.WrapperContext.credentialsBinding
I want to know how can i use Job Dsl to configure trigger "Trigger build remotely" a pipeline job.
I need input string as Authentication Token.
My sample code:
pipelineJob("PipelineJobs") {
logRotator {
daysToKeep(7)
numToKeep(10)
}
concurrentBuild(false)
parameters {
stringParam('PHID',null,null)
stringParam('SHA1',null,null)
}
triggers {
}
}
Thanks.
Internally that option is not a trigger, so you can't find it within the triggers context.
You need to use authenticationToken on the job level, see the API Viewer
pipelineJob('example') {
authenticationToken('secret')
}
I have one resque job which is run at some event which finally publishes the message to RabbitMQ's exchange, how can I check in bunny(Rabbit MQ ruby client) that whether the message has been successfully published?
Using Acknowledgment or any way?
Thanks in advance!
When you execute the publish you are not sure that the message is published on the queue.
If you want to be sure you have to use you have to use publish confirm or tx transaction.
Read this post http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/
Note: By default the clients don't have any HA policy, you have to implement it. See the section Streaming Lightweight Publisher Confirms:
private volatile SortedSet<Long> unconfirmedSet =
Collections.synchronizedSortedSet(new TreeSet());
...
ch.setConfirmListener(new ConfirmListener() {
public void handleAck(long seqNo, boolean multiple) {
if (multiple) {
unconfirmedSet.headSet(seqNo+1).clear();
} else {
unconfirmedSet.remove(seqNo);
}
}
public void handleNack(long seqNo, boolean multiple) {
// handle the lost messages somehow
}
});
Note2: the message is never "put" inside an exchange, but always inside a queue.
Once the publish method returns, the message has published to the queue. There is no deferred action to publishing a message.
I have some code to automate the creation of build definitions in TFS.
Now I'd like to have this code invoked whenever a branch is created.
Looking at the API, I see that there is a BranchObjectCreatedEvent in Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.
So I've added some code to a console app to handle the event.
private static void MonitorBranchCreated()
{
try
{
TfsTeamProjectCollection tfs = InitialiseTfs();
var vcs = tfs.GetService<VersionControlServer>();
var projects = vcs.GetAllTeamProjects(true);
foreach (var project in projects)
{
project.VersionControlServer.BranchObjectCreated += BranchObjectCreated;
}
Console.WriteLine("Subscribed to TFS BranchObjectCreated Event - Awaiting Notification...");
Console.ReadLine();
}
catch (Exception exception)
{
DisplayError(exception);
}
}
private static void BranchObjectCreated(object sender, BranchObjectCreatedEventArgs e)
{
// Create the Build
}
The trouble is that the event never fires when I create a branch from Source Control Explorer in Visual Studio.
The MSDN documentation is limited and I can't find any other examples of usage so I'm hoping somebody might be able to tell me if this is the correct approach.
If so, why might the event not be firing? If not, is there another way I can hook into TFS so that I can handle events related to creation of branches?
When you hook up events to the client API, you only get events that were created by that client. If you were to hook up a BranchObjectCreated listener, then call VersionControlServer.CreateBranch(), then your branch object created listener would be called.
If you want to listen to events on the server (such as when somebody else creates a branch, or you create a branch from a different client), then you need to tie into the server's project alert system.
You can install the Alerts Explorer in the Team Foundation Server Power Tools that will allow you to configure fine-grained alerts on projects that will send you email or call a web method. At this point, you can create a new build that references this new branch.