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
import datetime | |
from airflow import DAG | |
from airflow.providers.sqlite.hooks.sqlite import SqliteHook | |
from airflow.providers.sqlite.operators.sqlite import SqliteOperator | |
SQLITE_CONN_ID = "sqlite_test_conn" | |
with DAG( | |
dag_id="03_exercise", |
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
FROM python:3.10.6 | |
ARG CODEARTIFACT_USER | |
ARG CODEARTIFACT_AUTH_TOKEN | |
ARG CODEARTIFACT_REPOSITORY_URL | |
ENV POETRY_VERSION=1.1.15 \ | |
POETRY_HOME=/usr/local | |
COPY pyproject.toml poetry.lock . |
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
FROM python:3.10.6 | |
ARG CODEARTIFACT_USER | |
ARG CODEARTIFACT_AUTH_TOKEN | |
COPY requirements.txt requirements-private.txt . | |
RUN pip install -r requirements.txt \ | |
&& pip install -r requirements-private.txt |
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
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token \ | |
--duration-seconds 900 \ | |
--domain <my_domain> \ | |
--query authorizationToken \ | |
--output text` | |
docker build \ | |
--build-arg CODEARTIFACT_USER=aws \ | |
--build-arg CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN \ | |
--tag example \ | |
. |
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
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain <my_domain> --query authorizationToken --output text` | |
export CODEARTIFACT_USER=aws | |
poetry config http-basic.test123 $CODEARTIFACT_USER $CODEARTIFACT_AUTH_TOKEN | |
poetry install |
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
[tool.poetry] | |
name = "app" | |
version = "0.1.0" | |
description = "" | |
authors = ["example <example@example.com>"] | |
[[tool.poetry.source]] | |
name = "test123_codeartifact" | |
url = "https://<my_domain>-<account_id>.d.codeartifact.<region>.amazonaws.com/pypi/test123/simple/" |
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
--index-url https://aws:${CODEARTIFACT_AUTH_TOKEN}@<my_domain>-<account_id>.d.codeartifact.<region>.amazonaws.com/pypi/test123/simple/ | |
test123 |
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
# 1. Obtain an authentication token | |
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain <my_domain> --query authorizationToken --output text` | |
# 2. Set the --index-url argument during installation. | |
# Use the token from (1) as the password for HTTP basic authentication. | |
python3 -m pip install --index-url "https://aws:${CODEARTIFACT_AUTH_TOKEN}@<my_domain>-<account_id>.d.codeartifact.<region>.amazonaws.com/pypi/test123/simple/" test123==0.0.1 |
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
python3 -m pip install --upgrade build twine | |
python3 -m build | |
python3 -m twine upload --repository test123 dist/* |
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
# Option 1: login command | |
aws codeartifact login --tool twine --domain <my_domain> --repository test123 | |
# Option 2: environment variables | |
export TWINE_USERNAME=aws | |
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain <my_domain> --query authorizationToken --output text` | |
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain <my_domain> --repository test123 --format pypi --query repositoryEndpoint --output text` |
NewerOlder