CI/CD Automation Scripts for jaegertracing/jaeger-lib

Overview

The jaegertracing/jaeger-lib repository includes various automation scripts for continuous integration and continuous deployment (CI/CD). These scripts are primarily defined in the Makefile and the shell and Python scripts found in the scripts/ directory.

Makefile

The Makefile defines multiple targets that automate the build, testing, and linting processes.

Available Targets

  • Default Target:

    .DEFAULT_GOAL: test-and-lint
    
  • Install Dependencies

    .PHONY: install-dep
    install-dep:
        - curl -L -s https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64 -o $$GOPATH/bin/dep
        - chmod +x $$GOPATH/bin/dep
    

This target installs the Golang dependency manager dep.

  • Set up CI dependencies
    .PHONY: install-ci
    install-ci: install
        go get github.com/wadey/gocovmerge
        go get github.com/mattn/goveralls
        go get golang.org/x/tools/cmd/cover
        go get golang.org/x/lint/golint
    

This target focuses on setting up essential tools for CI/CD including code coverage and linting tools.

  • Run Tests and Check for Errors
    .PHONY: test-ci
    test-ci: dep-check cover lint
    

The test-ci target checks dependencies and runs tests with code coverage and linting.

  • Linting Target
    .PHONY: lint
    lint:
        $(GOVET) ./...
        @cat /dev/null > $(LINT_LOG)
        @$(foreach pkg, $(PACKAGES), $(GOLINT) $(pkg) >> $(LINT_LOG) || true;)
        @[ ! -s "$(LINT_LOG)" ] || (echo "Lint Failures" | cat - $(LINT_LOG) && false)
        @$(GOFMT) -e -s -l $(ALL_SRC) > $(FMT_LOG)
    

This target checks the code for potential issues using govet and golint, and also formats the code according to the Go formatting guidelines.

  • Coverage Reports
    .PHONY: cover
    cover:
        $(GOTEST) -cover -coverprofile cover.out ./...
    
    .PHONY: cover-html
    cover-html: cover
        go tool cover -html=cover.out -o cover.html
    

The cover target generates a coverage report, and cover-html converts this report into an HTML format for easy visualization.

Scripts

Two scripts are provided in the scripts/ directory that aid in the automation of certain tasks.

  • Update License Script (Shell)
    #!/bin/bash
    
    set -e
    

This script starts with an instruction to stop execution if any command fails.

  • Update License Script (Python)
    # Python code that updates licenses could be here
    

While specific functionality and contents of the updateLicense.py script are not outlined, it serves the purpose of updating license information, likely processing files in the repository.

Conclusion

The CI/CD process in jaegertracing/jaeger-lib is orchestrated primarily through the Makefile with additional support from scripts to manage licensing. The repository is equipped for effective testing, linting, and code coverage, promoting quality and maintainability through automation.

For individual developers seeking to contribute or enhance their build and automation workflows, it is recommended to become familiar with the Makefile targets and the scripts provided, ensuring a smooth integration and deployment process.