From 389ce393912fecfdb9431cd7b568e9bd5b802b72 Mon Sep 17 00:00:00 2001 From: Ariel Date: Wed, 27 Jan 2021 19:21:02 -0300 Subject: [PATCH 01/10] Deleted example charts --- charts/org1/repo1/mychart-0.1.0.tgz | Bin 444 -> 0 bytes charts/org2/repo2/otherchart-0.1.0.tgz | Bin 444 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 charts/org1/repo1/mychart-0.1.0.tgz delete mode 100644 charts/org2/repo2/otherchart-0.1.0.tgz diff --git a/charts/org1/repo1/mychart-0.1.0.tgz b/charts/org1/repo1/mychart-0.1.0.tgz deleted file mode 100644 index 53f6dbd81ec3d2c2c340a81597202d9920b306eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 444 zcmV;t0Ym;DiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PK~)irX*{hJDsk41vY4)XF%vWAGk(FQtWEN)L)XiA62RNJ_ft zHt$}PZJ?VT_E6WMpzk2b*v$OK{v>s5dtv?ZZ5a7cs3DmgM8vwP&NCuj&xl2p_k8V2yZNu*Ct z8H`qHzlFt}%kJC)_y-zDIO6YwBH+)b$a(z(yxr>-*2Q@#)yMsID<5HzEg(CcQszc# zL-E#VFQg{x!c_)Ri5)et*}LP$JTida`oHK9iiEqZQA&i^pVQ?=>ZR+`H;`s+7{B#$ zppb+fpff;iZy=O;5&Lv{05=egP=%*7rC)CSS!UznKksQ!a;J@@$$Pwd{^#YD{{@zH m^nVWSx!-+f_k6VGaO*6QNF)-OkDmbm0RR8+Q1^WR5C8x!I@_@T diff --git a/charts/org2/repo2/otherchart-0.1.0.tgz b/charts/org2/repo2/otherchart-0.1.0.tgz deleted file mode 100644 index a4a98d5982e66b87b7d47aed936ef6bd423b6182..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 444 zcmV;t0Ym;DiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PK}Pi`y^|g?-kq7y^r7sg?2CPQZKYy_6PuDLp9mBo?(KBPr=_ zxBl-%SxU2}u!p)11$_re#%A6#_M0)jBinSs`t{qe@<*ZiWL^*vw^eoC5plXBmYC#4 ziTP$*6dO!1FN&f}0B82`M~==5o8Vt-O<(RmK?_AS{Qe8riL8@G*ML0d$gb@#@^87w zzb7^H!joGMrk%47yq5p+Zac|;g`1fFMG%Ah^egeFoPCwLt>L|CnIbP*;YG~=o|{Da z^pwG1rS^MR-MH+=t$=@^o`fU*PACHYJVMUrAK>j#H?S$rN2xv@_j~yOt84|?IHt@E z)P&-V(OyVR)`hDKq!I_JVRv+oJM+K*F7#h0gd*W?W0VrX_UClHlX~sC^bMq06V`8? z>?t^*duR<%(-{b5Uf3STdvHC`09ANOQ~KrFpJg#F^3OZ!l{{!;X Date: Wed, 27 Jan 2021 19:21:11 -0300 Subject: [PATCH 02/10] Deleted example charts --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3b4d1fb..2ad31c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,5 +26,4 @@ services: - "AUTH_SERVICE=localhost:5001" - "AUTH_CERT_PATH=/config/server.pem" volumes: - - "./config:/config:ro" - - "./charts:/charts:rw" + - "./config:/config:ro" \ No newline at end of file From 06f5fd598e40f5020b5d796db0416b9a17b75818 Mon Sep 17 00:00:00 2001 From: Ariel Date: Wed, 27 Jan 2021 19:21:31 -0300 Subject: [PATCH 03/10] Master key from env var --- authserver/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authserver/main.go b/authserver/main.go index 9086ec1..b7ddf49 100644 --- a/authserver/main.go +++ b/authserver/main.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" "time" + "os" cmAuth "github.com/chartmuseum/auth" "github.com/gin-gonic/gin" @@ -13,7 +14,7 @@ var ( tokenGenerator *cmAuth.TokenGenerator tokenExpiry = time.Minute * 5 requiredGrantType = "client_credentials" - masterAccessKey = "MASTERKEY" + masterAccessKey = os.Getenv("AUTH_SERVER_MASTER_KEY") ) func oauthTokenHandler(c *gin.Context) { @@ -55,7 +56,7 @@ func oauthTokenHandler(c *gin.Context) { func main() { var err error tokenGenerator, err = cmAuth.NewTokenGenerator(&cmAuth.TokenGeneratorOptions{ - PrivateKeyPath: "../config/server.key", + PrivateKeyPath: "./config/server.key", }) if err != nil { panic(err) From f38b4921b140d45bdf778e0f7ad1297ab282a3b6 Mon Sep 17 00:00:00 2001 From: Ariel Date: Wed, 27 Jan 2021 19:21:44 -0300 Subject: [PATCH 04/10] Add Dockerfile --- authserver/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 authserver/Dockerfile diff --git a/authserver/Dockerfile b/authserver/Dockerfile new file mode 100644 index 0000000..44b0911 --- /dev/null +++ b/authserver/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.11 + +WORKDIR /app + +COPY . . + +CMD [ "go", "run", "main.go" ] \ No newline at end of file From d6e04ceb919dd37630b4695d0da29461b3787b44 Mon Sep 17 00:00:00 2001 From: Ariel Date: Wed, 27 Jan 2021 19:53:41 -0300 Subject: [PATCH 05/10] Add multi-stage build --- authserver/Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/authserver/Dockerfile b/authserver/Dockerfile index 44b0911..17b1aca 100644 --- a/authserver/Dockerfile +++ b/authserver/Dockerfile @@ -1,7 +1,11 @@ -FROM golang:1.11 +FROM golang:1.11-alpine AS build-env +RUN apk --no-cache add git +ADD . /go/src/app +RUN cd /go/src/app && go get -v +RUN cd /go/src/app && go build -o goapp +# final stage +FROM alpine WORKDIR /app - -COPY . . - -CMD [ "go", "run", "main.go" ] \ No newline at end of file +COPY --from=build-env /go/src/app /app/ +ENTRYPOINT ./goapp \ No newline at end of file From 4fa4989fde6559c0b7eb8db3edc8b9bf9cc92e32 Mon Sep 17 00:00:00 2001 From: Ariel Date: Wed, 27 Jan 2021 20:07:01 -0300 Subject: [PATCH 06/10] Moved Dockerfile to root directory --- authserver/Dockerfile => Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename authserver/Dockerfile => Dockerfile (89%) diff --git a/authserver/Dockerfile b/Dockerfile similarity index 89% rename from authserver/Dockerfile rename to Dockerfile index 17b1aca..cdf52f9 100644 --- a/authserver/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.11-alpine AS build-env RUN apk --no-cache add git -ADD . /go/src/app +ADD authserver /go/src/app RUN cd /go/src/app && go get -v RUN cd /go/src/app && go build -o goapp From 50078579b69bfe3d665abc852c43f7973e332a79 Mon Sep 17 00:00:00 2001 From: Ariel Date: Thu, 28 Jan 2021 10:41:14 -0300 Subject: [PATCH 07/10] Add env var for authserver --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2ad31c1..dd120d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,8 @@ services: ports: - "5001:5001" command: "go run main.go" + environment: + - "AUTH_SERVER_MASTER_KEY=mypassword" working_dir: "/go/src/github.com/chartmuseum/auth-server-example/authserver" volumes: - "./authserver:/go/src/github.com/chartmuseum/auth-server-example/authserver:ro" From b2afdafb68e7d0869e46c1490eeb601cf2433460 Mon Sep 17 00:00:00 2001 From: Blanca Ayala Date: Thu, 28 Jan 2021 12:12:51 -0300 Subject: [PATCH 08/10] add pipeline to build and push from docker images --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bdb7e59 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: Docker Build and Push + +on: + push: + paths: + - 'Dockerfile' + - '.github/workflows/ci.yml' + branches: + - master + release: + types: + - published + +jobs: + build-push: + runs-on: ubuntu-latest + name: Docker Build and Push + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Build,Tag latest and Push for Docker hub + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: craftech/chartmuseum-auth-server + dockerfile: Dockerfile + tags: latest + + - name: Build, Tag Release and Push for Docker hub + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: craftech/chartmuseum-auth-server + dockerfile: Dockerfile + tags: ${GITHUB_REF##*/} + + - uses: craftech-io/slack-action@v1 + with: + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} + slack_channel: deploy + if: always() \ No newline at end of file From 472db52732cf2d7b7ecd588eb650a98a8eabd96d Mon Sep 17 00:00:00 2001 From: Blanca Ayala Date: Thu, 28 Jan 2021 13:54:54 -0300 Subject: [PATCH 09/10] add tag with ref --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdb7e59..6a11d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} repository: craftech/chartmuseum-auth-server dockerfile: Dockerfile - tags: ${GITHUB_REF##*/} + tag_with_ref: true - uses: craftech-io/slack-action@v1 with: From f6250fe11d5151ca4d109f00d1a571d56f1e5fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ariel=20Vi=C3=B1as?= Date: Thu, 28 Jan 2021 14:18:25 -0300 Subject: [PATCH 10/10] Revert "Continuous integration (CI) " --- .github/workflows/ci.yml | 45 ---------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 6a11d64..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Docker Build and Push - -on: - push: - paths: - - 'Dockerfile' - - '.github/workflows/ci.yml' - branches: - - master - release: - types: - - published - -jobs: - build-push: - runs-on: ubuntu-latest - name: Docker Build and Push - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Build,Tag latest and Push for Docker hub - if: github.ref == 'refs/heads/master' - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: craftech/chartmuseum-auth-server - dockerfile: Dockerfile - tags: latest - - - name: Build, Tag Release and Push for Docker hub - if: ${{ github.event_name == 'release' && github.event.action == 'published' }} - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: craftech/chartmuseum-auth-server - dockerfile: Dockerfile - tag_with_ref: true - - - uses: craftech-io/slack-action@v1 - with: - slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - slack_channel: deploy - if: always() \ No newline at end of file