GCP Classroom notes 09/Nov/2024

Publishing test results using core actions


Contexts

  • Github actions contexts are special variables that provide information about the workflow, the job and the environment Refer Here for official docs
  • To use the context variable the syntax is ${{ context.property }}

ENVIRONMENTAL Variables

  • Refer Here for official docs
  • Defining Envrionmental variables
    • at a workflow level
    • at a job level
    • at a step level
---
name: ci-worflow
on: 
push:
    branches:
    - main
env:
    MY_WORKFLOW_VAR:  "hello"
jobs:
build:
    name: build java code using maven
    env:
      MY_JOB_VAR: "job-hello"
    runs-on: ubuntu-24.04
    steps:
    - name: get the code
        uses: actions/checkout@v4
    - run: printenv
      env:
        MY_STEP_VAR: "step-hello"
    - run: "echo $MY_WORKFLOW_VAR, $MY_JOB_VAR, $MY_STEP_VAR"
      env:
        MY_STEP_VAR: "step-hello"
    - run: Set environmental variable
      run: "MY_DYNAMIC_VAR=Hello"
    - name: setup java 17
        uses: actions/setup-java@v4.5.0
        with:
        java-version: 17
        distribution: temurin
  • To use environmental variable use $VAR_NAME SYNTAX

Secrets and Configuration values



VSCODE Extension and other areas


Building Github actions

Creating a Docker image action

  • Refer Here for the repository
  • Create credentials and store them as secrets
  • Refer Here for the workflow with secret scanning
  • Exercise:
    • Show failure for any critical issues
    • Push the image to acr/ecr/gcr
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers
Exit mobile version
%%footer%%