Concourse rename job and retain history

To rename a Concourse job and retain history, you can use the old_name attribute.

jobs:
  - name: build-8-jdk-centos
    old_name: 8-jdk-centos

Once you’ve fly’d the pipeline with the new old_name attribute you can remove it and fly it again.

A good reason to rename a job would be because of the recent concourse deprecations with valid identifiers. Our existing job started with a number, which stop being allowed in a future Concourse version.

DEPRECATION WARNING:

jobs.8-jdk-centos: '8-jdk-centos' is not a valid identifier: must start with a lowercase letter

read more

Using Kubernetes Secrets with Spring Boot

First, create a secret, for this example we’ll be storing a username and password

kubectl create secret generic mssqldbcreds --from-literal=spring.db.username=mrbusche --from-literal=spring.db.password=hunter2

Second, add a reference to deployment.yml for each key

spec:
  template:
    spec:
      containers:
        - env:
            - name: USERNAME
              valueFrom:
                secretKeyRef:
                  name: mssqldbcreds
                  key: spring.db.username
            - name: PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mssqldbcreds
                  key: spring.db.password

Finally, reference the value in your application.yml

spring:
  db:
    username: ${USERNAME}
    password: ${PASSWORD}

read more

Testing Node AWS Lambda handler function locally

Add a script to your package.json file

"scripts": {
    "local": "node -e \"console.log(require('./index').handler({}));\""
}

where index is the name of your js file with the code you want to execute

You can execute this script by running

npm run local

read more

Moving repositories from Azure DevOps to Github

To do this you’ll need an Azure Devops Personal Access Token and a Github Personal Access Token

Thanks to CoderDave for the great starting point.

Here’s a shell script you can use that’ll copy a repository, including tags, branches and full commit history.

It’s important to note that the local copy of the repository will be left in an unusable state. That’s why the shell script checks out a fresh copy of the repository and deletes it.

azurepat=''
ghpat=''

# start in the correct directory
cd c:/AppDev/code/azuretogithub/
# checkout your azure repository, --mirror is important
git clone --mirror https://${azurepat}@dev.azure.com/test-app
# change directory to repository just cloned
cd test-app.git/
# add new origin
git remote add GHorigin "https://${ghpat}@github.com/mrbusche/test-app.git"
# push the new origin
git push --mirror GHorigin
# delete the old origin
git remote rm origin
# rename new origin
git remote rename GHorigin origin
# delete git repo from local file system
rm -rf ../test-app.git

read more