How deploy your application just on successful stage(s) on GitLab CI

I’m not very proficient with GitLab CI/CD/Pipelines, and I have been trying to automate deployment only when a specific stage is successful, in my case, the test stage. I attempted to use global variables, but it seems that they cannot be reassigned within one job and used in another job. After researching on GitLab Docs [1] and Stack Overflow [2], I found a solution that works for me.

Below is the structure of my .gitlab-ci.yml file:

  - build
  - test
  - deploy

  stage: build
    - mvn -DskipTests package

  stage: test
    - echo "Executing the tests..."
    - mvn test
    - echo $CI_JOB_STATUS >> ./results.txt
      - results.txt

  stage: deploy
    - echo "Checking if tests are successful..."
    - cat results.txt | if [[ "$(cat)" == *"success"* ]]; then
      echo "Okay! now I should do the deploy";
      echo "Ops, there are test failing";
    - test

We’re using artifacts and dependencies to pass information from the earlier stage (test) to the deploy stage.

You can check the results.txt file for the status of ‘success,’ ‘failed,’ or ‘canceled.’ Additionally, you can include other predefined variables [3] and informations.

If you’re using Windows, remember to save the .gitlab-ci.yml file with LF (line separator \n) to avoid any problems when running the script.

If you are aware of a better approach for accomplishing this task, please feel free to share it with me.



Privacy Invasion Alert: How Much is WhatsApp Overstepping Boundaries?

Recently, Foad Dabiri (an engineer at Twitter) claimed that WhatsApp constantly uses your smartphone’s microphone even while he was asleep. This behavior is both peculiar and intrusive. However, upon checking the microphone usage history on my Samsung smartphone, it appears that WhatsApp is not excessively monitoring me, but this doesn’t mean so much.

Did you already checked your microphone/cam/location history today? In the future, I’m going to try using apps that prioritize privacy in communications.

The “Cannot find symbol” error when using MapStruct with Lombok

If you are having the problem “Cannot find symbol” with your Java project compilation because the compiler doesn’t recognize the methods calls of getters, setters, constructors, etc., but your IDE is still recognizing the methods normally, you probably forgot to configure your pom.xml or build.gradle for multiple annotation processors with the MapStruct library.

WARNING: If you’re using Intellij IDE check if the option “Enable annotation processing” is checked.

If your problem is more general, you can try the solutions provided in the Baeldung post.

Continue reading “The “Cannot find symbol” error when using MapStruct with Lombok”

Solving router-outlet is not a known element and others problem in Angular with VS Code

Hello folks, everyone fine? recently I migrated from a job that I was working mostly with PHP/Wordpress to one with a stack focused in Java/Angular.

I faced some problems was a beginner in this new environment, one that I wasted some time trying to solve is some errors when working with Angular versions less than 9.

'router-outlet' is not a known element:<br>1. If 'router-outlet' is an Angular component, then verify that it is part of this module.<br>2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.ngtsc(-998001)<br>
Angular extension might not work correctly because ngcc operation failed. Try to invoke ngcc manually by running 'npm/yarn run ngcc'. Please see the extension output for more information.
Appears in the NgModule.imports of XXXModule, but itself has errors

If you have this errors just in VS Code but the ng serve and ng build works well, your problem can be caused by using a compilation/rendering engine called Ivy from Angular 9 in VS Code. You can use the legacy View Engine going in Extensions (Ctrl + Shift + X) > Manage > Extension settings or Ctrl + , and type: Using the legacy view engine is very helpful when you’re maintaining old projects that you can’t upgrade the Angular version.

Configuration on VS Code

Correcting the positioning of Mega Menu in Oxygen Builder

When using the component Mega Menu from the Composite Elements in a sticky header or when logged on WordPress the component Mega Menu compute the top offset of the menu (.oxel_megamenu__wrapper) in a wrong way.

Logged in WordPress the navbar is computed making the element stay with a top offset plus the height of the WordPress navbar.

Top margin of menu when logged

You just need change the Mega Menu Code from this:

var bottom = jQuery(this).offset().top + jQuery(this).outerHeight(true);

To this:

var bottom = jQuery(this).position().top + jQuery(this).outerHeight(true);

This way the browser will compute the top offset from the Mega Menu Links div and not from document.

Tips and solutions to use Selenium in IE automation

Selenium is a powerful open source project that ensembles a wide range of tools to let the user make automation of tasks and regression tests. Using Selenium to control Internet Explorer (IE) can be very tricky, since the driver of IE is not officially provided by Microsoft.

This post intends to show tips, some errors and solutions that I struggle to solve when using a Selenium Server Standalone to drive IE, if you have some error to suggest I will enjoy see a comment.

Continue reading “Tips and solutions to use Selenium in IE automation”

How to fix permissions on globally installing npm packages on linux

Is common have packages that works globally, they make the work more easy in some ways, provide functionalities, et al..

The difference in npm packages that are installed globally and locally is that you will setup a package like a program avaliable by a CLI(Command Line Interface)¹, this require permissions to write in some directories that the npm normally don’t has.

When you try install some globally package(using the -g):

npm install -g <package>

You can face errors and warnings like this:

npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/lib/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:

Continue reading “How to fix permissions on globally installing npm packages on linux”