How to conditional overwrite default tag in Gitlab CI Pipeline - gitlab

Hi I try to realize the following:
I want to have a default tag for all jobs
Addtionally I want to remove the default tag and add a different one in case a CI Variable is set before running the Job.
The tag shall be used to select a specific runner instead of the default set of runners
How can this be realized?

Related

How to pass PowerShell variable values dynamically via azure pipeline variables

I want to pass the PowerShell variable values via azure pipeline variables. Below script is to remove old images from azure container registry. I don't want to pass the values directly as I mentioned in code, those values I need to pass via pipeline variables.
I have tried something like this as shown in image highlighted in yellow color. I'm getting error.
Azure pipeline task like AZ CLI as shown in below
I'm Getting error like as shown in below
Anyone can help me out this. Thanks in advance....
You must define the variables outside of your scriptblock, below it is a section called Environment Variables, you can store them there like so:
Then you can call them up in the scriptblock as environment variable: $env:LocalDbDataSource
Also, did you mean to put the $ signs in the Pipeline variables table?
As far as I'm aware they are not needed, you should just put the name of your variable.
Another good tip would be to put your variables in a variable group, that way you can centralize where you store the variables. You can add them in the Library section of the pipelines tab
Earlier I have passed same variable name in both cases like PowerShell variable name and Pipeline variables, post changing the name in azure pipeline variables it's working as excepted.

The proper way to define variables in GitLab CI/CD settings to disable jobs in a pipeline

I am trying to define environment variables for a project in GitLab to customise the Auto Dev Ops pipeline to disable the code quality jobs in all environments. When I try to define the variable, it asks me for a key and a value (As shown below). . Based on the table of disabled jobs variables (https://docs.gitlab.com/ee/topics/autodevops/customize.html#disable-jobs) I chose CODE_QUALITY_DISABLED and set the value to true but when I try to commit a new change to test the pipeline it still runs the quality check. I wonder What am I doing wrong here.
Without more information on what your CI file looks like (or if you have one at all), then it may be difficult to answer, but there are a few possibilities.
If you have a CI file and you've set the variable to be false, that will override what's in the project settings.
You're using a version older than 11.0 (unlikely but possible).
You're committing changes to an unprotected branch.
For the last one, if you want the code quality to be disabled for all pipelines, then you want to make sure the "Protect variable" option is unchecked (whereas your screenshot shows it as checked), because a protected variable will only apply to protected branches and tags.

Having to separate YAML files for pipelines

I have 2 pipelines currently one is linked to my dev branch and one is linked to my master branch. But both the YAML files have the same name but have different scripts within it so the problem is when I merge my dev into my production branch it changes the yaml file inside the master brance. Is there a workaround this?
You could rename the YAML file. It's able create as many build configurations using different yaml files. Just set corresponding trigger for each branch.
Multiple YAML build pipelines in Azure DevOps
If you want to use a single YAML file to cover this. Just as Daniel point out:
Use a template parameter as part of a condition
Templates let you define reusable content, logic, and parameters. Templates function in two ways. You can insert reusable content with a template or you can use a template to control what is allowed in a pipeline.
Parameter expansion happens before conditions are considered, so you can embed parameters inside conditions. The script in this YAML file will run because parameters.doThing is true.
parameters:
doThing: false
steps:
- script: echo I did a thing
condition: and(succeeded(), eq('${{ parameters.doThing }}', true))
More details please take a look at our official doc here:
Template types & usage
Specify conditions

Is it possible to set/change mlflow run name after run initial creation?

I could not find a way yet of setting the runs name after the first start_run for that run (we can pass a name there).
I Know we can use tags but that is not the same thing. I would like to add a run relevant name, but very often we know the name only after run evaluation or while we're running the run interactively in notebook for example.
It is possible to edit run names from the MLflow UI. First, click into the run whose name you'd like to edit.
Then, edit the run name by clicking the dropdown next the run name (i.e. the downward-pointing caret in this image):
There's currently no stable public API for setting run names - however, you can programmatically set/edit run names by setting the tag with key mlflow.runName, which is what the UI (currently) does under the hood.
If you are using the latest version of mlflow as of now (1.26.0), the rename functionality UI has changed a bit to look like the below image where you can change the run name by using the 3 dots in the extreme right side.
use the system tag directly:
mlflow.set_tag("mlflow.runName", "run_name")
https://github.com/mlflow/mlflow/issues/2804#issuecomment-640056129

Is there a way to reference the last build label of a project in CruiseControl.NET?

Is there a way to reference the last build label of a particular project in CC.NET? I have a project set to execute a task that needs to run only when Force Build is clicked, but the path of the working directory changes based on the build number of our main trunk.
Currently I have a workaround where we set an environment variable to the value of %ccnetlabel%, but this seems like a dirty way to do it, and I am curious to know if there is a way to refernce the build label of a project directly.
We are running CC.NET 1.4.4.49.
I found out that with 1.4.4.49 there is not a way to reference another project's build label. I got around this by adding the following XML to the project configuration:
<labeller type="stateFileLabeller">
<project>Other-Project-To-Take-Build-Number-From</project>
</labeller>
What had happened was that once I figured out that %ccNetLabel% was actually the correct way to go about this, I tried just using it in this new project (we use %ccNetLabel% elsewhere which works fine). However, without specifying the labeller tag, %ccNetLabel% causes CC.NET to throw an exception saying that '%' was not expected.

Resources