Teamcity branch name as prompt variable - teamcity-8.0

i am trying to pass default git branch as prompt parameter while starting the build. I have tried using environment variable and configuration variable. but some how its not working. Actually i want to build different branches as per user input. further this will be used as octopus deploy package.
Ashish

We use TeamCity with TFS and I would imagine it would be similar with GIT. We have added a build configuration parameter:
Name: checkout.rules
Kind: Configuration parameter
Value: +:Branches/HOTFIX => .
The Value is a default value which can be overwritten. Then under Version Control Settings, add a Checkout Rule which references the parameter:
%checkout.rules%

Related

Access GH ACTIONS_STEP_DEBUG from an SSH command / environment variable

As far as I understood, the "secret" ACTIONS_STEP_DEBUG is set to true when you relaunch a workflow in "debug mode" on Github Actions for a repository.
Now I'd like to hook onto this like a switch to print additional information from python commands that are executed in my actions/steps.
Is it possible to turn ACTIONS_STEP_DEBUG into an environment variable or how could I access it from within a step (like bash or even in python)?
So found I can use the secrets, to set an env, however only for workflows, not for the action, for some reason.
env:
IS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}

Accessing Github environment variables in custom Github Action

I'm writing my own Docker Github Action and I need access to some Github environment variable, specifically to the GITHUB_WORKSPACE variable.
I assume the user has called the checkout#v2 action beforehand and in my action.yml the run section looks as follows
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ github.workspace }}
But I get the following error
Unrecognized named-value: 'github'. Located at position 1 within
expression: github.workspace
How do I make the supposedly globally available Github environment variables accessible from my action?
You do not need to do anything.
These variables are available directly in the container (in your action). They are injected by GitHub.
In the action.yaml you do not need to specify anything and you can then access them in you code.
Note: The input values are also injected, but they start with INPUT_ and are capitalized.

How to manage settings in Openshift?

profile.properties file not found in Source code in repository?
Is it possible using environment variable in openshift?
If yes, how can set -Dkeycloak.profile.feature.scripts=enabled in Openshift environment?
Environment Variables are a first class concept in Openshift. There are many ways to use them:
You can set them directly on your BuildConfig to ”bake them into” your containers. This isn't best practices as then they won't change when you move them through environments but may be necessary to configure your build or set things that won't change (e.g. set the port number node.js uses to match the official node.js image with ”PORT=8080”)
You can put such variables into either ConfigMap or Secret configuration objects to easily share them between many similar BuildConfig
You can set them directly on DeploymentConfig so that they are set for every pod that is launched by that deployment. This is a fairly common way of setting up application specific environment variables. Its not a good idea to use this for settings that are shared between multiple applications as you would have to change common variables in many places.
You can set them up in ConfigMaps and Secrets and apply them to multiple DeploymentConfigs. That way you can manage them in one place.
Its common to see devs use a .env file that is named in .gitignore so not in git. In the past I have written scripts to load that into a Secret within openshift then use envFrom to set that secret on the deployment. Then have an .env.staging and .env.live that we git secret encrypt into git.
The problem with .env files is that they tend to get messy and have unused junk after a while. So we broke the file into one Secret to be database creds, separate Secrets for each api creds, a ConfigMap for app specific settngs. A ConfigMap for shared settings.
These days we use Helmfile to load all our config from git based on git webhooks. All the config is yaml in a git repo (with secret yaml encrypted). If you merge a change to the config git repo a webhook handler decrypts the config and runs Helmfile to update the settings in openshift. I am in the process of open sourcing everything including using a chatbot to manage releases (optional) over on GitHub
I should also say that openshift automatically creates many environment variables to help you configure you apps. In each project a lot of variables are set in every pod telling you the details of all the services you have setup in that project.
Openshift also sets up internal dns entries for your services. This means that if App A uses App B you don't have to configure A with a URL for B yourself. Rather there will be a dns entry for B and you can use the env vars that openshift sets on A to work out the dns entry to and the port number to use (e.g. dns entry includes project name and that is automatically set as an env var by openshift). So our apps can find a redis service running in the same project using that technique.

How to trigger new deployment in openshift when we change openshift config maps

i have implemented following things in openshift
created Config Map In openshift for environmental configurations
reading those config maps as environmental variables in openshift.
I have a requirement like whenever i change values in the config maps new POD
needs to be created.
Please suggest me how i can achieve this?
Unfortunately there is no out of the box solution yet.
However i solved this issue by generating a hash of my config map "CONFIG_HASH".
This hash is then mounted in the container as an environment variable:
env:
- name: CONFIG_HASH
value: ${CONFIG_HASH}
Consequently, each time the config changes, a deployment is triggered (because the environment has changed).
You will however likely have to use a pipeline (Jenkins, GitlabCI,...) to do this...

How to get production configuration variables when executing in another environment

In laravel configuration variables can be accessed like this
Config::get('xxx')
By default it returns the configuration values for the current environment. How do you get configuration data for other environments?
A call to Config::get() will already get you information of your current environment, if you are in dev it will be dev, if you are in production it will be the production data.
If you need to get a configuration information about another environment you can do by:
return Config::get('environment/config.name');
Example:
return Config::get('testing/cache.driver');
If you need to get things from your production environment while being in any other one, I'm afraid you'll have to create a 'production' folder inside your config folder and put those things there:
app/config/production/database.php
Add to that particular file only what you need to read outside from your environment:
'default' => 'postgresql',
And then you'll have access to it:
return Config::get('production/database.default');
You should be able to just do Config::get('xxx');
Unless you are overriding it in your testing/local/develop environments it should always be available. If you are, just remove it from the other envs.
I cannot see why you would define a config variable in another environment but then still need the production config.