Il momento migliore è adesso!

“Non ho tempo” “Comincio la settimana prossima” “Ho altre cose più urgenti da fare” Tutti abbiamo detto a noi stessi qualcosa di simile quando si tratta di fare qualcosa di nuovo, diverso o fuori dalla propria zona di comfort. Però il momento migliore per agire è ADESSO e in questo video dico la mia sull’argomento 😄

The joy of retrogaming

The last generations of gaming consoles are great. Super powerful, always connected, 4K-60FPS-HDR10-Blablabla. I believe, however, that the overall experience of gaming is not directly related to the power of the gaming engine or hardware.

My first memories of videogames goes back to mid 90s. Super Nintendo (SNES) was the first console I remember with some of the most innovative games: Super Mario World, Zelda: A Link to the Past, Street Figher II: The World Warriors, Mortal Kombat, Kirby…

I’ve got vivid memories of the time spent with friends racing with Super Mario Kart on a split screen, fighting versus my brother or the CPU at Street Fighter II (SNES).

So, for Christmas vacation, I resurrected a forgotten Raspberry 3. I googled “raspberry retrogaming” and I found the RetroPie project.

RetroPie allows you to turn your Raspberry Pi, ODroid C1/C2, or PC into a retro-gaming machine. It builds upon Raspbian, EmulationStation, RetroArch and many other projects to enable you to play your favourite Arcade, home-console, and classic PC games with the minimum set-up. 

https://retropie.org.uk/

When they say minimal setup, it’s true. This is mine:

  • Raspberry Pi 3.
  • SD Card.
  • SD Card reader/writer
  • A dusted TV screen + HDMI cable
  • An old keyboard
  • An forgetten mouse found in a drawer
  • An XBox One X controller and a mini-USB cable

When the setup was complete (about 30 minutes to 1 hour) I showed Super Mario World to my two kids (4 and 6 years old). The moment the soundtrack started playing I was teleported back to when I was 6 years old. I told the story of Mario, Princess Peach and Bowser to them and started exploring the world. They didn’t care about the low quality of the graphics and the flat music, we laughed together when I fell from the screen, and we celebrated when we defeated the Koopas inside the castles. I hope they will remember these moment together as I do.

Azure Pipelines YAML hidden UI for parameters as input

The Azure Pipelines is the feature of Azure DevOps that allows you to automate your build and release processes, to unleash the full potential of CI/CD practices.

Pipelines can be simple or complicated but, it’s very likely that you need to specify some kind of input to a Pipeline just before starting it.

Classic Pipelines

This is where variables come to help when you’re using the classic version of Azure Pipelines. Inside the Variable tab you write variables and then you can set if it’s “settable at queue time”. This way, when you start the pipeline, a slice of UI will provide a prompt to complete. The input is treated as a string and you can’t do much more.

Option to set a variable at queue time.

YAML Pipelines – This is where magic happens!

If you’re trying to achieve the same thing with YAML pipelines you can rely on the power of parameters. Actually, you can achieve more with YAML pipelines!

Runtime parameters let you have more control over what values can be passed to a pipeline. With runtime parameters you can:
– Supply different values to scripts and tasks at runtime
– Control parameter types, ranges allowed, and defaults
– Dynamically select jobs and stages with template expressions

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters

Because parameters are explicitly typed you can create a better user experience for users of your pipelines with a fully featured UI with check-boxes, radio-buttons and text areas. You can do this in 3 easy steps. Open your YAML definition and for each one of the inputs that you need:

  1. Create a parameter
  2. Specify a default value
  3. Specify allowed values

This an example of a YAML Pipeline definition that accepts a string as an input to complete the famous “Hello World” greeting but, within a set of specific allowed values. Also, the default value is set to world.

parameters:
  - name: myString
    displayName: string
    type: string
    default: 'world'
    values:
    - world
    - mondo

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, ${{ parameters.myString }}!
  displayName: 'Run a one-line script'

When you Run the pipeline the UI shows specific fields to collect your input (greetings in our example).

The Run Pipeline dialog with additional parameters.

I suggest you to try with all the parameters type that the YAML schema provides. This is a complete example showing all the available options:

parameters:
  - name: myParameter
    displayName: greetings
    type: string
    default: 'world'
    values:
    - world
    - mondo
  - name: myNumber
    displayName: 'Number'
    type: number
    default: '1'
    values:
    - 1
    - 2
    - 3
  - name: myBoolean
    type: boolean
    default: true
  - name: myObject
    type: object
    default:
      foo: FOO
      bar: BAR
      things:
      - one
      - two
      - three
      nested:
        one: apple
        two: pear
        count: 3
  - name: myStep
    type: step
    default:
      script: echo my step
  - name: mySteplist
    type: stepList
    default:
      - script: echo step one
      - script: echo step two

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, ${{ parameters.myParameter }}!
  displayName: 'Run a one-line script'


The resulting UI is:

Isn’t this awesome?

The power of the community

Thanks to my friend Giulio Vian of getlatestversion.it for the heads-up about this feature. The official Microsoft doc lacks a detailed explanation of this specific usage of YAML Pipelines parameters!

My developer/it pro toolkit for Windows (2021)

Every IT professional / programmer / developer has a toolkit to do be more productive. It’s the based on years of experience, tips from colleagues, friends, and experts.
This is my list of tools that I use more often. I don’t use every tool every day.

This is my first list and it will be interesting to see how this will evolve year over year.

Misc

Windows Terminal / If you are a terminal user this is for you. It’s a modern implementation of a terminal for Windows. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts.
Chocolatey / The Package Manager for Windows. Forget browsing to the website of your favorite tool, click download, open the setup, next-next-next-finish. Just write choco install mytool -y and you’re done!
Windows Subsystem for Linux / A complete GNU/Linux environment inside Windows. I use this to learn or explore Linux commands. It’s fast and without the overhead of a traditional virtual machine.
Notepad2 / A replacement for the standard notepad.exe. Syntax highlight support, super light and fast!
Visual Studio Code / Free. Built on open source. Runs everywhere. Free. Built on open source. Runs everywhere. A swiss-army knife for any code related activity.
Nightingale / A native Windows application REST client. An alternative to Postman. A lovely UI and smooth user experience.
PowerToys / A collection of tools to improve your Windows experience.
ZoomIt / It’s perfect to zoom on the screen and draw arrows, lines, and rectangles while doing screen sharing sessions.
Fork / a great UI for git.
Total Commander / A replacement of Windows File Explorer. Good old, feature rich and you can use it with just keyboard shortcuts. Blazing fast to rename, move or copy batch of files.
Markdown Monster / An IDE for your markdown files!
Fiddler / THE web debugger.
BeyondCompare / Compare directories, files, exe… If you have to compare something this is the tool you’re looking for.
SnagIt / screen capture on steroids
Procmon / Do you want to know every single detail of what happens in your registry, file system, and processes/thread activities? This is the tool that you’ll open to diagnose issues or behaviors happening on Windows.

Visual Studio Code Extensions

GitLens / Git superpowers in your VS Code.
Docker for VS Code / You can get IntelliSense when editing your Dockerfile and docker-compose.yml files, with completions and syntax help for common commands.
PowerShell / Bye bye PowerShell ISE.
RESTClient / Send HTTP request directly and view the response directly from VS Code. It can also generate code snippets to make HTTP call in the most common languages.

Kubernetes ConfigMap per la configurazione delle app

La configurazione delle applicazioni è, di norma, gestita con dei file di configurazione che i programmi leggono in fase di boot o runtime.

Come si gestisce questo tipico scenario in ambito Kubernetes? In questo video spiego brevemente cosa sono le ConfigMap e come utilizzarle con un piccolo esempio.

In questo esempio la ConfigMap con nome myconfigini è creata a partire da un file di testo con lo switch –from-file.

kubectl create configmap myconfigini --from-file=.\tmweb\config\MyIniConfig.ini

Qui di seguito riporto il manifest YAML con il deployment con ConfigMap mostrato nel video. La configMap viene usata facendo il mount di un volume. Tale volume viene definito nella sezione spec del template e referenziato nella sezione container colla sintassi volumeMount.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: tm-tmweb
  labels:
    app: tmweb
    chart: tmweb-0.1.0
    draft: draft-app
    release: tm-tmweb
    heritage: Helm
spec:
  revisionHistoryLimit: 0
  replicas: 1
  selector:
    matchLabels:
      app: tmweb
      release: tm-tmweb
  template:
    metadata:
      labels:
        app: tmweb
        draft: draft-app
        release: tm-tmweb
      annotations:
        buildID: ""
    spec:
      volumes:
      - name: config-volume
        configMap:
          name: myconfigini
      containers:
        - name: tmweb
          image: "tmweb:mini"
          imagePullPolicy: IfNotPresent
          volumeMounts:
          - name: config-volume
            mountPath: /app/config
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          resources:
            {}

IIS XML Transformation with Azure DevOps

I was preparing a demo about IIS XML Transformation inside a CD pipeline with Azure DevOps.

It’s very likely that if you’re working with an ASP.Net project with default values the Azure App Service Deploy Task will fail. After some googling I found that this is documented here.

The trick is to remove the <DependendUpon> tag inside the csproj file.

By default, MSBuild applies the transformation as it generates the web package if the <DependentUpon> element is already present in the transform file in the *.csproj file. In such cases, the Azure App Service Deploy task will fail because there is no further transformation applied on the Web.config file. Therefore, it is recommended that the <DependentUpon> element is removed from all the transform files to disable any build-time configuration when using XML transformation.

File transforms and variable substitution reference, XML transformation notes, Microsoft Docs

My first streaming experience with YouTube

Yesterday I went live for the first time on YouTube. I improvised, literally, a session about the basics of Azure Kubernetes Service with the target objective to deploy an empty application starting from scratch.

The experiment was very intense because I had a couple of issues, but it delivered a not so bad result. Thank for my friends Giulio and Giuliano of getlatestversion.it for the feedback and for listening to me for almost an hour!

For this first stream I talked in Italian, but in the future when I’ll be more confortable I’ll swith to English to reach a broader audience.

This is the link of the video.

Ogni viaggio inizia col primo passo

%d blogger hanno fatto clic su Mi Piace per questo: