-
Notifications
You must be signed in to change notification settings - Fork 484
103 lines (94 loc) · 3.44 KB
/
skaffold_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Skaffold
on: [push]
jobs:
build:
name: Skaffold Build
runs-on: ubuntu-22.04
container:
image: gcr.io/k8s-skaffold/skaffold:v2.6.3-lts
# env:
# NODE_ENV: development
# ports:
# - 80
# volumes:
# - my_docker_volume:/volume_mount
# options: --cpus 1
env:
SKAFFOLD_DEFAULT_REPO: docker.io/snickellcdo
BASE_COMMIT: 1e5e6230c17e962fc49c8f0e6b833845db816a49
steps:
- run: |
echo hi
echo "SKAFFOLD_DEFAULT_REPO=$SKAFFOLD_DEFAULT_REPO"
echo "GITHUB_WORKFLOW=${GITHUB_WORKFLOW}"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ vars.K8S_DOCKEHUB_REPOSITORY }}
username: ${{ vars.K8S_DOCKERHUB_USERNAME }}
password: ${{ secrets.K8S_DOCKERHUB_TOKEN }}
# # Pin a base git commit, and cache it + fastforward to the current commit to
# # speedup git checkout
#
# - name: Restore Cache of Git Fetch
# id: cache-git-fetch-restore
# uses: actions/cache/restore@v3
# with:
# path: "${{ github.workspace }}/.git"
# key: git-fetch-${{ hashFiles('**/FETCH_HEAD') }}
# - run: |
# # git clone --branch $DRONE_SOURCE_BRANCH --depth 1 $DRONE_GIT_HTTP_URL .
# git init
# git remote origin add https://github.com/code-dot-org/code-dot-org.git
# git fetch --depth=1 origin $BASE_COMMIT
# git checkout $BASE_COMMIT
# - name: Save Cache of Git Fetch
# id: cache-git-fetch-save
# uses: actions/cache/save@v3
# with:
# path: "${{ github.workspace }}/.git"
# key: git-fetch-${{ hashFiles('**/FETCH_HEAD') }}
# - run: |
# # FIXME: here is where (instead of actions/checkout@v3) we would use our
# # existing .git/ checkout to $BASE_COMMIT, and fast-forward it to
# # $GITHUB_SHA or $GITHUB_WORKFLOW_SHA instead of doing a raw checkout of sources
# #
# # These commands are NOT right, they re-download everything.... what IS right?
# git fetch --depth=1 origin $GITHUB_WORKFLOW_SHA
# git checkout $GITHUB_WORKFLOW_SHA
- name: Checkout sources
uses: actions/checkout@v3
- name: Skaffold Cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-
- run: |
skaffold build \
--push \
&& true
# quicktest:
# name: Quick Test
# runs-on: ubuntu-22.04
# # container:
# # image: alpine
# steps:
# - run: |
# env
# git clone https://github.com/code-dot-org/code-dot-org.git
# env
# echo hi
# echo "DIRECT K8S_DOCKERHUB_REPOSITORY=$K8S_DOCKERHUB_REPOSITORY"
# echo "K8S_DOCKEHUB_REPOSITORY=${{ vars.K8S_DOCKEHUB_REPOSITORY }}"
# echo "SKAFFOLD_DEFAULT_REPO=$SKAFFOLD_DEFAULT_REPO"
# echo "GITHUB_WORKFLOW=${GITHUB_WORKFLOW}"
# env:
# SKAFFOLD_DEFAULT_REPO: ${{ vars.K8S_DOCKEHUB_REPOSITORY }}
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# registry: ${{ secrets.K8S_DOCKEHUB_REPOSITORY }}
# username: ${{ secrets.K8S_DOCKERHUB_USERNAME }}
# password: ${{ secrets.K8S_DOCKERHUB_TOKEN }}