This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Add container release workflow #45
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Container-Release | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
name: Setup rhelocator | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Bootstrap poetry | ||
run: | | ||
curl -sL https://install.python-poetry.org | python - -y | ||
|
||
- name: Update PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Configure poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Ensure cache is healthy | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
run: | | ||
# Using `timeout` is a safeguard against the Poetry command hanging for some reason. | ||
timeout 10s poetry run pip --version || rm -rf .venv | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: List aws hourly images | ||
run: | | ||
mkdir ./results | ||
AWS_REGIONS=$(poetry run rhelocator-updater aws-regions) | ||
regions=$(echo "$AWS_REGIONS" | jq -r '.[]') | ||
for region in ${regions[@]}; do | ||
poetry run rhelocator-updater aws-hourly-images --region $region >> ./results/aws_hourly_images.json | ||
done | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
- name: Build API container | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: rhelocator | ||
tags: latest ${{ github.sha }} | ||
containerfiles: | | ||
./Containerfile | ||
|
||
# TODO: Choose registry and setup secrets | ||
# - name: Log in to the GitHub Container registry | ||
# uses: redhat-actions/podman-login@v1 | ||
# with: | ||
# registry: ${{ }} | ||
# username: ${{ }} | ||
# password: ${{ }} | ||
|
||
# - name: Push to GitHub Container Repository | ||
# id: push-to-ghcr | ||
# uses: redhat-actions/push-to-registry@v2 | ||
# with: | ||
# image: ${{ steps.build-image.outputs.image }} | ||
# tags: ${{ steps.build-image.outputs.tags }} | ||
# registry: ${{ }} | ||
|
||
- name: Archive generated image data | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Upload AWS hourly images | ||
path: ./results | ||
retention-days: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM python:3.10-alpine | ||
|
||
COPY . /opt/rhelocator/ | ||
WORKDIR /opt/rhelocator | ||
|
||
RUN apk update \ | ||
&& apk --no-cache --update add build-base | ||
|
||
ENV POETRY_VERSION=1.2.1 | ||
|
||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
RUN poetry config virtualenvs.create false | ||
RUN poetry install --only main --no-interaction --no-ansi | ||
|
||
# TODO: Implement API backend + add cli command to run and configure API | ||
# EXPOSE 8000 | ||
# CMD ["poetry", "run", "rhelocator-cli", "serve", "--image-data", "/path/to/image/data.json"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy, you get bonus points for using buildah podman! 👏🏻 👏🏻 👏🏻