Skip to content

Commit

Permalink
Merge branch 'main' into refactor-k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradumnasaraf authored Sep 21, 2024
2 parents 0d0ae22 + 585ea85 commit 0dfe2e9
Show file tree
Hide file tree
Showing 25 changed files with 1,162 additions and 1,100 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/publish-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ jobs:
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}}

- name: Docker Push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/devops:latest
${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}}
platforms: linux/amd64,linux/arm64,linux/arm/v7
9 changes: 7 additions & 2 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Image - GHCR
name: Build and Push Image to GHCR

on:
workflow_dispatch:
Expand Down Expand Up @@ -37,12 +37,17 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/pradumnasaraf/devops:${{ steps.package-version.outputs.current-version}}
ghcr.io/pradumnasaraf/devops:latest
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
github-token: ${{ secrets.PA_TOKEN }}
version-file: 'package.json, package-lock.json'
skip-ci: 'false'
output-file: "false"
create-summary: 'true'

- name: create release
Expand Down
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [2.3.1](https://github.com/Pradumnasaraf/DevOps/compare/v2.3.0...v2.3.1) (2024-09-17)


### Bug Fixes

* Update Docker build and push actions to build and push multi-arch images ([#99](https://github.com/Pradumnasaraf/DevOps/issues/99)) ([f537f16](https://github.com/Pradumnasaraf/DevOps/commit/f537f162f737aceb9ccc95394e93ed677a10b2f8))



# [2.3.0](https://github.com/Pradumnasaraf/DevOps/compare/v2.2.0...v2.3.0) (2024-08-02)


Expand Down Expand Up @@ -34,12 +43,3 @@



## [1.5.1](https://github.com/Pradumnasaraf/DevOps/compare/v2.0.0...v1.5.1) (2024-07-24)


### Bug Fixes

* V2 cleanup ([#93](https://github.com/Pradumnasaraf/DevOps/issues/93)) ([6c852a8](https://github.com/Pradumnasaraf/DevOps/commit/6c852a8b62e9e2208c4271c81832dfaf1a312378))



1 change: 1 addition & 0 deletions docs/golang/concepts/0) test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ func main() {
fmt.Println(numFloat)
fmt.Println(numInt)
}

1 change: 0 additions & 1 deletion docs/golang/concepts/11) slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ func main() {
var fruits []string // We don't need to specify the size of the array
// fruits := []string{} - We can also use this syntax to create a slice
// fruits := make([]string, 2) - We can also use make function to create a slice

fruits = append(fruits, "Apple")
fruits = append(fruits, "Orange")
fruits = append(fruits, "Banana")
Expand Down
3 changes: 2 additions & 1 deletion docs/golang/concepts/12) slices2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import "fmt"
func main() {
// remove an element from a slice
var cars = []string{"BMW", "Audi", "Mercedes", "Ford", "Fiat"}

fmt.Println(cars)
var index int = 2
// We are concatenating two slice and rewriting the 1st Slice.
cars = append(cars[:index], cars[index+1:]...) // remove the element at index 2. :index is from 0 to index-1, [index+1:] is from index+1 to end. We can append both elements as well as a slice. ... is to denote a slice
fmt.Println(cars)

Expand Down
10 changes: 5 additions & 5 deletions docs/golang/concepts/13) map.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
)

func main() {
// var languages = map[string]string{}
var languages = make(map[string]string, 0) // create a slice of maps with a length of 0. // map[keyType]valueType
var languages = map[string]string{}
// var languages = make(map[string]string, 0) // create a slice of maps with a length of 0. // map[keyType]valueType

//laguages[key] = value
languages["JS"] = "JavaScript"
Expand All @@ -17,10 +17,10 @@ func main() {
fmt.Println(languages)
fmt.Println(languages["JS"]) // access the value of a key

delete(languages, "RB") // delete a key from a map
delete(languages, "RB") // Deleting a Key (No key means no Value as well)
fmt.Println(languages)

for _, value := range languages {
fmt.Println(value)
for key, value := range languages {
fmt.Println(key, value)
}
}
24 changes: 14 additions & 10 deletions docs/golang/concepts/20) methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@ package main

import "fmt"

type UserData struct { // struct is a collection of fields.
type UserData struct {
fistName string
lastName string
email string
numberOfTickets int
}

/*
func (receiver Type) MethodName(parameters) returnType {
// method body
}
*/

func (u UserData) greetUser() {
fmt.Println("Hello", u.fistName, u.lastName)
}

func main() {
user := UserData{ // struct initialization
user := UserData{
fistName: "John",
lastName: "Doe",
email: "[email protected]",
numberOfTickets: 2,
}

fmt.Println(user)

user.greetUser() // Method call
}

func (u UserData) greetUser() { // method with receiver
fmt.Println("Hello", u.fistName, u.lastName)

user.greetUser() // Call the method
}
2 changes: 2 additions & 0 deletions docs/golang/concepts/21) defer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import "fmt"


// Defer statements are run at the end
func main() {
defer fmt.Println("This is the first defer statement")
defer fmt.Println("This is the second defer statement")
Expand Down
6 changes: 3 additions & 3 deletions docs/golang/concepts/22) map-ad.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import (
)

func main() {
var bookings = make([]map[string]string, 0) // This is a slice of map.
// var bookings = []map[string]string{} // This is also valid

bookings :=[]map[string]string{} // This is a slice of map.

for i := 0; i < 1; i++ {

name := "John"
age := 32
city := "New York"

var myMap = make(map[string]string)
myMap := map[string]string{}

myMap["name"] = name
myMap["age"] = strconv.FormatInt(int64(age), 10)
Expand Down
16 changes: 12 additions & 4 deletions docs/golang/concepts/23) files.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import (

func main() {

// Process to create, write and read a file

content := "Hey I am Pradumna"

//"." means current directory
// Create a file
file, err := os.Create("./hello.txt")

if err != nil {
panic(err)
}

// Writing content in a file
length, err := io.WriteString(file, content)

if err != nil {
Expand All @@ -27,13 +26,22 @@ func main() {

fmt.Println("Length:", length)

// Reading a file
data, err := os.ReadFile("./hello.txt")

if err != nil {
panic(err)

}

// data is of type []byte so we need to convert it to string
// Print the read data
fmt.Println(string(data))

//Removing a file
err = os.Remove("./hello.txt")

if err != nil {
panic(err)

}
}
5 changes: 3 additions & 2 deletions docs/golang/concepts/24) handling-web-req.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ func main() {

fmt.Printf("Response is of type: %T\n", res)
fmt.Println(res.Status)
fmt.Println(res.Proto)

databytes, err := io.ReadAll(res.Body) //We can't read the response directly. So we use ioutil.ReadAll()
dataBytes, err := io.ReadAll(res.Body) //We can't read the response directly. So we use ioutil.ReadAll()
checkNilError(err)

content := string(databytes) // convert the byte array to string
content := string(dataBytes) // convert the byte array to string
fmt.Println(content)
}

Expand Down
1 change: 0 additions & 1 deletion docs/golang/concepts/26) http-requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
Expand Down
Loading

0 comments on commit 0dfe2e9

Please sign in to comment.