Repo of shared resources (gh actions, dockerfiles, etc) for automating OSL deployments
Using HyP3's actions as an example to work from.
A collection of reusable workflows that are shared accros this orginization.
Sets up variables/tags for each repo. Use like:
name: Setup Environment
on:
push:
branches:
- main
jobs:
call-setup-env-workflow:
# Docs at: https://github.com/ASFOpenSARlab/osl-utils?tab=readme-ov-file#reusable-setup-envyaml
uses: ASFOpenSARlab/osl-utils/.github/workflows/[email protected]
with:
tagname: ${{ github.ref_name }} # Optional; default shown
aws-region: us-west-2 # Optional; default shown
This is used to figure out what environment to use, figure out when you're running on a tag, etc.
This is to build a docker container, that has all our CloudFormation/etc tools, that we can use inside other actions or locally to have a similar environment. It is made to be used in other repos like so:
jobs:
# This job makes sure the container uri is all lowercase:
docker-tag:
# Docs at: https://github.com/ASFOpenSARlab/osl-utils?tab=readme-ov-file#docker-buildyaml
env:
IMAGE_REPO: ghcr.io/ASFOpenSARlab/osl-utils
IMAGE_REPO_TAG: v0.0.2
runs-on: ubuntu-latest
outputs:
container-uri: ${{ steps.container.outputs.uri }}
steps:
- name: Save Container Info
id: container
run: echo "uri=${{ env.IMAGE_REPO }}:${{ env.IMAGE_REPO_TAG }}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
# Run the actions steps inside of the container:
your-job-here:
runs-on: ubuntu-latest
container:
image: ${{ needs.docker-tag.outputs.container-uri }}
credentials:
username: ASFOpenSARlab-bot
password: ${{ secrets.PAT_PACKAGES_READ_ONLY }}
steps:
- uses: actions/checkout@v4
- run: echo "Inside the Custom Image!"
# ...
When the image is built, it's tagged with the info from reusable-setup-env.yaml
. You can use this to test changes here in other actions (Change their tag from v0.0.2
to dev
for example), before merging the changes up the maturities here.
Uses hadolint
to lint and format Dockerfiles.
name: Lint Dockerfiles
on:
pull_request:
jobs:
shell:
uses:
ASFOpenSARlab/osl-utils/.github/workflows/reusable-dockerfile-code-quality.yaml@main
Uses djlint
to lint and format Jinja2
templates. Per-repo configurations are available with a configuration file,
pyproject.toml
/djlint.toml
/.djlintrc
(see the
djlint docs).
name: Lint Jinja Templates
on:
pull_request:
jobs:
shell:
uses:
ASFOpenSARlab/osl-utils/.github/workflows/reusable-jinja2-code-quality.yaml@main
Uses Ruff to lint and format Python source files.
Configure via a pyproject.toml
, ruff.toml
, or .ruff.toml
file (see the
Ruff docs).
name: Lint Python
on:
pull_request:
jobs:
shell:
uses:
ASFOpenSARlab/osl-utils/.github/workflows/reusable-python-code-quality.yaml@main
Uses shellcheck
and
shfmt
to lint and format (respectively) shell
code.
name: Lint Shell
on:
pull_request:
jobs:
shell:
uses:
ASFOpenSARlab/osl-utils/.github/workflows/reusable-shell-code-quality.yaml@main
Uses yamllint
and
yamlfmt
to lint and format (respectively) YAML.
name: Lint yaml
on:
pull_request:
jobs:
shell:
uses:
ASFOpenSARlab/osl-utils/.github/workflows/reusable-yaml-code-quality.yaml@main