Skip to content

Commit

Permalink
docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
vggonzal authored and vggonzal committed Oct 19, 2023
1 parent 775bcb7 commit de06e71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
35 changes: 8 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ jobs:
run: poetry install
- name: Lint
run: |
poetry run pylint hydrocron_api
poetry run flake8 hydrocron_api
poetry run pylint hydrocronapi
poetry run flake8 hydrocronapi
## Set environment variables
- name: Configure Initial YAML file and environment variables
run: |
Expand All @@ -110,7 +108,6 @@ jobs:
echo "GITHUB_REF_READABLE=${GITHUB_REF_READABLE}" >> $GITHUB_ENV
echo "THE_ENV=sit" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=SIT" >> $GITHUB_ENV
- name: Run Snyk as a blocking step
uses: snyk/actions/python-3.9@master
env:
Expand Down Expand Up @@ -155,49 +152,33 @@ jobs:
- name: Build Python Artifact
run: |
poetry build
- name: Test with pytest
if: |
github.ref == 'test'
run: |
poetry run pytest tests/test_api.py -k 'test_gettimeseries_get'
poetry run pytest tests/test_hydrocron_database.py
poetry run pytest tests/test_io_swot_reach_node_shp.py
## Set environment variables
- name: Configure Initial YAML file and environment variables
run: |
echo "THE_VERSION=${{ env.software_version }}" >> $GITHUB_ENV;
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV;
GITHUB_REF_READABLE="${GITHUB_REF//\//-}"
echo "GITHUB_REF_READABLE=${GITHUB_REF_READABLE}" >> $GITHUB_ENV
echo "THE_ENV=sit" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=SIT" >> $GITHUB_ENV
pytest tests/test_api.py -k 'test_gettimeseries_get'
# Setup docker to build and push images
- name: Log in to the Container registry
if: ${{ startsWith(github.ref, 'test') }}
#if: ${{ startsWith(github.ref, 'test') }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: ${{ startsWith(github.ref, 'test') }}
#if: ${{ startsWith(github.ref, 'test') }}
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ env.THE_VERSION }}
type=raw,value="0.0.1"
type=raw,value=${{ env.THE_ENV }}
- name: Build and push Docker image
if: ${{ startsWith(github.ref, 'test') }}
#if: ${{ startsWith(github.ref, 'test') }}
#if: |
# github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/main' ||
Expand Down
2 changes: 1 addition & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ variable "profile" {
}

variable "docker_tag" {
default = "ghcr.io/podaac/hydrocron-api:0.0.1"
default = "ghcr.io/podaac/hydrocron-api:sit"
}

variable "service_name" {
Expand Down

0 comments on commit de06e71

Please sign in to comment.