Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Total TestsTest ExecutedPassFailIn Progress
22201

CI/CD process :

  1. Add Gerrit credentials under Manage Jenkins > Manage credentials > Add new cred using your Gerrit user name and password. 
  2. Install Gerrit trigger plugin & post-build task plugin from > Manage Jenkins > Manage plugins > Available plugins.
  3. Create a new free style job and add Gerrit account with the credentials you added 
  4. Add the following to the build script   
    wget https://releases.hashicorp.com/terraform/0.14.9/terraform_0.14.9_linux_amd64.zip
    unzip terraform_0.14.9_linux_amd64.zip
    sudo mv terraform /usr/local/bin/
    terraform --help
    export TF_VAR_aws_region="us-east-2"
    export TF_VAR_aws_ami="ami-026141f3d5c6d2d0c"
    export TF_VAR_aws_instance="t4g.medium"
    export TF_VAR_vpc_id="vpc-561e9f3e"
    export TF_VAR_aws_subnet_id="subnet-d64dcabe"
    export TF_VAR_access_key="AKIAY4UPZOCVUNW6T6HN"
    export TF_VAR_secret_key="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"
    export TF_LOG="TRACE"
    export TF_LOG_PATH="./tf.log"
    pip3 install lftools
    python -m ensurepip --upgrade
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    export CRYPTOGRAPHY_DONT_BUILD_RUST=1
    apt-get install build-essential libssl-dev libffi-dev

    cd /var/jenkins_home/workspace/gerrit-akraino/src/foundation/microk8s
    terraform init
    terraform plan
    terraform apply -auto-approve 



  5. Add the following to the post build task 

    echo "post build tasks"
    cat /var/jenkins_home/workspace/gerrit-akraino/src/foundation/microk8s/tf.log
    echo $BUILD_NUMBER
    NEXUS_URL=https://nexus.akraino.org
    SILO=gopaddle
    JENKINS_HOSTNAME=35.239.217.210:30016
    JOB_NAME=gerrit-akraino
    BUILD_URL="${JENKINS_HOSTNAME}/job/${JOB_NAME}/${BUILD_NUMBER}/"
    NEXUS_PATH="${SILO}/job/${JOB_NAME}/${BUILD_NUMBER}"
    lftools deploy logs $NEXUS_URL $NEXUS_PATH $BUILD_URL
    echo "Logs uploaded to $NEXUS_URL/content/sites/logs/$NEXUS_PATH"6. 

  6. To configure Gerrit trigger 
    create a folder ~/.ssh
    generate ssh key using ssh-keygen -m PEM 
    Register the ssh key with your Gerrit account 
    check connectivity using ssh -p 29418 ashvin301@gerrit.akraino.org
    Add the userName/email/ssh_key/hostName/port to the Gerrit trigger 

  7. Build the job. Look under /var/jenkins_home/workspace/gerrit-akraino for code