File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 cd charts
2727 helm package pybsposter
2828 - id : tagandpush
29- name : Tag and Push
29+ name : Tag and Push (Harbor)
3030 run : |
3131 export BUILDIMGTAG="`cat Dockerfile | tail -n1 | sed 's/^.*\///g'`"
3232 export FINALBUILDTAG="`cat Dockerfile | tail -n1 | sed 's/^#//g'`"
4545 CR_PAT : ${{ secrets.CR_PAT }}
4646 CR_USER : ${{ secrets.CR_USER }}
4747 if : github.ref == 'refs/heads/main'
48+ - id : tagandpushdh
49+ name : Tag and Push (Dockerhub)
50+ run : |
51+ export BUILDIMGTAG="`cat Dockerfile | tail -n1 | sed 's/^.*\///g'`"
52+ # Note the replacement to Dockerhub
53+ export FINALBUILDTAG="`cat Dockerfile | tail -n1 | sed 's/^#.*\//idjohnson\//g'`"
54+ export FINALBUILDLATEST="`cat Dockerfile | tail -n1 | sed 's/^#//g' | sed 's/:.*/:latest/'`"
55+ docker tag $BUILDIMGTAG $FINALBUILDTAG
56+ docker tag $BUILDIMGTAG $FINALBUILDLATEST
57+ docker images
58+ echo $CR_PAT | docker login -u $CR_USER --password-stdin
59+ docker push "$FINALBUILDTAG"
60+ # add a "latest" for others to use
61+ docker push $FINALBUILDLATEST
62+ # Push Charts
63+ export CVER="`cat ./charts/pybsposter/Chart.yaml | grep 'version:' | sed 's/version: //' | tr -d '\n'`"
64+ #helm push ./charts/pybsposter-$CVER.tgz oci://harbor.freshbrewed.science/library/
65+ env : # Or as an environment variable
66+ CR_PAT : ${{ secrets.DH_PAT }}
67+ CR_USER : ${{ secrets.DH_USER }}
68+ if : github.ref == 'refs/heads/main'
4869 - id : tagnpushdry
4970 name : Tag and Push (DRY RUN)
5071 run : |
Original file line number Diff line number Diff line change @@ -19,4 +19,4 @@ ENV NAME=World
1919# Run app.py when the container launches
2020CMD ["python" , "app.py" ]
2121
22- # harbor.freshbrewed.science/library/pybsposter:0.0.4
22+ # harbor.freshbrewed.science/library/pybsposter:0.0.5
Original file line number Diff line number Diff line change @@ -17,23 +17,28 @@ def handle_post():
1717 if total_length > 300 :
1818 text = text [:(300 - len (link ) - 4 )] + "... " # Trim and add ellipsis
1919
20- client = Client ()
20+ try :
21+ client = Client ()
22+ except Exception as e :
23+ print (f"Failed to connect to server: { e } " )
24+
2125 profile = client .login (username , password )
2226
2327 builder = client_utils .TextBuilder ().text (text ).link (link ,link )
2428 text_string = str (builder ) # Convert TextBuilder to a string
25- post = client .send_post (builder )
26- # Don't really need to like my own posts
27- # client.like(post.uri, post.cid)
28-
29- response = {
30-
31- "YOU ARE:" : profile .display_name ,
32- "TEXT" : text_string ,
33- "LINK" : link
34- }
35-
36- return jsonify (response )
29+
30+ try :
31+ post = client .send_post (builder )
32+ response = {
33+ "YOU ARE:" : profile .display_name ,
34+ "TEXT" : text_string ,
35+ "LINK" : link
36+ }
37+
38+ return jsonify (response )
39+ except Exception as e :
40+ print (f"Failed to post: { e } " )
41+ return {'error' : 'Failed to send post' }, 500
3742
3843if __name__ == '__main__' :
3944 app .run (host = '0.0.0.0' , port = 5000 )
You can’t perform that action at this time.
0 commit comments