|
1 |
| -name: Generate Data Usage Report |
2 |
| - |
3 |
| -on: |
4 |
| - pull_request: |
5 |
| - branches: |
6 |
| - - main |
7 |
| - |
8 |
| -jobs: |
9 |
| - generate_data_usage_report: |
10 |
| - runs-on: ubuntu-latest |
11 |
| - |
12 |
| - steps: |
13 |
| - - name: Checkout code |
14 |
| - uses: actions/checkout@v3 |
15 |
| - |
16 |
| - - name: Log in to DockerHub |
17 |
| - uses: docker/login-action@v2 |
18 |
| - with: |
19 |
| - username: ${{ secrets.DOCKERHUB_USERNAME }} |
20 |
| - password: ${{ secrets.DOCKERHUB_TOKEN }} |
21 |
| - |
22 |
| - - name: Build and push Docker image |
23 |
| - uses: docker/build-push-action@v3 |
24 |
| - with: |
25 |
| - context: . |
26 |
| - file: images/Dockerfile.dandihub_report_generator |
27 |
| - push: true |
28 |
| - tags: ${{ secrets.DOCKERHUB_USERNAME }}/dandihub-report-generator:latest |
29 |
| - |
30 |
| - - name: Configure AWS credentials |
31 |
| - uses: aws-actions/configure-aws-credentials@v3 |
32 |
| - with: |
33 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
34 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
35 |
| - aws-region: us-east-2 |
36 |
| - |
37 |
| - - name: Assume ProvisioningRole |
38 |
| - run: | |
39 |
| - CREDS=$(aws sts assume-role --role-arn ${{ secrets.AWS_PROVISIONING_ROLE_ARN }} --role-session-name "GitHubActionsSession") |
40 |
| - export AWS_ACCESS_KEY_ID=$(echo $CREDS | jq -r '.Credentials.AccessKeyId') |
41 |
| - export AWS_SECRET_ACCESS_KEY=$(echo $CREDS | jq -r '.Credentials.SecretAccessKey') |
42 |
| - export AWS_SESSION_TOKEN=$(echo $CREDS | jq -r '.Credentials.SessionToken') |
43 |
| -
|
44 |
| - - name: Configure kubectl with AWS EKS |
45 |
| - run: | |
46 |
| - aws eks update-kubeconfig --name eks-dandihub --region us-east-2 --role-arn ${{ secrets.AWS_PROVISIONING_ROLE_ARN }} |
47 |
| -
|
48 |
| - # TODO remove |
49 |
| - - name: Sanity check |
50 |
| - run: | |
51 |
| - kubectl get pods -n jupyterhub |
52 |
| -
|
53 |
| - # - name: Deploy Hello World Pod |
54 |
| - # run: | |
55 |
| - # kubectl apply -f .github/manifests/hello-world-pod.yaml |
56 |
| - # |
57 |
| - # - name: Wait for Hello World Pod to complete |
58 |
| - # run: | |
59 |
| - # kubectl wait --for=condition=Ready pod/hello-world-pod --timeout=300s # 5 minutes |
60 |
| - # continue-on-error: true # Allow the workflow to continue even if this step fails |
61 |
| - # |
62 |
| - # - name: Get Hello World Pod logs |
63 |
| - # run: | |
64 |
| - # kubectl logs hello-world-pod |
65 |
| - # if: ${{ success() }} # Only run this step if the previous step was successful |
66 |
| - # |
67 |
| - # - name: Delete Hello World Pod |
68 |
| - # run: | |
69 |
| - # kubectl delete pod hello-world-pod |
70 |
| - # if: ${{ always() }} # Always run this step, even if other steps fail |
71 |
| - # |
72 |
| - - name: Replace image placeholder in manifest |
73 |
| - run: | |
74 |
| - sed -i 's|IMAGE_PLACEHOLDER|'"${{ secrets.DOCKERHUB_USERNAME }}/dandihub-report-generator:latest"'|' .github/manifests/disk-usage-report-job.yaml |
75 |
| -
|
76 |
| - - name: Deploy Disk Usage Report Job |
77 |
| - run: | |
78 |
| - kubectl apply -f .github/manifests/disk-usage-report-job.yaml |
79 |
| -
|
80 |
| - # TODO should timeout be longer? |
81 |
| - - name: Wait for Disk Usage Report Job to complete |
82 |
| - run: | |
83 |
| - kubectl wait --for=condition=complete job/disk-usage-report-job --timeout=360s -n jupyterhub |
84 |
| - continue-on-error: true |
85 |
| - |
86 |
| - # continue-on-error for previous steps so we delete the job |
87 |
| - - name: Delete Disk Usage Report Job |
88 |
| - run: | |
89 |
| - kubectl delete job disk-usage-report-job -n jupyterhub |
90 |
| -
|
91 |
| - # - name: Clone dandi-hub-usage-reports repository |
92 |
| - # run: | |
93 |
| - # git clone https://github.com/dandi/dandi-hub-usage-reports.git |
94 |
| - # |
95 |
| - # - name: Copy report file to repository, commit and push report |
96 |
| - # run: | |
97 |
| - # cd dandi-hub-usage-reports |
98 |
| - # DATE=$(date +'%Y-%m-%d') |
99 |
| - # mv ../du_report.json $DATE_du_report.json |
100 |
| - # git config --global user.name "GitHub Actions" |
101 |
| - # git config --global user.email "[email protected]" |
102 |
| - # git add $DATE_du_report.json |
103 |
| - # git commit -m "Add disk usage report for $DATE" |
104 |
| - # git push https://${{ secrets.GITHUB_TOKEN }}@github.com/dandi/dandi-hub-usage-reports.git |
| 1 | +# name: Generate Data Usage Report |
| 2 | +# |
| 3 | +# on: |
| 4 | +# pull_request: |
| 5 | +# branches: |
| 6 | +# - main |
| 7 | +# |
| 8 | +# jobs: |
| 9 | +# generate_data_usage_report: |
| 10 | +# runs-on: ubuntu-latest |
| 11 | +# |
| 12 | +# steps: |
| 13 | +# - name: Checkout code |
| 14 | +# uses: actions/checkout@v3 |
| 15 | +# |
| 16 | +# - name: Log in to DockerHub |
| 17 | +# uses: docker/login-action@v2 |
| 18 | +# with: |
| 19 | +# username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 20 | +# password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 21 | +# |
| 22 | +# - name: Build and push Docker image |
| 23 | +# uses: docker/build-push-action@v3 |
| 24 | +# with: |
| 25 | +# context: . |
| 26 | +# file: images/Dockerfile.dandihub_report_generator |
| 27 | +# push: true |
| 28 | +# tags: ${{ secrets.DOCKERHUB_USERNAME }}/dandihub-report-generator:latest |
| 29 | +# |
| 30 | +# - name: Configure AWS credentials |
| 31 | +# uses: aws-actions/configure-aws-credentials@v3 |
| 32 | +# with: |
| 33 | +# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 34 | +# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 35 | +# aws-region: us-east-2 |
| 36 | +# |
| 37 | +# - name: Assume ProvisioningRole |
| 38 | +# run: | |
| 39 | +# CREDS=$(aws sts assume-role --role-arn ${{ secrets.AWS_PROVISIONING_ROLE_ARN }} --role-session-name "GitHubActionsSession") |
| 40 | +# export AWS_ACCESS_KEY_ID=$(echo $CREDS | jq -r '.Credentials.AccessKeyId') |
| 41 | +# export AWS_SECRET_ACCESS_KEY=$(echo $CREDS | jq -r '.Credentials.SecretAccessKey') |
| 42 | +# export AWS_SESSION_TOKEN=$(echo $CREDS | jq -r '.Credentials.SessionToken') |
| 43 | +# |
| 44 | +# - name: Configure kubectl with AWS EKS |
| 45 | +# run: | |
| 46 | +# aws eks update-kubeconfig --name eks-dandihub --region us-east-2 --role-arn ${{ secrets.AWS_PROVISIONING_ROLE_ARN }} |
| 47 | +# |
| 48 | +# # TODO remove |
| 49 | +# - name: Sanity check |
| 50 | +# run: | |
| 51 | +# kubectl get pods -n jupyterhub |
| 52 | +# |
| 53 | +# # - name: Deploy Hello World Pod |
| 54 | +# # run: | |
| 55 | +# # kubectl apply -f .github/manifests/hello-world-pod.yaml |
| 56 | +# # |
| 57 | +# # - name: Wait for Hello World Pod to complete |
| 58 | +# # run: | |
| 59 | +# # kubectl wait --for=condition=Ready pod/hello-world-pod --timeout=300s # 5 minutes |
| 60 | +# # continue-on-error: true # Allow the workflow to continue even if this step fails |
| 61 | +# # |
| 62 | +# # - name: Get Hello World Pod logs |
| 63 | +# # run: | |
| 64 | +# # kubectl logs hello-world-pod |
| 65 | +# # if: ${{ success() }} # Only run this step if the previous step was successful |
| 66 | +# # |
| 67 | +# # - name: Delete Hello World Pod |
| 68 | +# # run: | |
| 69 | +# # kubectl delete pod hello-world-pod |
| 70 | +# # if: ${{ always() }} # Always run this step, even if other steps fail |
| 71 | +# # |
| 72 | +# - name: Replace image placeholder in manifest |
| 73 | +# run: | |
| 74 | +# sed -i 's|IMAGE_PLACEHOLDER|'"${{ secrets.DOCKERHUB_USERNAME }}/dandihub-report-generator:latest"'|' .github/manifests/disk-usage-report-job.yaml |
| 75 | +# |
| 76 | +# - name: Deploy Disk Usage Report Job |
| 77 | +# run: | |
| 78 | +# kubectl apply -f .github/manifests/disk-usage-report-job.yaml |
| 79 | +# |
| 80 | +# # TODO should timeout be longer? |
| 81 | +# - name: Wait for Disk Usage Report Job to complete |
| 82 | +# run: | |
| 83 | +# kubectl wait --for=condition=complete job/disk-usage-report-job --timeout=360s -n jupyterhub |
| 84 | +# continue-on-error: true |
| 85 | +# |
| 86 | +# # continue-on-error for previous steps so we delete the job |
| 87 | +# - name: Delete Disk Usage Report Job |
| 88 | +# run: | |
| 89 | +# kubectl delete job disk-usage-report-job -n jupyterhub |
| 90 | +# |
| 91 | +# # - name: Clone dandi-hub-usage-reports repository |
| 92 | +# # run: | |
| 93 | +# # git clone https://github.com/dandi/dandi-hub-usage-reports.git |
| 94 | +# # |
| 95 | +# # - name: Copy report file to repository, commit and push report |
| 96 | +# # run: | |
| 97 | +# # cd dandi-hub-usage-reports |
| 98 | +# # DATE=$(date +'%Y-%m-%d') |
| 99 | +# # mv ../du_report.json $DATE_du_report.json |
| 100 | +# # git config --global user.name "GitHub Actions" |
| 101 | +# # git config --global user.email "[email protected]" |
| 102 | +# # git add $DATE_du_report.json |
| 103 | +# # git commit -m "Add disk usage report for $DATE" |
| 104 | +# # git push https://${{ secrets.GITHUB_TOKEN }}@github.com/dandi/dandi-hub-usage-reports.git |
0 commit comments