All Projects → LucianoPAlmeida → Variable Injector

LucianoPAlmeida / Variable Injector

Licence: mit
Continuous Integration Tool for Swift Projects

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Variable Injector

Agola
Agola: CI/CD Redefined
Stars: ✭ 783 (+1142.86%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Jx
Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
Stars: ✭ 4,041 (+6314.29%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Cds
Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform
Stars: ✭ 3,677 (+5736.51%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Delivery Pipeline Plugin
Jenkins plugin for pipeline visualisation, perfect for Continuous Delivery
Stars: ✭ 122 (+93.65%)
Mutual labels:  pipelines, continuous-integration, continuous-delivery
Iceci
IceCI is a continuous integration system designed for Kubernetes from the ground up.
Stars: ✭ 29 (-53.97%)
Mutual labels:  pipelines, devops, continuous-integration
Circleci Cli
Use CircleCI from the command line
Stars: ✭ 297 (+371.43%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Hygieia
CapitalOne DevOps Dashboard
Stars: ✭ 3,682 (+5744.44%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Hands On Devops
A hands-on DevOps course covering the culture, methods and repeated practices of modern software development involving Packer, Vagrant, VirtualBox, Ansible, Kubernetes, K3s, MetalLB, Traefik, Docker-Compose, Docker, Taiga, GitLab, Drone CI, SonarQube, Selenium, InSpec, Alpine 3.10, Ubuntu-bionic, CentOS 7...
Stars: ✭ 196 (+211.11%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Cyclone
Powerful workflow engine and end-to-end pipeline solutions implemented with native Kubernetes resources. https://cyclone.dev
Stars: ✭ 978 (+1452.38%)
Mutual labels:  workflow, continuous-integration, continuous-delivery
Gaia
Build powerful pipelines in any programming language.
Stars: ✭ 4,534 (+7096.83%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Rocket
Automated software delivery as fast and easy as possible 🚀
Stars: ✭ 217 (+244.44%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Piplin
📤 An open source self-hosted continuous integration and deployment system - QQ群: 656868
Stars: ✭ 1,044 (+1557.14%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Werf
The CLI tool gluing Git, Docker, Helm, and Kubernetes with any CI system to implement CI/CD and Giterminism
Stars: ✭ 2,814 (+4366.67%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Drone Cli
Command Line Tools for Drone CI
Stars: ✭ 302 (+379.37%)
Mutual labels:  pipelines, continuous-integration, continuous-delivery
Escape
Release engineering, life-cycle management and Continuous Delivery of software platforms and artefacts
Stars: ✭ 199 (+215.87%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Jenkins
Jenkins automation server
Stars: ✭ 18,225 (+28828.57%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Xrm Ci Framework
xRM CI Framework provides you with the tools automate the build and deployment of your CRM Solution. Using the framework to implement a fully automated DevOps pipeline will allow you to deploy more frequently with added consistency and quality.
Stars: ✭ 172 (+173.02%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Wflow
🐆 EXPERIMENTAL -- Runs GitHub Actions workflows locally (local) -- Don't run your YAML like a 🐪
Stars: ✭ 187 (+196.83%)
Mutual labels:  devops, workflow, continuous-integration
Devops Readme.md
What to Read to Learn More About DevOps
Stars: ✭ 398 (+531.75%)
Mutual labels:  devops, continuous-integration, continuous-delivery
Concourse
Concourse is a container-based continuous thing-doer written in Go.
Stars: ✭ 6,070 (+9534.92%)
Mutual labels:  pipelines, continuous-integration, continuous-delivery

Swift Variable Injector

license Build Status Swift Xcode SPM

Variable injector is a very simple project with the goal of inject CI pipelines environment variables values into Swift code static values before compilation and Continuous deployment to a specific environment(Development, Testing or Production) where we can define the values injected for each build and deployment e.g. an API URL that the App uses and is different for each environment. Also, it allows us to not expose our production keys and values in statically in our code.

The project uses SwiftSyntax to perform a reliable substitutions of static literal strings with the CI environment variables values.

Installation

Manually Download

We can manually download the binary from the releases and export to the path on the CI pipeline

CURRENT_DIR="$PWD"
cd /tmp
curl -OL https://github.com/LucianoPAlmeida/variable-injector/releases/download/0.3.3/x86_64-apple-macosx.zip
unzip x86_64-apple-macosx.zip
cp -f ./x86_64-apple-macosx/release/variable-injector /usr/local/bin/variable-injector

rm ./x86_64-apple-macosx.zip
rm -rf ./x86_64-apple-macosx
rm -rf ./__MACOSX/

cd "$CURRENT_DIR"

To install the lastest version just run the install-binary.sh

curl -ssl https://raw.githubusercontent.com/LucianoPAlmeida/variable-injector/master/scripts/install-binary.sh | sh

Or just clone the repo and run make install

With that installed and on our bin folder, now we can use it.

Usage

For a detailed example of using this, check out the article Continuous Integration Environment Variables in iOS projects using Swift on Medium.

Note If you having issues with Xcode11 use the version 0.3.3 of the tool.

You should have a class or struct with your envirionment variables declaration following the $(VAR_NAME) pattern. Example:

   struct CI {
      static var serviceAPIKey: String = "$(SERVICE_PROD_KEY)"
      static var otherAPIKey: String = "$(OTHER_PROD_KEY)"
   }

With the environments static declarations matching the pattern

variable-injector --file ${SRCROOT}/Envirionment/CI.swift 

If environment variables with those names, as in the example you have the SERVICE_PROD_KEY and OTHER_PROD_KEY are defined on the build machine for this pipeline the injector you replace the string literal with the envirionment variable value.

Example of the file after the substitution.

   struct CI {
      static var serviceAPIKey: String = "h344hjk2h4j3h24jk32h43j2k4h32jk4hkj324h"
      static var otherAPIKey: String = "dsa76d7adas7d6as87d6as78d6aklre423s7d6as8d7s6"
   }

Using as Run Script in Build Phases

You can add the script call for variable replacement on your build phases. We just have setup our Development keys in our local machine as environment variables and build the project.

Important: Is very important to add this Run Script phase before the Compile Sources phase. So the variables will be replaced and then compiled :))

if which variable-injector >/dev/null; then
  variable-injector --file ${SRCROOT}/YourProject/YourGroupFolderPath/File.swift --verbose # Pass your paramenters
else
  echo "Warning: Swift Variable Injector not installed, download from https://github.com/LucianoPAlmeida/variable-injector"
fi

Options

We can ignore patterns that match $(ENV_VAR) to avoid the replace.

variable-injector --file ${SRCROOT}/Envirionment/CI.swift --ignore OTHER_PROD_KEY

And also, to see the logs of variables, values and source output you can use --verbose

IMPORTANT The verbose mode you print the values of your environment variables on the logs. So you may be careful and use it only for debug porpuses.

variable-injector --file ${SRCROOT}/Envirionment/CI.swift --verbose

After that we can just proceed to the build, archive and other steps of our CI/CD pipeline.

Licence

Variable Injector is released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].