GitHub CI/CD
Summary
GitHub Actions is a powerful CI/CD platform integrated directly into GitHub repositories. It allows you to automate various software development workflows, including building, testing, and deploying your code.
Key Concepts
Workflows: YAML files that define a set of jobs to be executed when triggered by an event.
Jobs: A set of steps that execute on the same runner.
Steps: Individual tasks that can run commands or actions.
Actions: Reusable units of code that can be shared across workflows.
Events: Specific activities that trigger a workflow run.
Workflow Action Structure
This simple workflow runs on push and pull request events, checks out the repository, and runs a simple command.
GitHub Secrets
GitHub secrets are encrypted environment variables used to store sensitive information securely. They are crucial for handling authentication and other confidential data in your workflows.
Types of Secrets
Organization Secrets: Available to all repositories in the
eclipse-pass
organization.Repository Secrets: Specific to a single repository.
Environment Secrets: Tied to a specific environment within a repository.
Creating Secrets
Due to permission restrictions, PASS project members should use the provided Python script to create repository or environment secrets:
For organization secrets, open a ticket with the Eclipse Help Desk.
Using Secrets in Workflows
Reference secrets in your workflows like this:
For reusable workflows, pass secrets explicitly:
In the called workflow, declare expected secrets:
Best Practices
Use reusable workflows for common tasks to maintain DRY principles.
Leverage GitHub-hosted runners when possible to reduce maintenance overhead.
Use environment protection rules for sensitive deployments.
Regularly audit and rotate your secrets.
Use GitHub Actions marketplace for pre-built actions to speed up development.
AWS Integration
To interact with AWS services, including ECR (Elastic Container Registry), you'll need to set up appropriate secrets and use AWS-specific actions in your workflows.
Setting up AWS Credentials
Store your AWS credentials as secrets:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Example Workflow for AWS Deployment
This workflow builds a Docker image and pushes it to Amazon ECR.
Related Information
For more detailed information, refer to the GitHub Actions documentation.
Last updated