Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Github Actions Pipeline for openshift deployment

Use Case

Write a github action job which would build an image and then publish to ghcr. Upon Successful publishing, trigger a openshift deployment


name: OpenShift Deployment

on:
push:
branches:
– main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
  uses: actions/checkout@v2

- name: Build Docker image
  run: docker build -t my-image:latest .

- name: Log in to Docker registry
  run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push Docker image to GHCR
  run: docker push ghcr.io/${{ github.repository_owner }}/my-image:latest

- name: Set up OpenShift CLI
  uses: redhat-actions/oc-login@v1
  with:
    openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
    openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}

- name: Trigger OpenShift deployment
  run: |
    oc project my-project
    oc rollout latest deployment/my-deploymentCode language: JavaScript (javascript)

To use this workflow, you need to set up the following secrets in your GitHub repository:

  • OPENSHIFT_SERVER_URL: The URL of your OpenShift server.
  • OPENSHIFT_TOKEN: An authentication token to access your OpenShift cluster.

Make sure to replace my-image, my-project, and my-deployment with your own image, project, and deployment names.

This workflow listens for pushes to the main branch. When a push event occurs, it checks out the repository, builds a Docker image, logs in to GHCR using the provided GITHUB_TOKEN, pushes the image to GHCR, sets up the OpenShift CLI using the provided secrets, and finally triggers an OpenShift deployment by rolling out the latest changes to the specified deployment.

Ensure that your GitHub Actions runner has the necessary access permissions to push the Docker image to GHCR and trigger the OpenShift deployment.

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x